[Mono-list] Ok this is probably an odd question and very general

Chris Howie cdhowie at gmail.com
Fri Jun 20 09:29:05 EDT 2008


Don't forget to Dispose the Pixbuf when you are done with it.  This
includes the temporary Pixbuf that is left over after calling
ScaleSimple.

               image1.Clear();
               img.Dispose();
               img = null;

               using (Gdk.Image tempimg = new
Gdk.Pixbuf("/imgpath/"+i.ToString() )) { //images are sequenced no
ext for now
                   img = img.ScaleSimple(800 ,600 ,Gdk.InterpType.Bilinear);
                   image1.Pixbuf  = img ;
               }

Apply the same logic to the constructor.

On Fri, Jun 20, 2008 at 1:19 AM, tmasey <epiphanygs at gmail.com> wrote:
>
> ok So hears the deal now. I have another method of getting the frames to jpg.
> So now I am working with the simple fact every 10 seconds I want to show a
> new frame for now. but my problem is I have a window with a Gtk.Image widget
> and I have loaded up a dynamic pixbuf with that image and for now I have a
> timer object in the future no but for testing purposes I am using a timer. I
> have on each timer_Elapsed even i create a new Pixbuff from a new image. and
> clear or not clear the widget. then I set the Pixbuf for the image widget
> and after about 2 or three ticks of the timer I get no images showing up.
> Now this is odd. I also notice that my memory is going crazy. so i added a
> GC.Collect. in there for good measure and that allows me a few more ticks
> but then back to the same issue nothing after the 5 frame. I will attach my
> code. any advice would be helpfull I am going nuts on this. Something I
> normaly would be able to do in ms world not working as I would expect it
> here. But I am sure it is because I dont understand something about the gtk
> and gdk libs. when looking at the code you will notice commented code paths
> I have tried. I am thinking it might be timeout issues.
>
> thanks,
> Terry
>
> //=========================
> // MainWindow.cs created with MonoDevelop
> // User: tmassey at 10:28 PM 6/18/2008
> //Copyright 2008 Epiphany Studios
> //=========================
> //
> using System;
> using System.Timers;
> using Gtk;
>
> public partial class MainWindow: Gtk.Window
> {
>        private System.Timers.Timer tmr = new System.Timers.Timer(10000);
>        private Gtk.Image image1;
>        private Gdk.Pixbuf img;
>        private int i=1;
>        public MainWindow (): base (Gtk.WindowType.Toplevel)
>        {
>                Build ();
>                image1 = new Gtk.Image();
>                tmr.Elapsed += new ElapsedEventHandler(tmr_elapsed);
>                Gdk.Pixbuf x= new Gdk.Pixbuf("/imgpath/1");
>                x = x.ScaleSimple(800 ,600 ,Gdk.InterpType.Bilinear);
>                image1.Pixbuf = x;
>                hbox1.PackStart(image1,true,true,0);
>                this.ShowAll();
>                tmr.Start();
>        }
>        public void tmr_elapsed(object sender, ElapsedEventArgs a)
>        {
>                i+=1;
>                img = new Gdk.Pixbuf("/imgpath/"+i.ToString() ); //images are sequenced no
> ext for now
>                img = img.ScaleSimple(800 ,600 ,Gdk.InterpType.Bilinear);
>                image1.Clear();
>                image1.Pixbuf  = img ;
>                this.ShowAll();
>                GC.Collect();
>                Console.WriteLine("/imgpath/"+i.ToString());
>        }
>
>        protected void OnDeleteEvent (object sender, DeleteEventArgs a)
>        {
>                Application.Quit ();
>                a.RetVal = true;
>        }
> }
>
> --
> View this message in context: http://www.nabble.com/Ok-this-is-probably-an-odd-question-and-very-general-tp18012126p18023248.html
> Sent from the Mono - General mailing list archive at Nabble.com.
>
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>



-- 
Chris Howie
http://www.chrishowie.com
http://en.wikipedia.org/wiki/User:Crazycomputers


More information about the Mono-list mailing list