Ejemplo n.º 1
0
        public static void StraightLine(WriteableBitmap b, int x, int y, int width, Color color)
        {
            byte[] oldBytes = null;

            bmp = b;

            if (!isSelecting)
            {
                startPoint = new P(x, y);
            }

            currentPoint = new P(x, y);


            if (isSelecting)
            {
                oldBytes = History.Undo().bmp;
                bmp.PixelBuffer.AsStream().Write(oldBytes, 0, oldBytes.Length);
            }

            isSelecting = true;

            bmp.DrawLineCustom(startPoint.x, startPoint.y, currentPoint.x, currentPoint.y, color, width);

            oldBytes = bmp.PixelBuffer.ToArray();
            bmp.PixelBuffer.ToArray().CopyTo(oldBytes, 0);



            History.EndAction(new Action(oldBytes));
        }