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

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


    public ColorModel deriveColorModel(ColorModel old_cm, ColorSpace cs,
            boolean force_no_alpha) throws ImagingOpException {

        if (old_cm instanceof ComponentColorModel) {
            ComponentColorModel ccm = (ComponentColorModel) old_cm;
            // ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
            if (force_no_alpha)
                return new ComponentColorModel(cs, false, false,
                        ComponentColorModel.OPAQUE, ccm.getTransferType());
            else
                return new ComponentColorModel(cs, ccm.hasAlpha(), ccm
                        .isAlphaPremultiplied(), ccm.getTransparency(), ccm
                        .getTransferType());
        } else if (old_cm instanceof DirectColorModel) {
            DirectColorModel dcm = (DirectColorModel) old_cm;

            int old_mask = dcm.getRedMask() | dcm.getGreenMask()
View Full Code Here


       
        for (int i = 0; i < numComponents; i++) {
            bits[i] = DataBuffer.getDataTypeSize(dataType);
        }
       
        ColorModel colorModel = new ComponentColorModel(colorSpace,
                                                        bits,
                                                        hasAlpha,
                                                        isAlphaPremultiplied,
                                                        transparency,
                                                        dataType);
View Full Code Here

        for (int i = 0; i < numComponents; i++) {
            bits[i] = DataBuffer.getDataTypeSize(dataType);
        }
        int transparency = hasAlpha ? Transparency.TRANSLUCENT : Transparency.OPAQUE;
       
        ColorModel colorModel = new ComponentColorModel(colorSpace,
                                                        bits,
                                                        hasAlpha,
                                                        isAlphaPremultiplied,
                                                        transparency,
                                                        dataType);
View Full Code Here

        numBits[0] = bits;
        if (numComponent ==2) {
            numBits[1] = bits;
        }
        int transparency = hasAlpha ? Transparency.TRANSLUCENT : Transparency.OPAQUE;
        ColorModel model = new ComponentColorModel(colorSpace, numBits, hasAlpha, isAlphaPremultiplied, transparency, dataType);

        return new ImageTypeSpecifier(model, model.createCompatibleSampleModel(1, 1));
    }
View Full Code Here

                        return BufferedImage.TYPE_BYTE_INDEXED;
                    }
                }
                return BufferedImage.TYPE_CUSTOM;
            }else if(cm instanceof ComponentColorModel){
                ComponentColorModel ccm = (ComponentColorModel) cm;
                if(transferType == DataBuffer.TYPE_BYTE &&
                        sm instanceof ComponentSampleModel){
                    ComponentSampleModel csm =
                        (ComponentSampleModel) sm;
                    int[] offsets = csm.getBandOffsets();
                    int[] bits = ccm.getComponentSize();
                    boolean isCustom = false;
                    for (int i = 0; i < bits.length; i++) {
                        if (bits[i] != 8 ||
                               offsets[i] != offsets.length - 1 - i) {
                            isCustom = true;
                            break;
                        }
                    }
                    if (!isCustom) {
                        if (!ccm.hasAlpha()) {
                            return BufferedImage.TYPE_3BYTE_BGR;
                        } else if (ccm.isAlphaPremultiplied()) {
                            return BufferedImage.TYPE_4BYTE_ABGR_PRE;
                        } else {
                            return BufferedImage.TYPE_4BYTE_ABGR;
                        }
                    }
View Full Code Here

            (destination instanceof ColorSpace) ?
                    (ColorSpace) destination :
                    new ICC_ColorSpace((ICC_Profile) destination);
       
        ColorModel srcCM = src.getColorModel();    
        ColorModel dstCM = new ComponentColorModel(dstCS,
                srcCM.hasAlpha(),
                srcCM.isAlphaPremultiplied(),
                srcCM.getTransparency(),
                srcCM.getTransferType());
       
        return new BufferedImage(dstCM,
                dstCM.createCompatibleWritableRaster(src.getWidth(), src.getHeight()),
                dstCM.isAlphaPremultiplied(),
                null);
    }
View Full Code Here

                    transferType = DataBuffer.TYPE_BYTE;
                } else if (lut instanceof ShortLookupTable) {
                    transferType = DataBuffer.TYPE_SHORT;
                }

                dstCM = new ComponentColorModel(
                        dstCM.cs,
                        dstCM.hasAlpha(),
                        dstCM.isAlphaPremultiplied,
                        dstCM.transparency,
                        transferType
View Full Code Here

                throw new UnsupportedOperationException(Messages.getString("awt.219")); //$NON-NLS-1$
            }
        }

        if (!signed) {
            return new ComponentColorModel(cs, bits, hasAlpha,
                    isAlphaPremultiplied, transparency, transferType);
        }

        return new ComponentColorModel(cs, null, hasAlpha,
                isAlphaPremultiplied, transparency, transferType);
    }
View Full Code Here

            break;

        case TYPE_3BYTE_BGR: {
            int bits[] = { 8, 8, 8 };
            int bandOffsets[] = { 2, 1, 0 };
            cm = new ComponentColorModel(
                    ColorSpace.getInstance(ColorSpace.CS_sRGB),
                    bits,
                    false,
                    false,
                    Transparency.OPAQUE,
                    DataBuffer.TYPE_BYTE);

            raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE,
                    width, height, width * 3, 3, bandOffsets, null);
            }
            break;

        case TYPE_4BYTE_ABGR: {
            int bits[] = { 8, 8, 8, 8 };
            int bandOffsets[] = { 3, 2, 1, 0 };
            cm = new ComponentColorModel(
                    ColorSpace.getInstance(ColorSpace.CS_sRGB),
                    bits,
                    true,
                    false,
                    Transparency.TRANSLUCENT,
                    DataBuffer.TYPE_BYTE);

            raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE,
                    width, height, width * 4, 4, bandOffsets, null);
            }
            break;

        case TYPE_4BYTE_ABGR_PRE: {
            int bits[] = { 8, 8, 8, 8 };
            int bandOffsets[] = { 3, 2, 1, 0 };
            cm = new ComponentColorModel(
                    ColorSpace.getInstance(ColorSpace.CS_sRGB),
                    bits,
                    true,
                    true,
                    Transparency.TRANSLUCENT, DataBuffer.TYPE_BYTE);

            raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE,
                    width, height, width * 4, 4, bandOffsets, null);
            }
            break;

        case TYPE_USHORT_565_RGB:
            cm = new DirectColorModel(
                    ColorSpace.getInstance(ColorSpace.CS_sRGB),
                    16,
                    RED_565_MASK,
                    GREEN_565_MASK,
                    BLUE_565_MASK,
                    0,
                    false,
                    DataBuffer.TYPE_USHORT);

            raster = cm.createCompatibleWritableRaster(width, height);
            break;

        case TYPE_USHORT_555_RGB:
            cm = new DirectColorModel(
                    ColorSpace.getInstance(ColorSpace.CS_sRGB),
                    15,
                    RED_555_MASK,
                    GREEN_555_MASK,
                    BLUE_555_MASK,
                    0,
                    false,
                    DataBuffer.TYPE_USHORT);

            raster = cm.createCompatibleWritableRaster(width, height);
            break;

        case TYPE_BYTE_GRAY: {
            int bits[] = { 8 };
            cm = new ComponentColorModel(
                    ColorSpace.getInstance(ColorSpace.CS_GRAY),
                    bits,
                    false,
                    false,
                    Transparency.OPAQUE,
                    DataBuffer.TYPE_BYTE);

            raster = cm.createCompatibleWritableRaster(width, height);
            }
            break;

        case TYPE_USHORT_GRAY: {
            int bits[] = { 16 };
            cm = new ComponentColorModel(
                    ColorSpace.getInstance(ColorSpace.CS_GRAY),
                    bits,
                    false,
                    false,
                    Transparency.OPAQUE,
View Full Code Here

TOP

Related Classes of com.google.code.appengine.awt.image.ComponentColorModel

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.