public void Repaint(int width, int height) { //Gegl.Rectangle roi = new Gegl.Rectangle(x, y, Allocation.Width / scale, Allocation.Height/scale); processor_rect = new Gegl.Rectangle(); processor_rect.Set(x, y, (uint) (width / scale), (uint) (height/scale)); Processor.Rectangle = processor_rect; // refresh view twice a second if (timeout_id == 0) { timeout_id = GLib.Timeout.Add(200, delegate { double progress; Console.WriteLine("working: " + Allocation.Width + " " + Allocation.Height + " " + processor_rect.Width + " " + processor_rect.Height); bool more = Processor.Work(out progress); if (!more) { HandleNodeComputed(null, processor_rect); timeout_id = 0; } return more; }); } }
private void HandleViewExposed(object sender, ExposeEventArgs args) { Console.WriteLine("exposed"); if (Node != null) { foreach (Gdk.Rectangle rect in args.Event.Region.GetRectangles()) { Gegl.Rectangle roi = new Gegl.Rectangle(); roi.Set((int)(X + rect.X / Scale), (int)(Y + rect.Y / Scale), (uint)rect.Width, (uint)rect.Height); byte [] buf = Node.Render(roi, Scale, "R'G'B' u8", Gegl.BlitFlags.Cache | Gegl.BlitFlags.Dirty); this.GdkWindow.DrawRgbImage( Style.WhiteGC, rect.X, rect.Y, rect.Width, rect.Height, Gdk.RgbDither.None, buf, rect.Width * 3 ); } } args.RetVal = false; // returning false here, allows cairo to hook in and draw more }
public void Repaint(int width, int height) { //Gegl.Rectangle roi = new Gegl.Rectangle(x, y, Allocation.Width / scale, Allocation.Height/scale); processor_rect = new Gegl.Rectangle(); processor_rect.Set(x, y, (uint)(width / scale), (uint)(height / scale)); Processor.Rectangle = processor_rect; // refresh view twice a second if (timeout_id == 0) { timeout_id = GLib.Timeout.Add(200, delegate { double progress; Console.WriteLine("working: " + Allocation.Width + " " + Allocation.Height + " " + processor_rect.Width + " " + processor_rect.Height); bool more = Processor.Work(out progress); if (!more) { HandleNodeComputed(null, processor_rect); timeout_id = 0; } return(more); }); } }
private void HandleViewExposed(object sender, ExposeEventArgs args) { Console.WriteLine("exposed"); if (Node != null) { foreach (Gdk.Rectangle rect in args.Event.Region.GetRectangles()) { Gegl.Rectangle roi = new Gegl.Rectangle(); roi.Set((int) (X + rect.X/Scale), (int) (Y + rect.Y/Scale), (uint) rect.Width, (uint) rect.Height); byte [] buf = Node.Render(roi, Scale, "R'G'B' u8", Gegl.BlitFlags.Cache | Gegl.BlitFlags.Dirty); this.GdkWindow.DrawRgbImage( Style.WhiteGC, rect.X, rect.Y, rect.Width, rect.Height, Gdk.RgbDither.None, buf, rect.Width*3 ); } } args.RetVal = false; // returning false here, allows cairo to hook in and draw more }