public static void DrawString(ref OffsetImage target, string text, Font font, Brush brush, RotateMatrix rm) { SizeF size = new SizeF(); Bitmap img = new Bitmap(1, 1); Graphics g = Graphics.FromImage(img); size = g.MeasureString(text, font); DrawString(ref target, text, size, font, brush, rm); }
public static void DrawString(ref OffsetImage target, string text, SizeF stringSize, Font font, Brush brush, RotateMatrix rm) { //RotateMatrix rm = RenderHelper.Rotate(angle, stringSize.Width / 2, stringSize.Height / 2, stringSize.Width, stringSize.Height, 1, 1, 0, 0, drawOffsetX, drawOffsetY); Bitmap imgstr = new Bitmap((int)stringSize.Width, (int)stringSize.Height); Graphics gstr = Graphics.FromImage(imgstr); gstr.DrawString(text, font, brush, new PointF(0, 0)); DrawImage(ref target, imgstr, rm); }
public static void DrawImage(Graphics g, OffsetImage oi, PointF location) { float x = 0, y = 0; x = location.X + oi.Offset.X; y = location.Y + oi.Offset.Y; oi.Position = new PointF(x, y); oi.IsDrawn = true; g.SmoothingMode = SmoothingMode.AntiAlias; g.CompositingQuality = CompositingQuality.HighQuality; //Matrix m = new Matrix(); //m.RotateAt(-90, new PointF(portion.Width/2, portion.Height/2)); //g.Transform = m; g.DrawImage(oi.Source, new PointF(0, 0)); }
public static void DrawString(Graphics g, OffsetImage target, string text, Font font, Brush brush, RotateMatrix matrix, PointF location) { if (g != null) { g = Graphics.FromImage(new Bitmap(1, 1)); } SizeF sz = g.MeasureString(text, font); Bitmap iTemp = new Bitmap((int)sz.Width, (int)sz.Height); Graphics gTemp = Graphics.FromImage(iTemp); gTemp.DrawString(text, font, brush, 0, 0); gTemp.Dispose(); DrawImage(ref target, iTemp, matrix); DrawImage(g, target, location); }
public static void DrawImage(ref OffsetImage oi, OffsetImage content, RotateMatrix matrix) { //oi.Matrix = matrix; content.Matrix = matrix; content.RenderedSource = DrawImage(ref oi.Source, content.Source, matrix); }
public static void DrawImage(Graphics g, OffsetImage oi) { DrawImage(g, oi, new PointF(0, 0)); }
public static void ClearRegion(Graphics g, OffsetImage oi, Color c) { SolidBrush sbrush = new SolidBrush(c); ClearRegion(g, oi, sbrush); }
public static void ClearRegion(Graphics g, OffsetImage oi, Brush b) { g.FillRectangle(b, oi.ActualBounds); }
public static void ClearRegion(Graphics g, OffsetImage oi) { ClearRegion(g, oi, Brushes.Blue); }
public static void DrawImage(ref OffsetImage oi, Bitmap content, RotateMatrix matrix) { DrawImage(ref oi.Source, content, matrix); }
public static OffsetImage New(Bitmap img) { OffsetImage oi = new OffsetImage(); oi.Source = img; return oi; }
protected void DrawImage(OffsetImage img, double angle, double centerX, double centerY, double scaleX, double scaleY, double shearX, double shearY, double drawOffsetX, double drawOffsetY) { //Graphics g = Graphics.FromImage(BufferImage.Source); if (RenderHelper.IsRectOverRect(new RectangleF((float)drawOffsetX, (float)drawOffsetY, img.Width, img.Height), Portion)) { RotateMatrix rm = RenderHelper.Rotate(angle, centerX, centerY, img.Width, img.Height, scaleX, scaleY, shearX, shearY, drawOffsetX, drawOffsetY); lock (BufferImageLock) { img.zIndex = RenderIndex; RenderHelper.DrawImage(ref BufferImage, img, rm); } } }
protected void DrawImage(OffsetImage img, double angle, double x, double y) { DrawImage(img, angle, img.Width / 2, img.Height / 2, 1, 1, 0, 0, x, y); }