Package com.google.code.appengine.awt.image

Examples of com.google.code.appengine.awt.image.IndexColorModel


       }
      
       ColorModel model = null;
       int size = redLUT.length;
       if (alphaLUT == null) {
           model = new IndexColorModel(bits, size, redLUT, greenLUT, blueLUT);
       } else {
           model = new IndexColorModel(bits, size, redLUT, greenLUT, blueLUT, alphaLUT);
       }
      
       return new ImageTypeSpecifier(model, model.createCompatibleSampleModel(1, 1));
    }
View Full Code Here


                                 DataBuffer.TYPE_BYTE);
        }
       
        case BufferedImage.TYPE_BYTE_INDEXED: {
            BufferedImage bufferedImage = new BufferedImage(1, 1, BufferedImage.TYPE_BYTE_INDEXED);
            IndexColorModel colorModel = (IndexColorModel) bufferedImage.getColorModel();
            byte[] redLUT = new byte[256];
            byte[] greenLUT = new byte[256];
            byte[] blueLUT = new byte[256];
            byte[] alphaLUT = new byte[256];
           
            colorModel.getReds(redLUT);
            colorModel.getGreens(greenLUT);
            colorModel.getBlues(blueLUT);
            colorModel.getAlphas(alphaLUT);
           
            return createIndexed(redLUT,
                                 greenLUT,
                                 blueLUT,
                                 alphaLUT,
View Full Code Here

                int scanline = raster.getWidth();
                DataBufferInt dbi = (DataBufferInt) db;
                int rof = dbi.getOffset() + y * scanline + x;
                if(model instanceof IndexColorModel){

                    IndexColorModel icm = (IndexColorModel) model;
                    int colorMap[] = new int[icm.getMapSize()];
                    icm.getRGBs(colorMap);

                    for (int sy = y, sOff = off; sy < y + h; sy++, sOff += scansize,
                        rof += scanline) {
                        for (int sx = x, idx = 0; sx < x + w; sx++, idx++) {
                            buff[idx] = colorMap[pixels[sOff + idx] & 0xff];
View Full Code Here

        Object obj = null;
        int pixels[] = new int[w];

        if(cm instanceof IndexColorModel){
            IndexColorModel icm = (IndexColorModel) cm;
            int colorMap[] = new int[icm.getMapSize()];
            icm.getRGBs(colorMap);

            for (int y = 0; y < h; y++) {
                obj = raster.getDataElements(0, y, w, 1, obj);
                byte ba[] = (byte[]) obj;
                for (int x = 0; x < ba.length; x++) {
View Full Code Here

                return cm;
            } else
                if (completed && size > 0) {
                    if (transparentColor == IMPOSSIBLE_VALUE) {
                        return cm =
                                new IndexColorModel(8, size, colors, 0, false);
                    }

                    if (transparentColor > size) {
                        size = transparentColor + 1;
                    }
                    return cm =
                            new IndexColorModel(8, size, colors, 0, false, transparentColor);
                }

            return cm = null; // Force default ARGB color model
        }
View Full Code Here

                    }
                default:
                    return BufferedImage.TYPE_CUSTOM;
                }
            }else if(cm instanceof IndexColorModel){
                IndexColorModel icm = (IndexColorModel) cm;
                int pixelBits = icm.getPixelSize();
                if(transferType == DataBuffer.TYPE_BYTE){
                    if(sm instanceof MultiPixelPackedSampleModel && !hasAlpha &&
                        pixelBits < 5){
                            return BufferedImage.TYPE_BYTE_BINARY;
                    }else if(pixelBits == 8){
View Full Code Here

            }
            break;

        case TYPE_BYTE_BINARY: {
            int colorMap[] = { 0, 0xffffff };
            cm = new IndexColorModel(1, 2, colorMap, 0, false, -1,
                    DataBuffer.TYPE_BYTE);

            raster = Raster.createPackedRaster(DataBuffer.TYPE_BYTE, width,
                    height, 1, 1, null);
            }
            break;

        case TYPE_BYTE_INDEXED: {
            int colorMap[] = 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) {
                        colorMap[i] = (r << 16) | (g << 8) | b;
                        i++;
                    }
                }
            }

            int gray = 0x12;
            for (; i < 256; i++, gray += 6) {
                colorMap[i] = (gray << 16) | (gray << 8) | gray;
            }
            cm = new IndexColorModel(8, 256, colorMap, 0, false, -1,
                    DataBuffer.TYPE_BYTE);
            raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE,
                    width, height, 1, null);

            }
View Full Code Here

                    trans = i;
                }
            }
        }

        return new IndexColorModel(bits, mapSize, filteredColorMap, 0,
                hasAlpha, trans, transferType);
    }
View Full Code Here

    @Override
    public void setColorModel(ColorModel model) {
        if(model instanceof IndexColorModel &&
                canFilterIndexColorModel){
            IndexColorModel icm = (IndexColorModel) model;
            ColorModel filteredModel = filterIndexColorModel(icm);
            substituteColorModel(model, filteredModel);
            consumer.setColorModel(filteredModel);
        }else{
            consumer.setColorModel(ColorModel.getRGBdefault());
View Full Code Here

TOP

Related Classes of com.google.code.appengine.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.