Package java.awt.image

Examples of java.awt.image.ColorModel.createCompatibleWritableRaster()


    private BufferedImage createRGBBufferedImage(ColorSpace cs, byte[] rgb, int width, int height)
    {
        // create a RGB color model
        ColorModel cm = new ComponentColorModel(cs, false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
        // create the target raster
        WritableRaster writeableRaster = cm.createCompatibleWritableRaster(width, height);
        // get the data buffer of the raster
        DataBufferByte buffer = (DataBufferByte)writeableRaster.getDataBuffer();
        byte[] bufferData = buffer.getData();
        // copy all the converted data to the raster buffer
        System.arraycopy( rgb, 0,bufferData, 0,rgb.length );
View Full Code Here


     */
    public static BufferedImage makeLinearBufferedImage(int width,
                                                        int height,
                                                        boolean premult) {
        ColorModel cm = makeLinear_sRGBCM(premult);
        WritableRaster wr = cm.createCompatibleWritableRaster(width, height);
        return new BufferedImage(cm, wr, premult, null);
    }

    /**
     * This method will return a CacheableRed that has it's data in
View Full Code Here

           

            // Create an image with that color model
            BufferedImage tmpSrcBI = new BufferedImage
                (cm, cm.createCompatibleWritableRaster(wr.getWidth(),
                                                       wr.getHeight()),
                 cm.isAlphaPremultiplied(), null);

            // Copy the color data (no alpha) to that image
            // (dividing out alpha if needed).
View Full Code Here

            // Get a linear sRGB Premult ColorModel
            ColorModel dstCM = GraphicsUtil.Linear_sRGB_Unpre;
            // Construct out output image around that ColorModel
            destBI = new BufferedImage
                (dstCM, dstCM.createCompatibleWritableRaster(wr.getWidth(),
                                                             wr.getHeight()),
                 dstCM.isAlphaPremultiplied(), null);

            // Construct another image on the same data buffer but without
            // an alpha channel.
View Full Code Here

            (cs, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000,
             false, DataBuffer.TYPE_INT);

        // Create a raster for the turbulence pattern
        WritableRaster wr, twr;
        wr = cm.createCompatibleWritableRaster(rasterRect.width,
                                               rasterRect.height);
        twr = wr.createWritableTranslatedChild(rasterRect.x,
                                               rasterRect.y);

        // Create a TurbulencePatternGenerator that will do the job
View Full Code Here

     */
    public static BufferedImage makeLinearBufferedImage(int width,
                                                        int height,
                                                        boolean premult) {
        ColorModel cm = makeLinear_sRGBCM(premult);
        WritableRaster wr = cm.createCompatibleWritableRaster(width, height);
        return new BufferedImage(cm, wr, premult, null);
    }

    /**
     * This method will return a CacheableRed that has it's data in
View Full Code Here

                in = new ByteArrayInputStream( out.toByteArray() );
            }
            finalData = out.toByteArray();
        }

        WritableRaster raster = colorModel.createCompatibleWritableRaster( params.getWidth(), params.getHeight() );
        /*    Raster.createPackedRaster(
                buffer,
                params.getWidth(),
                params.getHeight(),
                params.getBitsPerComponent(),
View Full Code Here

                Dimension orgDim = new Dimension(img.getWidth(), img.getHeight());
                if (targetDimension != null && !orgDim.equals(targetDimension)) {
                    //Scale only before dithering
                    ColorModel cm = img.getColorModel();
                    BufferedImage tgt = new BufferedImage(cm,
                            cm.createCompatibleWritableRaster(
                                    targetDimension.width, targetDimension.height),
                            cm.isAlphaPremultiplied(), null);
                    transferImage(img, tgt);
                    bi = tgt;
                } else {
View Full Code Here

            image = (BufferedImage)img;
        } else {
            ColorModel cm = img.getColorModel();
            int width = img.getWidth();
            int height = img.getHeight();
            WritableRaster raster = cm.createCompatibleWritableRaster(width, height);
            boolean isAlphaPremultiplied = cm.isAlphaPremultiplied();
            Hashtable properties = new Hashtable();
            String[] keys = img.getPropertyNames();
            if (keys!=null) {
                for (int i = 0; i < keys.length; i++) {
View Full Code Here

                Dimension orgDim = new Dimension(img.getWidth(), img.getHeight());
                if (targetDimension != null && !orgDim.equals(targetDimension)) {
                    //Scale only before dithering
                    ColorModel cm = img.getColorModel();
                    BufferedImage tgt = new BufferedImage(cm,
                            cm.createCompatibleWritableRaster(
                                    targetDimension.width, targetDimension.height),
                            cm.isAlphaPremultiplied(), null);
                    transferImage(img, tgt);
                    bi = tgt;
                } else {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.