Пример #1
0
 public override void DrawRectangle(CommonGui.Drawing.Pen pen, RectangleF rect)
 {
     using (System.Drawing.Pen pen2 = CreatePen(pen))
     {
         InternalGraphics.DrawRectangle(pen2, rect.Left, rect.Top, rect.Width, rect.Height);
     }
 }
Пример #2
0
 public override void DrawLine(CommonGui.Drawing.Pen pen, Chaos.Util.Mathematics.Vector2f p1, Chaos.Util.Mathematics.Vector2f p2)
 {
     using (System.Drawing.Pen pen2 = CreatePen(pen))
     {
         InternalGraphics.DrawLine(pen2, p1.Convert(), p2.Convert());
     }
 }
Пример #3
0
 public override void DrawCircle(CommonGui.Drawing.Pen pen, Vector2f center, float radius)
 {
     using (System.Drawing.Pen pen2 = CreatePen(pen))
     {
         InternalGraphics.DrawEllipse(pen2, center.X - radius, center.Y - radius, radius * 2, radius * 2);
     }
 }
Пример #4
0
 public override void DrawPolygon(CommonGui.Drawing.Pen pen, params Vector2f[] points)
 {
     System.Drawing.PointF[] points2 = points.Select(p => new System.Drawing.PointF(p.X, p.Y)).ToArray();
     using (System.Drawing.Pen pen2 = CreatePen(pen))
     {
         InternalGraphics.DrawPolygon(pen2, points2);
     }
 }
Пример #5
0
 public override void DrawString(string text, CommonGui.Drawing.Font font, Chaos.Image.RawColor color, Vector2f position)
 {
     using (System.Drawing.Font font2 = CreateFont(font))
     {
         using (System.Drawing.Brush brush = CreateBrush(color))
         {
             InternalGraphics.DrawString(text, font2, brush, new System.Drawing.PointF(position.X, position.Y));
         }
     }
 }
Пример #6
0
 public override void DrawImage(CommonGui.Drawing.Bitmap bmp, Vector2i position)
 {
     InternalGraphics.DrawImage(((Bitmap)bmp).InternalBitmap, position.Convert());
 }
Пример #7
0
 private static System.Drawing.Pen CreatePen(CommonGui.Drawing.Pen pen)
 {
     return new System.Drawing.Pen(pen.Color.Convert(), pen.LineWidth);
 }
Пример #8
0
 private static System.Drawing.Font CreateFont(CommonGui.Drawing.Font font)
 {
     System.Drawing.FontStyle style = (System.Drawing.FontStyle)(int)font.Style;
     return new System.Drawing.Font(font.Name, font.PixelSize, style, System.Drawing.GraphicsUnit.Pixel);
 }
Пример #9
0
 public override Vector2f MeasureString(string text, CommonGui.Drawing.Font font)
 {
     using (System.Drawing.Font font2 = CreateFont(font))
     {
         System.Drawing.SizeF size = InternalGraphics.MeasureString(text, font2);
         return new Vector2f(size.Width, size.Height);
     }
 }