Пример #1
0
        public void DrawBrush(PicturePoint point, byte size, PictureBrushShape shape, PictureBrushPattern pattern, int patternNumber)
        {
            this.buffer.PriorityEnabled = this.PriorityEnabled;
            this.buffer.PriorityColor   = this.PriorityColor;
            this.buffer.VisualEnabled   = this.VisualEnabled;
            this.buffer.VisualColor     = this.VisualColor;

            this.buffer.DrawPattern(point.X, point.Y, size, shape, pattern, patternNumber);
        }
Пример #2
0
        public void DrawFill(PicturePoint point)
        {
            this.buffer.PriorityEnabled = this.PriorityEnabled;
            this.buffer.PriorityColor   = this.PriorityColor;
            this.buffer.VisualEnabled   = this.VisualEnabled;
            this.buffer.VisualColor     = this.VisualColor;

            this.buffer.DrawFill(point.X, point.Y);
        }
Пример #3
0
        public void DrawFillAlternate(int x1, int y1)
        {
            var queue = new Queue <PicturePoint>();

            queue.Enqueue(new PicturePoint(x1, y1));

            while (true)
            {
                if (queue.Count == 0)
                {
                    break;
                }

                PicturePoint pt = queue.Dequeue();

                if (this.ShouldFill(pt.X, pt.Y))
                {
                    // Find leftmost pixel to fill
                    while (this.ShouldFill(pt.X - 1, pt.Y))
                    {
                        pt.X--;
                    }

                    bool up   = true;
                    bool down = true;

                    while (this.ShouldFill(pt.X, pt.Y))
                    {
                        this.DrawPixel(pt.X, pt.Y);

                        if (this.ShouldFill(pt.X, pt.Y - 1))
                        {
                            if (up)
                            {
                                queue.Enqueue(new PicturePoint(pt.X, pt.Y - 1));
                                up = false;
                            }
                        }
                        else
                        {
                            up = true;
                        }

                        if (this.ShouldFill(pt.X, pt.Y + 1))
                        {
                            if (down)
                            {
                                queue.Enqueue(new PicturePoint(pt.X, pt.Y + 1));
                                down = false;
                            }
                        }
                        else
                        {
                            down = true;
                        }

                        pt.X++;
                    }
                }
            }
        }