-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathREADME.txt
More file actions
22 lines (19 loc) · 715 Bytes
/
README.txt
File metadata and controls
22 lines (19 loc) · 715 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Here's some sample code for using the LargeColour class:
LargeColour avgColour = getAverageColourFrom(image);
String choice = getChosenColour(avgColour);
private LargeColour getAverageColourFrom(Image image) {
int width = image.getWidth();
int height = image.getHeight();
int rgbaArray[] = new int[width * height];
image.getRGB(rgbaArray, 0, width, 0, 0, width, height);
return imageAverager.getAverageColourFrom(rgbaArray);
}
private String getChosenColour(LargeColour averageColour) {
String choice = "hackday";
if (LargeColour.PURPLE.differenceFrom(averageColour) < 60f) {
choice = "yahoo";
} else if (LargeColour.RED.differenceFrom(averageColour) < 60f) {
choice = "kizoom";
}
return choice;
}