added class to cover parts of image that were already cropped
This commit is contained in:
21
bounder.pde
21
bounder.pde
@@ -10,7 +10,8 @@ class Bounder {
|
||||
}
|
||||
PVector p1, p2, p3, p4;
|
||||
void click() {
|
||||
if (state < 4) state++;
|
||||
if (state < 3) state++;
|
||||
else state = 1;
|
||||
if (state == 1) {
|
||||
p1 = new PVector(mouseX, mouseY);
|
||||
loop();
|
||||
@@ -39,8 +40,6 @@ class Bounder {
|
||||
line(p1.x, p1.y, mouseX, mouseY);
|
||||
}
|
||||
if (state > 1) {
|
||||
//stroke(1);
|
||||
//line(p1.x, p1.y, p2.x, p2.y);
|
||||
fill(0);
|
||||
noStroke();
|
||||
circle(p2.x, p2.y, 5);
|
||||
@@ -61,6 +60,12 @@ class Bounder {
|
||||
}
|
||||
|
||||
void compile(boolean Execute) {
|
||||
|
||||
if (Execute) {
|
||||
state = 0;
|
||||
covers.add(new Cover(p1, p2, p4, p3));
|
||||
}
|
||||
|
||||
PVector ptopmid = new PVector((p1.x + p2.x)/2, (p1.y + p2.y)/2);
|
||||
PVector pbotmid = new PVector((p3.x + p4.x)/2, (p3.y + p4.y)/2);
|
||||
|
||||
@@ -99,11 +104,17 @@ class Bounder {
|
||||
println(cmdright);
|
||||
//execl("/bin/sh", "-c", "cd", (const char *)0);
|
||||
//exec("/bin/sh -c cd " + folderURI + " && " + cmdleft);
|
||||
|
||||
|
||||
//String[] runConvert = { "/bin/bash", "-c", "cd " + folderURI + " && mkdir " + folderName + " && " + cmdleft + " && " + cmdright + " && " + cmdpdf };
|
||||
String[] runConvert = { "/bin/bash", "-c", "cd " + folderURI + " && mkdir " + folderName + " && " + cmdleft + " && " + cmdright };
|
||||
|
||||
if(Execute) exec(runConvert);
|
||||
|
||||
if (Execute) exec(runConvert);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//println(leftLeftTopX + "," + leftLeftTopY + " " + leftRightTopX + "," + leftRightTopY + " " + leftRightBotX + "," + leftRightBotY + " " + leftLeftBotX + "," + leftLeftBotY);
|
||||
//println(rightLeftTopX + "," + rightLeftTopY + " " + rightRightTopX + "," + rightRightTopY + " " + rightRightBotX + "," + rightRightBotY + " " + rightLeftBotX + "," + rightLeftBotY);
|
||||
|
||||
19
cover.pde
Normal file
19
cover.pde
Normal file
@@ -0,0 +1,19 @@
|
||||
class Cover {
|
||||
PVector p1, p2, p3, p4;
|
||||
PShape coverRect;
|
||||
Cover(PVector p1_, PVector p2_, PVector p3_, PVector p4_) {
|
||||
p1 = new PVector(p1_.x, p1_.y);
|
||||
p2 = new PVector(p2_.x, p2_.y);
|
||||
p3 = new PVector(p3_.x, p3_.y);
|
||||
p4 = new PVector(p4_.x, p4_.y);
|
||||
coverRect = createShape();
|
||||
coverRect.beginShape();
|
||||
coverRect.fill(0,200);
|
||||
coverRect.noStroke();
|
||||
coverRect.vertex(p1.x, p1.y);
|
||||
coverRect.vertex(p2.x, p2.y);
|
||||
coverRect.vertex(p3.x, p3.y);
|
||||
coverRect.vertex(p4.x, p4.y);
|
||||
coverRect.endShape(CLOSE);
|
||||
}
|
||||
}
|
||||
@@ -5,17 +5,19 @@ Bounder bounder;
|
||||
int imageNo = 0;
|
||||
int imageAmount;
|
||||
|
||||
ArrayList<Cover> covers = new ArrayList<Cover>();
|
||||
|
||||
String[] imagePaths;
|
||||
PImage[] images;
|
||||
PImage imageThumb;
|
||||
boolean imageLoaded;
|
||||
String folderURI;
|
||||
|
||||
PShape COVER;
|
||||
void setup() {
|
||||
size(240, 100);
|
||||
frameRate(30);
|
||||
noSmooth();
|
||||
COVER = createShape();
|
||||
drop = new SDrop(this);
|
||||
surface.setResizable(true);
|
||||
bounder = new Bounder();
|
||||
@@ -33,6 +35,11 @@ void draw() {
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < covers.size(); i++) {
|
||||
Cover c = covers.get(i);
|
||||
shape(c.coverRect);
|
||||
}
|
||||
|
||||
bounder.update();
|
||||
bounder.display();
|
||||
}
|
||||
@@ -102,7 +109,7 @@ void dropEvent(DropEvent theDropEvent) {
|
||||
imagePaths = imgs.toArray(imagePaths);
|
||||
imagePaths = sort(imagePaths);
|
||||
images = new PImage[imageAmount];
|
||||
if(imageNo++ <= imageAmount) imageNo++; //open on page 2
|
||||
if (imageNo++ <= imageAmount) imageNo++; //open on page 2
|
||||
setImage(imageNo);
|
||||
surface.setSize(displayWidth, displayHeight);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user