Пример #1
0
        static void DrawLineHigh(SKCanvas g, SKPaint paint, float x1, float y1, float x2, float y2)
        {
            var dx   = x2 - x1;
            var dy   = y2 - y1;
            var incr = 1;

            if (dx < 0)
            {
                incr = -1;
                dx   = -dx;
            }

            var delta = (2 * dx) - dy;
            var x     = x1;

            for (var y = y1; y <= y2; y += 1)
            {
                g.DrawPixel(paint, x, y);
                if (delta > 0)
                {
                    x     += incr;
                    delta += 2 * (dx - dy);
                }
                else
                {
                    delta += 2 * dx;
                }
            }
        }