> Is there any way to control the palette used by a BufferedImage?

There is a constructor that takes an IndexColorModel as an argument.

If you need a boilerplate for creating an IndexColorModel with a
6x6x6 color cube, then this code from the BufferedImage class will
work:

        // Create a 6x6x6 color cube
        int[] cmap = new int[256];
        int i=0;
        for (int r=0; r < 256; r += 51) {
            for (int g=0; g < 256; g += 51) {
                for (int b=0; b < 256; b += 51) {
                    cmap[i++] = (r<<16)|(g<<8)|b;
                }
            }
        }

        IndexColorModel cm = new IndexColorModel(8, 216, cmap, 0, false, -1,
                                                 DataBuffer.TYPE_BYTE);

                                ...jim

=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 2D Home Page: http://java.sun.com/products/java-media/2D/

Reply via email to