private void OnExpose(Context ctx, Region region)
        {
            SetClip(ctx, region);
            if (Transition != null)
            {
                bool done = false;
                foreach (Gdk.Rectangle area in GetRectangles(region))
                {
                    BlockProcessor proc = new BlockProcessor(area, block_size);
                    Gdk.Rectangle  subarea;
                    while (proc.Step(out subarea))
                    {
                        ctx.Save();
                        SetClip(ctx, subarea);
                        done = !Transition.OnExpose(ctx, Allocation);
                        ctx.Restore();
                    }
                }
                if (done)
                {
                    System.Console.WriteLine("frames = {0}", Transition.Frames);
                    Transition = null;
                }
            }
            else if (effect != null)
            {
                foreach (Gdk.Rectangle area in GetRectangles(region))
                {
                    BlockProcessor proc = new BlockProcessor(area, block_size);
                    Gdk.Rectangle  subarea;
                    while (proc.Step(out subarea))
                    {
                        ctx.Save();
                        SetClip(ctx, subarea);
                        effect.OnExpose(ctx, Allocation);
                        ctx.Restore();
                    }
                }
            }
            else
            {
                ctx.Operator = Operator.Source;
                SurfacePattern p = new SurfacePattern(current.Surface);
                p.Filter = Filter.Fast;
                SetClip(ctx, region);
                ctx.Matrix = current.Fill(Allocation);

                ctx.Source = p;
                ctx.Paint();
                p.Destroy();
            }
        }
        public virtual void ExposeEvent(object sender, ExposeEventArgs args)
        {
            Context ctx = Widgets.CairoUtils.CreateContext(view.GdkWindow);

            Gdk.Color c = view.Style.Background(view.State);
            ctx.Source = new SolidPattern(c.Red / (float)ushort.MaxValue,
                                          c.Blue / (float)ushort.MaxValue,
                                          c.Green / (float)ushort.MaxValue);

            ctx.Paint();

            effect.OnExpose(ctx, view.Allocation);

            args.RetVal = true;
        }