public void Contained()
        {
            BlockProcessor proc = new BlockProcessor(new Rectangle(0, 0, 10, 10), 1000);
            Rectangle      step;

            Assert.IsTrue(proc.Step(out step));
            Assert.AreEqual(step, new Rectangle(0, 0, 10, 10));
            Assert.IsFalse(proc.Step(out step));
        }
示例#2
0
        public void Contained()
        {
            BlockProcessor proc = new BlockProcessor (new Rectangle (0, 0, 10, 10), 1000);
            Rectangle step;

            Assert.IsTrue (proc.Step (out step));
            Assert.AreEqual (step, new Rectangle (0, 0, 10, 10));
            Assert.IsFalse (proc.Step (out step));
        }
		public void Step ()
		{
			BlockProcessor proc = new BlockProcessor (new Rectangle (10, 100, 25, 15), 20);
			Rectangle step;

			Assert.AreEqual (proc.Step (out step), true);
			Assert.AreEqual (step, new Rectangle (10, 100, 20, 15));
			Assert.AreEqual (proc.Step (out step), true);
			Assert.AreEqual (step, new Rectangle (30, 100, 5, 15));
			Assert.AreEqual (proc.Step (out step), false);
		}
        public void Step()
        {
            BlockProcessor proc = new BlockProcessor(new Rectangle(10, 100, 25, 15), 20);
            Rectangle      step;

            Assert.AreEqual(proc.Step(out step), true);
            Assert.AreEqual(step, new Rectangle(10, 100, 20, 15));
            Assert.AreEqual(proc.Step(out step), true);
            Assert.AreEqual(step, new Rectangle(30, 100, 5, 15));
            Assert.AreEqual(proc.Step(out step), false);
        }
示例#5
0
        private Pixbuf CrossFade(Pixbuf current, Pixbuf prev, Pixbuf next, double percent)
        {
            Rectangle      area = new Rectangle(0, 0, Allocation.Width, Allocation.Height);
            BlockProcessor proc = new BlockProcessor(area, 256);
            Rectangle      subarea;

            while (proc.Step(out subarea))
            {
                if (IsRealized)
                {
                    GdkWindow.ProcessUpdates(false);
                }

                prev.CopyArea(subarea.X, subarea.Y, subarea.Width, subarea.Height, current, subarea.X, subarea.Y);
                next.Composite(current, subarea.X, subarea.Y, subarea.Width, subarea.Height, 0, 0, 1, 1,
                               Gdk.InterpType.Nearest, (int)System.Math.Round(255 * percent));
            }
            return(current);
        }
示例#6
0
	public static Gdk.Rectangle TransformAndCopy (Gdk.Pixbuf src, Gdk.Pixbuf dest, PixbufOrientation orientation, Gdk.Rectangle args)
	{
		Gdk.Rectangle area = TransformOrientation (src, args, orientation);

		int step = 256;

		Gdk.Rectangle rect = new Gdk.Rectangle (args.X, args.Y, 
							Math.Min (step, args.Width),
							Math.Min (step, args.Height));

		Gdk.Rectangle trect = TransformOrientation (src, rect, orientation);
		Gdk.Pixbuf tmp = new Gdk.Pixbuf (src.Colorspace, src.HasAlpha, 
						 src.BitsPerSample,
						 trect.Width, trect.Height);

		Gdk.Rectangle subarea;
		BlockProcessor proc = new BlockProcessor (args, 256);
		while (proc.Step (out subarea)) {
			Gdk.Rectangle trans = TransformOrientation (src, subarea, orientation);
			Gdk.Pixbuf ssub = new Gdk.Pixbuf (src, subarea.X, subarea.Y,
							  subarea.Width, subarea.Height);

			Gdk.Pixbuf tsub = new Gdk.Pixbuf (tmp, 0, 0, trans.Width, trans.Height);
			CopyWithOrientation (ssub, tsub, orientation);

			tsub.CopyArea (0, 0, trans.Width, trans.Height, dest, trans.X, trans.Y);
			ssub.Dispose ();
			tsub.Dispose ();
		}

		tmp.Dispose ();
		return area;
	}
示例#7
0
        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 {
                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 ();
            }
        }
		private Pixbuf CrossFade (Pixbuf current, Pixbuf prev, Pixbuf next, double percent)
		{ 
			Rectangle area = new Rectangle (0, 0, Allocation.Width, Allocation.Height);
			BlockProcessor proc = new BlockProcessor (area, 256);
			Rectangle subarea;

			while (proc.Step (out subarea)) {
				if (IsRealized)
					GdkWindow.ProcessUpdates (false);
				
				prev.CopyArea (subarea.X, subarea.Y, subarea.Width, subarea.Height, current, subarea.X, subarea.Y);
				next.Composite (current, subarea.X, subarea.Y, subarea.Width, subarea.Height, 0, 0, 1, 1,
						Gdk.InterpType.Nearest, (int) System.Math.Round (255 * percent));
			}
			return current;
		}