Package ae.java.awt.image

Examples of ae.java.awt.image.IndexColorModel


            super(node, "JFIFThumbPalette");
        }

        JFIFThumbPalette(BufferedImage thumb) throws IllegalThumbException {
            super(thumb);
            IndexColorModel icm = (IndexColorModel) thumbnail.getColorModel();
            if (icm.getMapSize() > 256) {
                throw new IllegalThumbException();
            }
        }
View Full Code Here


                           1.0F-palettePart,
                           palettePart);
            iis.read();
            iis.reset();

            IndexColorModel cm = new IndexColorModel(8,
                                                     256,
                                                     palette,
                                                     0,
                                                     false);
            SampleModel sm = cm.createCompatibleSampleModel(thumbWidth,
                                                            thumbHeight);
            WritableRaster raster =
                Raster.createWritableRaster(sm, buffer, null);
            return new BufferedImage(cm,
                                     raster,
View Full Code Here

        void write(ImageOutputStream ios,
                   JPEGImageWriter writer) throws IOException {
            super.write(ios, writer); // width and height
            // Write the palette (must be 768 bytes)
            byte [] palette = new byte[768];
            IndexColorModel icm = (IndexColorModel) thumbnail.getColorModel();
            byte [] reds = new byte [256];
            byte [] greens = new byte [256];
            byte [] blues = new byte [256];
            icm.getReds(reds);
            icm.getGreens(greens);
            icm.getBlues(blues);
            for (int i = 0; i < 256; i++) {
                palette[i*3] = reds[i];
                palette[i*3+1] = greens[i];
                palette[i*3+2] = blues[i];
            }
View Full Code Here

TOP

Related Classes of ae.java.awt.image.IndexColorModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.