You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
613 B
Java

class Freehand {
/*
Class for freehand drawing
*/
int color, brushSize;
Freehand(int color, int penWidth) {
this.color = color;
this.brushSize = penWidth;
}
DragGetter makeDragGetter(ProjectorApplet p) {
/*
Create a DragGetter which can accept incoming mouse drags
and use them to draw lines
*/
return (int x1, int y1, int x2, int y2) -> {
Line line = new Line(x1, y1, x2, y2, this.color, this.brushSize);
p.commandQueue.add(line.makeProjectorCommand());
// Keep using this DragGetter, don't stop
return false;
};
}
}