Package java.awt.image

Examples of java.awt.image.ComponentColorModel


      Raster.createInterleavedRaster (DataBuffer.TYPE_BYTE,
                                        icon.getWidth(),
                                        icon.getHeight(),
                                        4,
                                        null);
    ComponentColorModel colorModel=
      new ComponentColorModel (ColorSpace.getInstance(ColorSpace.CS_sRGB),
                                 new int[] {8,8,8,8},
                                 true,
                                 false,
                                 ComponentColorModel.TRANSLUCENT,
                                 DataBuffer.TYPE_BYTE);     
View Full Code Here


        int bands = 2;
        int[] bits = new int[bands];
        for (int i = 0; i < bands; i++) {
            bits[i] = 8;
        }
        ColorModel cm = new ComponentColorModel(
                ColorSpace.getInstance(ColorSpace.CS_GRAY),
                bits,
                true, alphaPremultiplied,
                Transparency.TRANSLUCENT,
                DataBuffer.TYPE_BYTE);
View Full Code Here

         */

        if (bufferedImage == null || bufferedImage.getWidth() < width
            || bufferedImage.getHeight() < height) {
            ColorSpace gsColorSpace = ColorSpace.getInstance(ColorSpace.CS_GRAY);
            ComponentColorModel ccm = new ComponentColorModel(gsColorSpace, true, false,
                Transparency.TRANSLUCENT, DataBuffer.TYPE_BYTE);
            WritableRaster raster = ccm.createCompatibleWritableRaster(width, height);
            bufferedImage = new BufferedImage(ccm, raster, ccm.isAlphaPremultiplied(), null);
        }

        bufferedImageGraphics = bufferedImage.createGraphics();
        bufferedImageGraphics.setClip(graphicsArgument.getClip());

View Full Code Here

                    nbBits = new int[]{ bpc, bpc, bpc, bpc };
                    break;
                default:
                    throw new IOException( "Unknown colorspace number of components:" + numOfComponents );
            }
            ComponentColorModel componentColorModel =
                    new ComponentColorModel( getJavaColorSpace(),
                                             nbBits,
                                             false,
                                             false,
                                             Transparency.OPAQUE,
                                             DataBuffer.TYPE_BYTE );
View Full Code Here

     * rgb+alpha <code>ColorModel</code> is returned.
     */
    public static ColorModel createComponentColorModel(SampleModel sm) {
        int type = sm.getDataType();
        int bands = sm.getNumBands();
        ComponentColorModel cm = null;

        if (type == DataBuffer.TYPE_BYTE) {
            switch (bands) {
            case 1:
                cm = colorModelGray8;
View Full Code Here

        }

        int [] bits = new int[b];
        for (int i=0; i<b; i++)
            bits[i] = 8;
        return new ComponentColorModel(cs, bits, true, true,
                                       Transparency.TRANSLUCENT,
                                       DataBuffer.TYPE_INT);
       
    }
View Full Code Here

        if (sm instanceof ComponentSampleModel) {
            int [] bitsPer = new int[bands];
            for (int i=0; i<bands; i++)
                bitsPer[i] = bits;

            return new ComponentColorModel
                (cs, bitsPer, hasAlpha, preMult,
                 hasAlpha ? Transparency.TRANSLUCENT : Transparency.OPAQUE,
                 dt);
        } else if (sm instanceof SinglePixelPackedSampleModel) {
            SinglePixelPackedSampleModel sppsm;
View Full Code Here

     *
     * @param src The image to convert to an alpha channel (mask image)
     */
    public FilterAsAlphaRed(CachableRed src) {
        super(new Any2LumRed(src),src.getBounds(),
              new ComponentColorModel
                  (ColorSpace.getInstance(ColorSpace.CS_GRAY),
                   new int [] {8}, false, false,
                   Transparency.OPAQUE,
                   DataBuffer.TYPE_BYTE),
              new PixelInterleavedSampleModel
View Full Code Here

        {
            LOG.error("error while creating colorSpace", exception);
        }
        // create the output colormodel using RGB+alpha as colorspace
        ColorSpace outputCS = ColorSpace.getInstance(ColorSpace.CS_sRGB);
        outputColorModel = new ComponentColorModel(outputCS, true, false, Transparency.TRANSLUCENT,
                DataBuffer.TYPE_BYTE);
        // domain values
        if (shadingType.getDomain() != null)
        {
            domain = shadingType.getDomain().toFloatArray();
View Full Code Here

        BufferedImage alpha = null;
        if (bi.getColorModel().hasAlpha())
        {
            // extract the alpha information
            WritableRaster alphaRaster = bi.getAlphaRaster();
            ColorModel cm = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_GRAY),
                    false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
            alpha = new BufferedImage(cm, alphaRaster, false, null);
            // create a RGB image without alpha
            image = new BufferedImage(bi.getWidth(), bi.getHeight(), BufferedImage.TYPE_INT_RGB);
            Graphics2D g = image.createGraphics();
View Full Code Here

TOP

Related Classes of java.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.