public void EndDraw(PaintEventArgs e)
		{
			if (bitmapGraphics != null)
			{
				bitmapGraphics.Dispose();
				bitmapGraphics = null;

				e.Graphics.DrawImage(OffscreenBitmap, new RectangleF(e.ClipRectangle.Size), e.ClipRectangle);
			}
		}
Example #2
0
		internal void DrawFrame(Graphics g)
		{
			float y = 0;
			foreach (var info in GetDrawInfo())
			{
				var size = g.MeasureString(info.Font, info.Text);
				g.DrawText(info.Font, Colors.White, 10, y, info.Text);
				y += size.Height;
			}
		}
Example #3
0
		protected override void Initialize()
		{
			base.Initialize();
			Control.SetStyle(swf.ControlStyles.SupportsTransparentBackColor | swf.ControlStyles.DoubleBuffer, false);
			Control.SetStyle(swf.ControlStyles.AllPaintingInWmPaint | swf.ControlStyles.Opaque, true);
			Control.HandleCreated += (sender, e) =>
			{
				graphics = new Graphics(Generator, new GraphicsHandler(this));
				graphicsHandler = (GraphicsHandler)graphics.Handler;
			};
		}
Example #4
0
		Control CreateCustom32Alpha ()
		{
			var image = new Bitmap (100, 100, PixelFormat.Format32bppRgba);

			// should always ensure .Dispose() is called when you are done with a Graphics object
			using (var graphics = new Graphics (image)) {
				graphics.DrawLine (Color.Blue, Point.Empty, new Point (image.Size));
				graphics.DrawRectangle (Color.Black, new Rectangle (image.Size));
			}

			return new ImageView { Image = image };
		}
Example #5
0
		public static void Draw(Graphics graphics)
		{
			var generator = graphics.Generator;
			var image = TestIcons.TestImage(generator);
			// lines
			var whitePen = Pens.White(generator);
			graphics.DrawLine(whitePen, 1, 1, 99, 99);
			graphics.DrawLine(whitePen, 50, 1, 50, 99);
			graphics.DrawLine(whitePen, 1, 51, 99, 51);

			graphics.DrawRectangle(Pens.White(generator), 101, 1, 100, 100);
			graphics.DrawRectangle(Pens.White(generator), 101, 1, 10, 10);

			graphics.DrawEllipse(Pens.Green(generator), 101, 1, 100, 100);

			graphics.DrawPolygon(Pens.White(generator), new PointF(203, 1), new PointF(253, 51), new Point(203, 101), new PointF(203, 1), new PointF(253, 1), new PointF(253, 101), new PointF(203, 101));

			var rect = new RectangleF(255, 1, 100, 100);
			graphics.DrawArc(Pens.LightGreen(generator), rect, 180, 90);
			graphics.DrawArc(Pens.SkyBlue(generator), rect, 0, 90);
			rect.Inflate(-15, 0);
			graphics.DrawArc(Pens.FloralWhite(generator), rect, -45, 90);
			rect.Inflate(-5, -20);
			graphics.DrawArc(Pens.SlateGray(generator), rect, -45, 270);
			rect.Inflate(-10, -10);
			graphics.DrawArc(Pens.SteelBlue(generator), rect, 180 + 45, 270);

			graphics.DrawImage(image, 100, 1, 100, 100);

			graphics.DrawText(Fonts.Sans(12 * graphics.PointsPerPixel, generator: generator), Colors.White, 0, 104, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");

			// filled
			graphics.FillRectangle(Brushes.White(generator), 101, 120, 100, 100);
			graphics.FillRectangle(Brushes.Gray(generator), 101, 120, 10, 10);

			graphics.FillEllipse(Brushes.Green(generator), 101, 120, 100, 100);

			graphics.FillPolygon(Brushes.White(generator), new PointF(202, 120), new PointF(252, 170), new Point(202, 220), new PointF(202, 120));

			rect = new RectangleF(255, 120, 100, 100);
			graphics.FillPie(Brushes.LightGreen(generator), rect, 180, 90);
			graphics.FillPie(Brushes.SkyBlue(generator), rect, 0, 90);
			rect.Inflate(-15, 0);
			graphics.FillPie(Brushes.FloralWhite(generator), rect, -45, 90);
			rect.Inflate(-5, -20);
			graphics.FillPie(Brushes.SlateGray(generator), rect, -45, 270);
			rect.Inflate(-10, -10);
			graphics.FillPie(Brushes.SteelBlue(generator), rect, 180 + 45, 270);


			graphics.DrawImage(image, 101, 120, 100, 100);
		}
Example #6
0
		void DrawSample(Graphics graphics)
		{
			graphics.FillRectangle(Brushes.Green(), 0, 0, 200, 200);
			if (UseGraphicsPathClip)
			{
				var path = GraphicsPath.GetRoundRect(new RectangleF(10, 10, 180, 180), 20);
				graphics.SetClip(path);
			}
			else
				graphics.SetClip(new RectangleF(10, 10, 180, 180));

			if (UseClearColor)
				graphics.Clear(new SolidBrush(new Color(Colors.Red, 0.5f)));
			else
				graphics.Clear();
			graphics.FillEllipse(Brushes.Blue(), 25, 25, 150, 150);
		}
        private static void drawPaths(Graphics g, List<Path> paths, Func<PointF, PointF> pointTransform, float zoomFactor = 1.0f)
        {
            g.AntiAlias = false;

            for (int i = 0; i < paths.Count; i++)
            {
                var path = paths[i];
                for (int pointIdx = 0; pointIdx < (path.Points.Count - 1); pointIdx++)
                {
                    var p1 = pointTransform(path.Points[pointIdx]);
                    var p2 = pointTransform(path.Points[pointIdx + 1]);

                    var pen = path.GetScaledPen(zoomFactor);
                    g.DrawLine(pen, p1, p2);
                }
            }
        }
		protected sealed override void OnPaint(PaintEventArgs e)
		{
			if (EnableDoubleBuffering)
			{
				var screen = ParentWindow.Screen;
				var scale = screen.RealScale / screen.Scale;
				renderSize = Size.Round(e.ClipRectangle.Size * scale);
				if (bitmap == null ||
					bitmap.Size.Width < renderSize.Width ||
					bitmap.Size.Height < renderSize.Height)
				{
					if (bitmap != null)
						bitmap.Dispose();

					bitmap = new Bitmap(renderSize, PixelFormat.Format32bppRgba);
				}
				var bitmapGraphics = new Graphics(bitmap);
				bitmapGraphics.Clear(Brushes.Cached(BackgroundColor));
				bitmapGraphics.ScaleTransform(scale);
				bitmapGraphics.TranslateTransform(-e.ClipRectangle.Location);
				bitmapGraphics.SetClip(e.ClipRectangle * scale); // should be affected by transform

				var childArgs = new PaintEventArgs(bitmapGraphics, e.ClipRectangle);
				base.OnPaint(childArgs);

				OnBufferedPaint(childArgs);

				bitmapGraphics.Dispose();
				bitmapGraphics = null;
				e.Graphics.DrawImage(bitmap, new RectangleF(renderSize), e.ClipRectangle);
				if (Platform.IsWpf)
				{
					// wpf runs out of resources fast here, so we garbage collect
					GC.Collect();
				}
			}
			else
			{
				base.OnPaint(e);
				OnBufferedPaint(e);
			}
		}
		public Graphics BeginDraw(PaintEventArgs e)
		{
			if (UseOffScreenBitmap)
			{
				if (OffscreenBitmap == null ||
					OffscreenBitmap.Size.Width < e.ClipRectangle.Width ||
					OffscreenBitmap.Size.Height < e.ClipRectangle.Height)
				{
					if (OffscreenBitmap != null)
						OffscreenBitmap.Dispose();

					OffscreenBitmap = new Bitmap(Size.Round(e.ClipRectangle.Size), PixelFormat.Format32bppRgba);
				}
				bitmapGraphics = new Graphics(OffscreenBitmap);
				bitmapGraphics.TranslateTransform(-e.ClipRectangle.Location);
				bitmapGraphics.SetClip(e.ClipRectangle);
				bitmapGraphics.Clear(Brushes.Cached(drawable.BackgroundColor));
				return bitmapGraphics;
			}
			return e.Graphics;
		}
Example #10
0
		void DrawSample(Graphics graphics)
		{
			using (graphics.Platform.Context)
			{
				graphics.FillRectangle(Brushes.Green, 0, 0, 200, 200);
				switch (clipMode)
				{
					case ClearClipMode.GraphicsPath:
						var path = GraphicsPath.GetRoundRect(new RectangleF(10, 10, 180, 180), 20);
						graphics.SetClip(path);
						break;
					case ClearClipMode.Rectangle:
						graphics.SetClip(new RectangleF(10, 10, 180, 180));
						break;
				}

				if (UseClearColor)
					graphics.Clear(new SolidBrush(new Color(Colors.Red, 0.5f)));
				else
					graphics.Clear();
				graphics.FillEllipse(Brushes.Blue, 25, 25, 150, 150);
			}
		}
Example #11
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="gfx"></param>
 /// <param name="pen"></param>
 /// <param name="isStroked"></param>
 /// <param name="p0"></param>
 /// <param name="p1"></param>
 private static void DrawLineInternal(
     Graphics gfx,
     Pen pen,
     bool isStroked,
     ref PointF p0,
     ref PointF p1)
 {
     if (isStroked)
     {
         gfx.DrawLine(pen, p0, p1);
     }
 }
Example #12
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="gfx"></param>
        /// <param name="brush"></param>
        /// <param name="pen"></param>
        /// <param name="isStroked"></param>
        /// <param name="isFilled"></param>
        /// <param name="rect"></param>
        private static void DrawRectangleInternal(
            Graphics gfx,
            Brush brush,
            Pen pen,
            bool isStroked,
            bool isFilled,
            ref Rect2 rect)
        {
            if (isFilled)
            {
                gfx.FillRectangle(
                    brush,
                    (float)rect.X,
                    (float)rect.Y,
                    (float)rect.Width,
                    (float)rect.Height);
            }

            if (isStroked)
            {
                gfx.DrawRectangle(
                    pen,
                    (float)rect.X,
                    (float)rect.Y,
                    (float)rect.Width,
                    (float)rect.Height);
            }
        }
Example #13
0
		void Draw(Graphics g, Action<Pen> action)
		{
			var path = new GraphicsPath();
			path.AddLines(new PointF(0, 0), new PointF(100, 40), new PointF(0, 30), new PointF(50, 70));

			for (int i = 0; i < 4; i++)
			{
				float thickness = 1f + i * PenThickness;
				var pen = new Pen(Colors.Black, thickness);
				pen.LineCap = this.LineCap;
				pen.LineJoin = this.LineJoin;
				pen.DashStyle = this.DashStyle;
				if (action != null)
					action(pen);
				var y = i * 20;
				g.DrawLine(pen, 10, y, 110, y);
				
				y = 80 + i * 50;
				g.DrawRectangle(pen, 10, y, 100, 30);

				y = i * 70;
				g.DrawArc(pen, 140, y, 100, 80, 160, 160);
				
				y = i * 70;
				g.DrawEllipse(pen, 260, y, 100, 50);
				
				g.SaveTransform();
				y = i * 70;
				g.TranslateTransform(400, y);
				g.DrawPath(pen, path);
				g.RestoreTransform();
			}
		}
Example #14
0
		public void Create(int width, int height, Graphics graphics)
		{
			throw new NotImplementedException();
		}
Example #15
0
		void DirectTests(Graphics g)
		{
			// test translate/rotate
			DrawRotatedLines(g, Colors.SkyBlue, rotatedLineCenter, (center, angle) => {
				g.TranslateTransform(center);
				g.RotateTransform(angle);
				g.TranslateTransform(-center);
			});

			// test translate/rotate/scale
			DrawRotatedLines(g, Colors.Salmon, rotatedLineCenter, (center, angle) => {
				g.TranslateTransform(center);
				g.RotateTransform(angle);
				g.TranslateTransform(-center);
				g.ScaleTransform(.4f);
			});

			// test rotating arcs
			DrawRotatedArcs(g, Colors.LightBlue, rotatedLineCenter, (center, angle) => {
				g.TranslateTransform(center);
				g.RotateTransform(angle);
				g.TranslateTransform(-center);
			});

			// test transformed text
			DrawRotatedText(g, Colors.Lime, rotatedTextCenter, (center, angle) => {
				g.TranslateTransform(center - 40);
				g.RotateTransform(angle);
				g.TranslateTransform(-center + 40);
			});

			// Test image drawing
			g.SaveTransform();
			g.TranslateTransform(imageScaleLocation + image.Size / 2);
			g.ScaleTransform(1, -1);
			g.TranslateTransform(-imageScaleLocation - image.Size / 2);
			g.DrawImage(image, imageScaleLocation);

			g.TranslateTransform(0, -50);
			g.TranslateTransform(imageScaleLocation + image.Size / 2);
			g.ScaleTransform(0.3f);
			g.TranslateTransform(-imageScaleLocation - image.Size / 2);
			g.DrawImage(image, imageScaleLocation);
			g.RestoreTransform();

			// test skewing
			g.SaveTransform();
			g.MultiplyTransform(Matrix.FromSkew(20, 20));
			var textSize = g.MeasureString(font, "Skewed Text");
			g.DrawText(font, Colors.White, new PointF(110, 0), "Skewed Text");
			g.DrawLine(Pens.White, 110, textSize.Height + 2, 110 + textSize.Width, textSize.Height + 2);
			
			g.RestoreTransform();

			// test more drawing operations
			g.SaveTransform();
			g.TranslateTransform(480, 20);
			g.ScaleTransform(0.4f);
			g.RotateTransform(90);
			PixelOffsetSection.Draw(g);
			g.RestoreTransform();
		}
Example #16
0
		Control DrawImageToRect()
		{
			var image64 = new Bitmap(new Size(64, 64), PixelFormat.Format32bppRgba);
			var image32 = new Bitmap(new Size(32, 32), PixelFormat.Format32bppRgba);

			using (var g = new Graphics(image64))
				g.Clear(Brushes.Cached(Colors.Green) as SolidBrush);

			using (var g = new Graphics(image32))
				g.Clear(Brushes.Cached(Colors.Blue) as SolidBrush);

			var bitmap = new Bitmap(new Size(105, 105), PixelFormat.Format32bppRgba);
			using (var g = new Graphics(bitmap))
			{
				// draw the big image at the origin, but with a smaller dest rect
				g.DrawImage(image64, new RectangleF(0, 0, 32, 32), new RectangleF(0, 0, 32, 32));
				// draw two guide images to indicate how big the green image should be
				g.DrawImage(image32, new PointF(70, 0));
				g.DrawImage(image32, new PointF(0, 70));
			}
			return new DrawableImageView { Image = bitmap };
		}
Example #17
0
		void DrawShapes(Brush brush, PointF location, Size size, Graphics g)
		{
			g.SaveTransform();
			g.TranslateTransform(location);
			g.RotateTransform(20);

			// rectangle
			g.FillRectangle(brush, new RectangleF(size));

			// ellipse
			g.TranslateTransform(0, size.Height + 20);
			g.FillEllipse(brush, new RectangleF(size));

			// pie
			g.TranslateTransform(0, size.Height + 20);
			g.FillPie(brush, new RectangleF(new SizeF(size.Width * 2, size.Height)), 0, 360);

			// polygon
			g.TranslateTransform(0, size.Height + 20);
			var polygon = GetPolygon();
			g.FillPolygon(brush, polygon);

			g.RestoreTransform();
		}
Example #18
0
		Image CreateImage()
		{
			var image = new Bitmap(200, 200, PixelFormat.Format32bppRgba);
			using (var graphics = new Graphics(image))
			{
				DrawSample(graphics);
			}
			return image;
		}
Example #19
0
		Control DrawImageToRect()
		{
			var image64 = TestIcons.Textures;

			var bitmap = new Bitmap(new Size(105, 105), PixelFormat.Format32bppRgba);
			using (var g = new Graphics(bitmap))
			{
				// Draw the "5" portion of the texture at a smaller size at the origin.
				g.DrawImage(image64, new RectangleF(80, 80, 80, 80), new RectangleF(0, 0, 32, 32));
				// draw two rulers to indicate how big the green image should be
				g.SaveTransform();
				g.MultiplyTransform(Matrix.Create(1, 0, 0, 1, 0, 70));
				DrawRuler(32, g, Colors.Blue);
				g.RestoreTransform();

				g.SaveTransform();
				g.MultiplyTransform(Matrix.Create(0, 1, 1, 0, 70, 0));
				DrawRuler(32, g, Colors.Blue);
				g.RestoreTransform();
			}
			return new DrawableImageView { Image = bitmap };
		}
Example #20
0
		Control CloneRectangle()
		{
			var image = TestIcons.TestImage;
			var bitmap = new Bitmap(image.Size, PixelFormat.Format32bppRgba);
			using (var g = new Graphics(bitmap))
			{
				foreach (var tile in GetTiles(image))
				{
					using (var clone = image.Clone(tile))
						g.DrawImage(clone, tile.X, tile.Y);
				}
			}
			return new DrawableImageView { Image = bitmap };
		}
Example #21
0
 public void CoptyToEto(ed.Graphics graphics)
 {
     using (var eto = LockEtoBitmap())
         graphics.DrawImage(eto, 0, 0);
 }
Example #22
0
		void DrawRotatedText(Graphics g, Color color, PointF center, Action<PointF, float> action)
		{
			for (float i = 0; i <= 90f; i += 10)
			{
				g.SaveTransform();
				action(center, i);
				g.DrawText(font, color, center, "Some Rotated Text");
				g.RestoreTransform();
			}
		}
Example #23
0
		void DrawRotatedLines(Graphics g, Color color, PointF center, Action<PointF, float> action)
		{
			var pen = new Pen(color);
			for (float i = 0; i < 360f; i += 10)
			{
				g.SaveTransform();
				action(center, i);
				g.DrawLine(pen, center, center + new Size(40, 0));
				g.RestoreTransform();
			}
		}
Example #24
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="gfx"></param>
 /// <param name="container"></param>
 private void DrawBackgroundInternal(Graphics gfx, Container container)
 {
     Brush brush = ToSolidBrush(container.Background);
     var rect = Rect2.Create(0, 0, container.Width, container.Height);
     gfx.FillRectangle(
         brush,
         _scaleToPage(rect.X),
         _scaleToPage(rect.Y),
         _scaleToPage(rect.Width),
         _scaleToPage(rect.Height));
     brush.Dispose();
 }
Example #25
0
		/// <summary>
		/// Initializes a new instance of the <see cref="Eto.Forms.PaintEventArgs"/> class.
		/// </summary>
		/// <param name="graphics">Graphics for the paint event</param>
		/// <param name="clipRectangle">Rectangle of the region being painted</param>
		public PaintEventArgs(Graphics graphics, RectangleF clipRectangle)
		{
			ClipRectangle = clipRectangle;
			Graphics = graphics;
		}
Example #26
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="gfx"></param>
        /// <param name="stroke"></param>
        /// <param name="rect"></param>
        /// <param name="offsetX"></param>
        /// <param name="offsetY"></param>
        /// <param name="cellWidth"></param>
        /// <param name="cellHeight"></param>
        /// <param name="isStroked"></param>
        private void DrawGridInternal(
            Graphics gfx,
            Pen stroke,
            ref Rect2 rect,
            double offsetX, double offsetY,
            double cellWidth, double cellHeight,
            bool isStroked)
        {
            double ox = rect.X;
            double oy = rect.Y;
            double sx = ox + offsetX;
            double sy = oy + offsetY;
            double ex = ox + rect.Width;
            double ey = oy + rect.Height;

            for (double x = sx; x < ex; x += cellWidth)
            {
                var p0 = new PointF(
                    _scaleToPage(x),
                    _scaleToPage(oy));
                var p1 = new PointF(
                    _scaleToPage(x),
                    _scaleToPage(ey));
                DrawLineInternal(gfx, stroke, isStroked, ref p0, ref p1);
            }

            for (double y = sy; y < ey; y += cellHeight)
            {
                var p0 = new PointF(
                    _scaleToPage(ox),
                    _scaleToPage(y));
                var p1 = new PointF(
                    _scaleToPage(ex),
                    _scaleToPage(y));
                DrawLineInternal(gfx, stroke, isStroked, ref p0, ref p1);
            }
        }
Example #27
0
		Control CloneTiles()
		{
			// Creates a duplicate of the bitmap by cloning tiles of it
			// and drawing them in the same location in the duplicate.
			var image = TestIcons.TestImage();
			var bitmap = new Bitmap(new Size(image.Size), PixelFormat.Format32bppRgba);
			var tile = 64; // the test image is 128x128 so this produces 4 tiles.
			using (var g = new Graphics(bitmap))
			{
				for (var x = 0; x < image.Width; x += tile)
					for (var y = 0; y < image.Height; y += tile)
					{
						var clone = image.Clone(new Rectangle(x, y, tile, tile));
						g.DrawImage(clone, x, y);
					}
			}
			return new DrawableImageView { Image = bitmap };
		}
Example #28
0
		void DrawRotatedArcs(Graphics g, Color color, PointF center, Action<PointF, float> action)
		{
			for (float i = 0; i <= 360f; i += 90f)
			{
				g.SaveTransform();
				action(center, i);
				g.DrawArc(new Pen(color), RectangleF.FromCenter(center, new SizeF(50, 50)), 0, 45f);
				g.RestoreTransform();
			}
		}
Example #29
0
		/// <summary>
		/// Draws a unit-length horizontal ruler from (0, 0) to (1, 0) into the graphics context.
		/// Scale and rotate as needed before calling.
		/// </summary>
		/// <param name="g"></param>
		static void DrawRuler(float length, Graphics g, Color color)
		{
			g.DrawLine(color, 0, 0, length, 0);
			var capHeight = 2;
			g.DrawLine(color, 0, -capHeight, 0, capHeight);
			g.DrawLine(color, length, -capHeight, length, capHeight);
		}
Example #30
0
		void Draw(Graphics g)
		{
			if (brush == null)
				return;
			var rect = new RectangleF(0, 0, 200, 100);
			/**/
			//g.FillRectangle(brush, rect);
			g.FillEllipse(brush, rect);
			g.DrawEllipse(Colors.Black, rect);
			/**/
			rect = new RectangleF(0, 110, 200, 80);
			g.FillRectangle(brush, rect);
			g.DrawRectangle(Colors.Black, rect);
			/**/
			rect = new RectangleF(0, 200, 200, 80);
			g.FillPie(brush, rect, 100, 240);
			g.DrawArc(Colors.Black, rect, 100, 240);
			/**/
			var points = new[] { new PointF(300, 0), new PointF(350, 20), new PointF(400, 80), new PointF(320, 90) };
			g.FillPolygon(brush, points);
			g.DrawPolygon(Colors.Black, points);
			/**/
		}
Example #31
0
		void MatrixTests(Graphics g)
		{
			// test matrix RotateAt
			DrawRotatedLines(g, Colors.SkyBlue, rotatedLineCenter, (center, angle) => {
				var m = Matrix.Create();
				m.RotateAt(angle, center);
				g.MultiplyTransform(m);
			});

			// test matrix scale/translate/rotate
			DrawRotatedLines(g, Colors.Salmon, rotatedLineCenter, (center, angle) => {
				var m = Matrix.Create();
				m.Translate(center);
				m.Rotate(angle);
				m.Translate(-center);
				m.Scale(.4f);
				g.MultiplyTransform(m);
			});

			// test rotating arcs
			DrawRotatedArcs(g, Colors.LightBlue, rotatedLineCenter, (center, angle) => {
				var m = Matrix.Create();
				m.RotateAt(angle, center);
				g.MultiplyTransform(m);
			});

			// test transformed text
			DrawRotatedText(g, Colors.Lime, rotatedTextCenter, (center, angle) => {
				var m = Matrix.Create();
				m.RotateAt(angle, center - 40);
				g.MultiplyTransform(m);
			});

			// test image drawing
			{
				g.SaveTransform();
				g.MultiplyTransform(Matrix.FromScaleAt(new SizeF(1, -1), imageScaleLocation + image.Size / 2));
				g.DrawImage(image, imageScaleLocation);

				var m = Matrix.Create();
				m.Translate(0, -50);
				m.ScaleAt(0.3f, imageScaleLocation + image.Size / 2);
				g.MultiplyTransform(m);
				g.DrawImage(image, imageScaleLocation);
				g.RestoreTransform();
			}

			// test skewing
			{
				g.SaveTransform();
				var m = Matrix.Create();
				m.Skew(20, 20);
				g.MultiplyTransform(m);
				var textSize = g.MeasureString(font, "Skewed Text");
				g.DrawText(font, Colors.White, new PointF(110, 0), "Skewed Text");
				g.DrawLine(Pens.White, 110, textSize.Height + 2, 110 + textSize.Width, textSize.Height + 2);

				g.RestoreTransform();
			}

			// test more drawing operations
			{
				g.SaveTransform();
				var m = Matrix.Create();
				m.Translate(480, 20);
				m.Scale(0.4f);
				m.Rotate(90);
				g.MultiplyTransform(m);
				PixelOffsetSection.Draw(g);
				g.RestoreTransform();
			}
		}