Ejemplo n.º 1
0
 public PaintCoords(Point start, Color color, float penWidth, MyBrush brush = null)
 {
     this.start    = start;
     this.color    = color;
     this.penWidth = penWidth;
     this.brush    = brush;
 }
Ejemplo n.º 2
0
        } // 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
Ejemplo n.º 3
0
        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
Ejemplo n.º 4
0
 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;
 }
Ejemplo n.º 5
0
 public MyCircle(Point start, int width, int height, Color color, float penWidth, MyBrush brush = null) : base(start, width, height, color, penWidth, brush)
 {
 }
Ejemplo n.º 6
0
 public MyPencil(Point start, Point end, Color color, float penWidth, MyBrush brush = null) : base(start, color, penWidth, brush)
 {
     this.end = end;
 }
Ejemplo n.º 7
0
 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;
 }
Ejemplo n.º 8
0
 public Painter()
 {
     action = PenMode;
     brush  = new MySolidBrush(Color.Black);
 }
Ejemplo n.º 9
0
 public void ChangeBrushToTexture() => brush  = new MyTextureBrush(brush.color, brush.imagePath);
Ejemplo n.º 10
0
 public void ChangeBrushToGradient() => brush = new MyGradientBrush(brush.color, brush.imagePath);
Ejemplo n.º 11
0
 public void ChangeBrushToHatch() => brush    = new MyHatchBrush(brush.color, brush.imagePath);
Ejemplo n.º 12
0
        } // RectangleMode

        public void ChangeBrushToSolid() => brush    = new MySolidBrush(brush.color, brush.imagePath);