42 };
43
44 static boolean counterrors;
45 static int errcount;
46
47 public static void error(String problem) {
48 if (counterrors) {
49 errcount++;
50 } else {
51 throw new RuntimeException(problem);
52 }
53 }
54
55 public static void main(String argv[]) {
56 counterrors = (argv.length > 0);
57 test(BufferedImage.TYPE_INT_ARGB);
58 test(BufferedImage.TYPE_INT_RGB);
59 if (errcount > 0) {
60 throw new RuntimeException(errcount+" errors");
61 }
62 System.exit(0); // For 1.3 and earlier VMs...
63 }
64
65 static int cmap[] = {
66 0x00000000,
67 0xffffffff,
68 };
69
70 public static void test(int dsttype) {
71 BufferedImage src =
72 new BufferedImage(TESTW, TESTH, BufferedImage.TYPE_INT_ARGB);
73 test(src, dsttype);
74 IndexColorModel icm = new IndexColorModel(8, 2, cmap, 0, true, 0,
75 DataBuffer.TYPE_BYTE);
76 src = new BufferedImage(TESTW, TESTH,
77 BufferedImage.TYPE_BYTE_INDEXED, icm);
78 test(src, dsttype);
79 }
80
81 public static void test(Image src, int dsttype) {
82 BufferedImage dst =
|
42 };
43
44 static boolean counterrors;
45 static int errcount;
46
47 public static void error(String problem) {
48 if (counterrors) {
49 errcount++;
50 } else {
51 throw new RuntimeException(problem);
52 }
53 }
54
55 public static void main(String argv[]) {
56 counterrors = (argv.length > 0);
57 test(BufferedImage.TYPE_INT_ARGB);
58 test(BufferedImage.TYPE_INT_RGB);
59 if (errcount > 0) {
60 throw new RuntimeException(errcount+" errors");
61 }
62 }
63
64 static int cmap[] = {
65 0x00000000,
66 0xffffffff,
67 };
68
69 public static void test(int dsttype) {
70 BufferedImage src =
71 new BufferedImage(TESTW, TESTH, BufferedImage.TYPE_INT_ARGB);
72 test(src, dsttype);
73 IndexColorModel icm = new IndexColorModel(8, 2, cmap, 0, true, 0,
74 DataBuffer.TYPE_BYTE);
75 src = new BufferedImage(TESTW, TESTH,
76 BufferedImage.TYPE_BYTE_INDEXED, icm);
77 test(src, dsttype);
78 }
79
80 public static void test(Image src, int dsttype) {
81 BufferedImage dst =
|