public PaintCoords(Point start, Color color, float penWidth, MyBrush brush = null) { this.start = start; this.color = color; this.penWidth = penWidth; this.brush = brush; }
} // GetPaintCoords static void LoadBrush(XmlReader reader, out MyBrush brush) { string myBrushIs = reader.Value; Color brushColor; int colorInt; switch (myBrushIs) { case "Paint.MySolidBrush": reader.MoveToNextAttribute(); colorInt = int.Parse(reader.Value); brushColor = Color.FromArgb(colorInt); brush = new MySolidBrush(brushColor); break; case "Paint.MyHatchBrush": reader.MoveToNextAttribute(); colorInt = int.Parse(reader.Value); brushColor = Color.FromArgb(colorInt); brush = new MyHatchBrush(brushColor); break; case "Paint.MyGradientBrush": reader.MoveToNextAttribute(); colorInt = int.Parse(reader.Value); brushColor = Color.FromArgb(colorInt); brush = new MyGradientBrush(brushColor); break; case "Paint.MyTextureBrush": reader.MoveToNextAttribute(); colorInt = int.Parse(reader.Value); brushColor = Color.FromArgb(colorInt); reader.MoveToNextAttribute(); string imagePath = reader.Value; brush = new MyTextureBrush(brushColor, imagePath); //brush = new MyTextureBrush(brushColor); break; default: brush = null; break; } // switch } // LoadBrush
protected static void GetPaintCoords(XmlReader reader, out Point start, out Color color, out float penWidth, out MyBrush brush) { reader.MoveToFirstAttribute(); LoadBrush(reader, out brush); reader.MoveToNextAttribute(); int startX = int.Parse(reader.Value); reader.MoveToNextAttribute(); int startY = int.Parse(reader.Value); start = new Point(startX, startY); reader.MoveToNextAttribute(); int colorInt = int.Parse(reader.Value); color = Color.FromArgb(colorInt); reader.MoveToNextAttribute(); penWidth = float.Parse(reader.Value); } // GetPaintCoords
public MyTriangle(Point point1, Point point2, Point point3, Color color, float penWidth, MyBrush brush = null) : base(point1, color, penWidth, brush) { this.point2 = point2; this.point3 = point3; }
public MyCircle(Point start, int width, int height, Color color, float penWidth, MyBrush brush = null) : base(start, width, height, color, penWidth, brush) { }
public MyPencil(Point start, Point end, Color color, float penWidth, MyBrush brush = null) : base(start, color, penWidth, brush) { this.end = end; }
public MyRectangle(Point start, int width, int height, Color color, float penWidth, MyBrush brush = null) : base(start, color, penWidth, brush) { this.width = width; this.height = height; }
public Painter() { action = PenMode; brush = new MySolidBrush(Color.Black); }
public void ChangeBrushToTexture() => brush = new MyTextureBrush(brush.color, brush.imagePath);
public void ChangeBrushToGradient() => brush = new MyGradientBrush(brush.color, brush.imagePath);
public void ChangeBrushToHatch() => brush = new MyHatchBrush(brush.color, brush.imagePath);
} // RectangleMode public void ChangeBrushToSolid() => brush = new MySolidBrush(brush.color, brush.imagePath);