class Image { Config conf; PImage myPic; //float averageBrightness; float ratioX; float ratioY; float imageWidth; float imageHeight; float imageBrightMin; float imageBrightMax; Image(float imageWidth, float imageHeight, int imageNr) { this.imageWidth = imageWidth; this.imageHeight = imageHeight; this.conf = new Config(); this.imageBrightMin = this.conf.imageBrightMin; this.imageBrightMax = this.conf.imageBrightMax; this.change(imageNr); //this.getAverageBright(); this.ratioX = imageWidth / (myPic.width - 1); this.ratioY = imageHeight / (myPic.height - 1); } void changeDimensions(float imageWidth, float imageHeight) { this.imageWidth = imageWidth; this.imageHeight = imageHeight; this.ratioX = this.imageWidth / (myPic.width - 1); this.ratioY = this.imageHeight / (myPic.height - 1); } void change(int number) { if (number == 1) {this.myPic = loadImage(this.conf.image1);} if (number == 2) {this.myPic = loadImage(this.conf.image2);} if (number == 3) {this.myPic = loadImage(this.conf.image3);} if (number == 4) {this.myPic = loadImage(this.conf.image4);} if (number == 5) {this.myPic = loadImage(this.conf.image5);} if (number == 6) {this.myPic = loadImage(this.conf.image6);} if (number == 7) {this.myPic = loadImage(this.conf.image7);} } void drawYourself(float ratio) { image(this.myPic, 0, 0,(int) (this.imageWidth * ratio), (int) (this.imageHeight * ratio)); } float getWidth() { return myPic.width; } float getHeight() { return myPic.height; } float getBrightness(Point cPoint) { colorMode(HSB, 255); int x = (int) (cPoint.getX() / this.ratioX); int y = (int) (cPoint.getY() / this.ratioY); color c = myPic.get(x, y); return brightness(c); } float getBrightnessDamp(Point cPoint) { float cBrightness = this.getBrightness(cPoint); return map(cBrightness, 0, 255, this.imageBrightMin, this.imageBrightMax); } void elasticPlus() { if (this.imageBrightMin > 10.0) { this.imageBrightMin -= 10.0; println("Elasticity: " + this.imageBrightMin); } } void elasticMinus() { if (this.imageBrightMin < 245.0) { this.imageBrightMin += 10; println("Elasticity: " + this.imageBrightMin); } } }