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.

84 lines
2.4 KiB
Java

import processing.core.*;
//class EllipseDrawer {
//
// Ellipse ellipseinprogress;
//
// boolean centerpointcomplete;
// boolean widthcomplete;
//
// void reset() {
// ellipseinprogress = new Ellipse(-1, -1, 0, 0);
// ellipseinprogress.visible = false;
// centerpointcomplete = false;
// widthcomplete = false;
//
// }
//
// EllipseDrawer(){
// this.reset();
// }
//
// void mouseClicked(ProjectorApplet p, float x, float y){
// if (!centerpointcomplete){
// ellipseinprogress.centerX = x;
// ellipseinprogress.centerY = y;
// centerpointcomplete = true;
//
// } else if (!widthcomplete) {
// ellipseinprogress.width = PApplet.abs(ellipseinprogress.centerX - x) * 2;
// widthcomplete = true;
//
// } else {
// ellipseinprogress.height = PApplet.abs(ellipseinprogress.centerY - y) * 2;
// ellipseinprogress.visible = true;
// //ellipses.add(ellipseinprogress);
//
// ellipseinprogress.draw(p);
// this.reset();
// }
// }
//}
class Ellipse {
float centerX, centerY, width, height;
int red, green, blue, brushSize;
boolean visible;
Ellipse(float centerX, float centerY, float width, float height, int rVal, int gVal, int bVal, int penWidth) {
this.centerX = centerX;
this.centerY = centerY;
this.width = width;
this.height = height;
this.red = rVal;
this.green = gVal;
this.blue = bVal;
this.brushSize = penWidth;
this.visible = true;
}
void draw(ProjectorApplet projector) {
if (visible) {
projector.commandQueue.add(
(ProjectorApplet p) -> {
float old_strokeWeight = p.g.strokeWeight;
int old_strokeColor = p.g.strokeColor;
p.ellipseMode(PApplet.CENTER);
p.strokeWeight(brushSize);
p.stroke(p.color(red, green, blue));
p.noFill();
p.ellipse(p.convertXCoord(centerX), p.convertYCoord(centerY),
p.convertXDistance(width), p.convertYDistance(height));
p.strokeWeight(old_strokeWeight);
p.stroke(old_strokeColor);
return true;
});
}
}
}