void drawLine(Line l) {
        double diffx = l.p2.x - l.p1.x;
        double diffy = l.p2.y - l.p1.y;
        double mag = 2 * Math.sqrt(diffx * diffx + diffy * diffy);
        double dx = diffx / mag;
        double dy = diffy / mag;
        if (Double.isNaN(dx) || Double.isNaN(dy)) return;

        double curx = l.p1.x + size / 2, cury = l.p1.y + size / 2;
        int prevx = -1, prevy = -1;
        while (inBounds((int) curx, (int) cury)) {
            if ((int) curx == prevx && (int) cury == prevy) {
                curx += dx;
                cury += dy;
                continue;
            }
            prevx = (int) curx;
            prevy = (int) cury;
//            System.out.println("incrementing pixel at " + curx + " " + cury);
            pixels[prevy][prevx].increment();
            curx += dx;
            cury += dy;
        }
        curx = l.p1.x - dx + (size - 1) / 2;
        cury = l.p1.y - dy + (size - 1) / 2;
        while (inBounds((int) curx, (int) cury)) {
            if ((int) curx == prevx && (int)cury == prevy) {
                curx -= dx;
                cury -= dy;
                continue;
            }
            prevx = (int) curx;
            prevy = (int) cury;
//            System.out.println("incrementing pixel at " + curx + " " + cury);
            pixels[prevy][prevx].increment();
            curx -= dx;
            cury -= dy;
        }
    }