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); }
public void DrawPattern(int x, int y, int size, PictureBrushShape shape, PictureBrushPattern pattern, int patternNumber) { int penSize = size; int circlePos = 0; int pos = splatterBrushStart[patternNumber]; // Adjust X if brush would end up outside screen boundaries if (x < penSize) { x = penSize - 1; } // Adjust Y if brush would end up outside screen boundaries if (y < penSize) { y = penSize; } for (int y1 = y - penSize; y1 <= y + penSize; y1++) { for (int x1 = x - (int)Math.Ceiling(penSize / 2.0f); x1 <= (x + (int)Math.Floor(penSize / 2.0f)); x1++) { if (shape == PictureBrushShape.Rectangle) { // Rectangle this.DrawPatternPoint(x1, y1, pattern, ref pos); } else { // Circle if (((circles[penSize][circlePos >> 3] >> (0x07 - (circlePos & 0x07))) & 0x01) != 0) { this.DrawPatternPoint(x1, y1, pattern, ref pos); } circlePos++; } } } }