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.
100 lines
2.6 KiB
Java
100 lines
2.6 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 p) {
|
|
if (visible) {
|
|
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);
|
|
|
|
/*
|
|
print(rVal);
|
|
print(",");
|
|
print(gVal);
|
|
print(",");
|
|
print(bVal);
|
|
print("\n");
|
|
*/
|
|
|
|
/*
|
|
print(convertXCoord(centerx));
|
|
print("\n");
|
|
print(convertYCoord(centery));
|
|
print("\n");
|
|
print(convertXDistance(width));
|
|
print("\n");
|
|
print(convertYDistance(height));
|
|
print("\n");
|
|
*/
|
|
}
|
|
}
|
|
}
|
|
|
|
|