i have a colour value (11, 96, 133) and i want the program to tell me if there is any colour that is really similar or exactly the same. here is the rest of my code if its useful:
PImage screenshot;
import java.awt.Robot;
void setup() {
size(400,300);
}
void draw() {
try {
Robot robot = new Robot();
screenshot = new PImage(robot.createScreenCapture(new java.awt.Rectangle()(0,0,screen.width,screen.height)));
} catch (AWTException e) {
}
image(screenshot, 0, 0, width, height);
screenshot(0,0,width, height);
}
`
`
*** 1. > * Blockquote**
`
`
[quote="MoonAlien822, post:1, topic:30405, full:true"]
i have a colour value (11, 96, 133) and i want the program to tell me if there is any colour that is really similar or exactly the same. here is the rest of my code if its useful:
PImage screenshot;
import java.awt.Robot;
void setup() {
size(400,300);
}
void draw() {
try {
Robot robot = new Robot();
screenshot = new PImage(robot.createScreenCapture(new java.awt.Rectangle()(0,0,screen.width,screen.height)));
} catch (AWTException e) {
}
image(screenshot, 0, 0, width, height);
screenshot(0,0,width, height);
}
You formatted your code but did not do it correctly.
Take a look at it and you will see duplicate code… you can edit this.
That code does not work as is.
Take a look at your code and examples for some insight.
I was able to find an exact color on the screen and display x,y co-ordinates with the tips that I provided you:
Here is a working example that I already provided to get a screen image: Screen capture in Processing – Magic & Love Interactive
This example should help you correct your code.
This is just one example that I found and worked with.
As of Processing 3, to run a sketch at the full dimensions of a screen, use the fullScreen() function, rather than the older way of using size(displayWidth, displayHeight) .
You can use:
// This does not work!
//println(screen.width,screen.height);
println(displayWidth, displayHeight);