Java Code Examples for java.awt.image.IndexColorModel#equals()
The following examples show how to use
java.awt.image.IndexColorModel#equals() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IndexColorModelEqualsTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private static void verifyEquals(IndexColorModel m1, IndexColorModel m2) { if (m1.equals(null)) { throw new RuntimeException("equals(null) returns true"); } if (!(m1.equals(m2))) { throw new RuntimeException("equals() method is not working" + " properly"); } if (!(m2.equals(m1))) { throw new RuntimeException("equals() method is not working" + " properly"); } if (m1.hashCode() != m2.hashCode()) { throw new RuntimeException("HashCode is not same for same" + " IndexColorModels"); } }
Example 2
Source File: IndexColorModelEqualsTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private static void testSizeEquality() { // test with different size for cmap. IndexColorModel model1 = new IndexColorModel(8, 4, new int[] {1, 2, 3, 4}, 0, true, -1, DataBuffer.TYPE_BYTE); IndexColorModel model2 = new IndexColorModel(8, 3, new int[] {1, 2, 3}, 0, true, -1, DataBuffer.TYPE_BYTE); if (model1.equals(model2)) { throw new RuntimeException("equals() method is determining" + " Map size equality improperly"); } if (model2.equals(model1)) { throw new RuntimeException("equals() method is determining" + " Map size equality improperly"); } }
Example 3
Source File: IndexColorModelEqualsTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private static void testValidPixelsEquality() { // test with different valid pixels. /* * In setRGBs() function of IndexColorModel we override * transparent_index value to map to pixel value if alpha is 0x00 * so we should have atleast minimum alpha value to verify * equality of validBits thats why we have color value as * 16777216(2 ^ 24). */ int color = 16777216; IndexColorModel model1 = new IndexColorModel(8, 3, new int[] {color, color, color}, 0, DataBuffer.TYPE_BYTE, new BigInteger("1")); IndexColorModel model2 = new IndexColorModel(8, 3, new int[] {color, color, color}, 0, DataBuffer.TYPE_BYTE, new BigInteger("2")); if (model1.equals(model2)) { throw new RuntimeException("equals() method is determining" + " Valid pixels equality improperly"); } if (model2.equals(model1)) { throw new RuntimeException("equals() method is determining" + " Valid pixels equality improperly"); } }
Example 4
Source File: IndexColorModelEqualsTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static void testColorMapEquality() { // test with different cmap values. IndexColorModel model1 = new IndexColorModel(8, 3, new int[] {1, 2, 3}, 0, true, -1, DataBuffer.TYPE_BYTE); IndexColorModel model2 = new IndexColorModel(8, 3, new int[] {4, 5, 6}, 0, true, -1, DataBuffer.TYPE_BYTE); if (model1.equals(model2)) { throw new RuntimeException("equals() method is determining" + " ColorMap equality improperly"); } if (model2.equals(model1)) { throw new RuntimeException("equals() method is determining" + " ColorMap equality improperly"); } }
Example 5
Source File: IndexColorModelEqualsTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static void testTransparentIndexEquality() { // test with different values for transparent_index. IndexColorModel model1 = new IndexColorModel(8, 3, new int[] {1, 2, 3}, 0, true, 1, DataBuffer.TYPE_BYTE); IndexColorModel model2 = new IndexColorModel(8, 3, new int[] {1, 2, 3}, 0, true, 2, DataBuffer.TYPE_BYTE); if (model1.equals(model2)) { throw new RuntimeException("equals() method is determining" + " TransparentIndex equality improperly"); } if (model2.equals(model1)) { throw new RuntimeException("equals() method is determining" + " TransparentIndex equality improperly"); } }