-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0230d15
commit 9353883
Showing
14 changed files
with
464 additions
and
54 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
/tester/ | ||
/toolkit/ | ||
/core/ | ||
/res/ | ||
/resources/ | ||
/ACI_RGB.csv |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/** | ||
* | ||
*/ | ||
package core; | ||
|
||
import java.awt.Color; | ||
|
||
/** | ||
* @author OlumideEnoch | ||
* | ||
*/ | ||
public class ACIColor { | ||
|
||
private Color RGB = new Color(0,0,0); | ||
private int ACI = 255; | ||
private int sum = 0; | ||
/** | ||
* @param rGB | ||
* @param aCI | ||
*/ | ||
public ACIColor(Color rGB, int aCI) { | ||
super(); | ||
RGB = rGB; | ||
ACI = aCI; | ||
setSum(); | ||
} | ||
/** | ||
* @return the rGB | ||
*/ | ||
public Color getRGB() { | ||
return RGB; | ||
} | ||
/** | ||
* @param rGB the rGB to set | ||
*/ | ||
public void setRGB(Color rGB) { | ||
RGB = rGB; | ||
} | ||
/** | ||
* @return the aCI | ||
*/ | ||
public int getACI() { | ||
return ACI; | ||
} | ||
/** | ||
* @param aCI the aCI to set | ||
*/ | ||
public void setACI(int aCI) { | ||
ACI = aCI; | ||
} | ||
|
||
private void setSum() { | ||
this.sum = this.RGB.getRed() + this.RGB.getGreen() + this.RGB.getBlue(); | ||
} | ||
|
||
public int getSum() { | ||
return this.sum; | ||
} | ||
|
||
public void print() { | ||
System.out.println(this.RGB.toString() + "ACI: " + getACI()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
package core; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import toolkit.Toolset; | ||
|
||
public class ACIColorList { | ||
|
||
private List<ACIColor> colorList = new ArrayList<ACIColor>(); | ||
private int[] redChannel, blueChannel, greenChannel; | ||
|
||
/** | ||
* @param colorList | ||
*/ | ||
public ACIColorList(List<ACIColor> colorList) { | ||
super(); | ||
this.colorList = colorList; | ||
setChannels(this.colorList); | ||
} | ||
|
||
/** | ||
* @return the colorList | ||
*/ | ||
public List<ACIColor> getColorList() { | ||
return colorList; | ||
} | ||
|
||
/** | ||
* @param colorList the colorList to set | ||
*/ | ||
public void setColorList(List<ACIColor> colorList) { | ||
this.colorList = colorList; | ||
} | ||
|
||
public void sortByRedChannel() { | ||
//Collections.sort(colorList); | ||
} | ||
|
||
/** | ||
* @param redChannels the redChannels to set | ||
*/ | ||
private void setChannels(List<ACIColor> colorList) { | ||
int n = colorList.size(); | ||
redChannel = new int[n]; | ||
greenChannel = new int[n]; | ||
blueChannel = new int[n]; | ||
int i = 0; | ||
for(ACIColor item : colorList) { | ||
redChannel[i] = item.getRGB().getRed(); | ||
greenChannel[i] = item.getRGB().getGreen(); | ||
blueChannel[i] = item.getRGB().getBlue(); | ||
i++; | ||
} | ||
Arrays.sort(redChannel); | ||
Arrays.sort(greenChannel); | ||
Arrays.sort(blueChannel); | ||
} | ||
|
||
/** | ||
* @return the redChannel | ||
*/ | ||
public int[] getRedChannel() { | ||
return redChannel; | ||
} | ||
|
||
/** | ||
* @return the blueChannel | ||
*/ | ||
public int[] getBlueChannel() { | ||
return blueChannel; | ||
} | ||
|
||
/** | ||
* @return the greenChannel | ||
*/ | ||
public int[] getGreenChannel() { | ||
return greenChannel; | ||
} | ||
|
||
public int getClosestToColorSum(int value) { | ||
|
||
int sumList[] = new int[colorList.size()]; | ||
|
||
int i = 0; | ||
for(ACIColor item : colorList) { | ||
sumList[i] = item.getSum(); | ||
i++; | ||
} | ||
|
||
return Toolset.closestNumber(sumList, value); | ||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.