@Override
    public void drawLine(int startX, int startY, int endX, int endY, MapColor color) {
        int lengthX = Math.abs(startX - endX);
        int lengthY = Math.abs(startY - endY);
        int motionX = 1;
        int motionY = 1;
        int error = lengthX - lengthY;
        int e2;
        if (startX > endX) {
            motionX = -1;
        }
        if (startY > endY) {
            motionY = -1;
        }

        while (true) {
            setPixel(startX, startY, color);
            if (startX == endX && startY == endY) {
                break;
            }

            e2 = error * 2;
            if (e2 > -lengthY) {
                error -= lengthY;
                startX += motionX;
            }
            if (e2 < lengthX) {
                error += lengthX;
                startY += motionY;
            }
        }
    }