private void drawLine(int x1, int y1, int x2, int y2, int c)
    {
        if (x2 - x1 == 0)
        {
            for (int y = Math.min(y1, y2); y <= Math.max(y1, y2); y++)
            {
                drawPoint(x1, y, c);
            }
        }
        else
        {
            float m = (float) (y2 - y1) / (float) (x2 - x1);
            if (Math.abs(m) <= 1)
            {
                float y = y1;
                if (x1 < x2)
                {
                    for (int x = x1; x <= x2; x++)
                    {
                        drawPoint(x, Math.round(y), c);
                        y += m;
                    }
                }
                else
                {
                    for (int x = x1; x >= x2; x--)
                    {
                        drawPoint(x, Math.round(y), c);
                        y -= m;
                    }
                }
            }
            else
            {
                m = (float) (x2 - x1) / (float) (y2 - y1);
                float x = x1;
                if (y1 < y2)
                {
                    for (int y = y1; y <= y2; y++)
                    {
                        drawPoint(Math.round(x), y, c);
                        x += m;
                    }
                }
                else
                {
                    for (int y = y1; y >= y2; y--)
                    {
                        drawPoint(Math.round(x), y, c);
                        x -= m;
                    }
                }
            }
        }
    }