예제 #1
0
 public PixelCollection Draw(PixelCollection pixels, IList <Point> drawingPoints,
                             DrawingItemProperties properties)
 {
     for (int i = 0; i < drawingPoints.Count - 1; i++)
     {
         pixels = _lineTool.BresenhamLine(pixels, drawingPoints[i], drawingPoints[i + 1], properties.Color);
     }
     return(pixels);
 }
예제 #2
0
        public PixelCollection Draw(PixelCollection pixels, IList <Point> drawingPoints,
                                    DrawingItemProperties properties)
        {
            Point  center       = PointCalculator.GetCenter(drawingPoints.First(), drawingPoints.Last());
            Point  topCenter    = new Point(center.X, drawingPoints.First().Y);
            Point  bottomCenter = new Point(center.X, drawingPoints.Last().Y);
            double radius       = PointCalculator.GetLenght(topCenter, bottomCenter) / 2;

            return(BresenhamCircle(pixels, center, radius, properties.Color));
        }
예제 #3
0
        public BitmapSource Draw(BitmapSource currentBitmap, ToolType toolType,
                                 IList <Point> drawingPoints, DrawingItemProperties properties)
        {
            IPainterTool painterTool = _toolFactory.Create(toolType);

            if (_pixelCollection == null)
            {
                _pixelCollection = BitmapConverter.ToPixelCollection(currentBitmap);
            }
            var newPixels = painterTool.Draw(_pixelCollection, drawingPoints, properties);

            // TODO Add to undo operations here
            _pixelCollection = newPixels;
            return(BitmapConverter.ToBitmap(newPixels));
        }
예제 #4
0
파일: LineTool.cs 프로젝트: mchilicki/paint
 public PixelCollection Draw(PixelCollection pixels, IList <Point> drawingPoints,
                             DrawingItemProperties properties)
 {
     return(BresenhamLine(pixels, drawingPoints.First(), drawingPoints.Last(), properties.Color));
 }
예제 #5
0
        public PixelCollection Draw(PixelCollection pixels, IList <Point> drawingPoints, DrawingItemProperties properties)
        {
            var fillPixel = pixels.GetPixel(drawingPoints.First());

            FloodFill(pixels, fillPixel, fillPixel.Color, properties.Color);
            return(pixels);
        }
예제 #6
0
 public PixelCollection Draw(PixelCollection pixels, IList <Point> drawingPoints,
                             DrawingItemProperties properties)
 {
     return(_pencilTool.Draw(pixels, drawingPoints, new DrawingItemProperties(Colors.White)));
 }