Package java.awt.image

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


    public static final WritableRaster createRaster(int width, int height) {
        final ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
        final int[] nBits = {8};
        final ComponentColorModel cm = new ComponentColorModel(cs, nBits,
            false, true, Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
        return cm.createCompatibleWritableRaster(width, height);
    }

    /**
     * Create a raster for the given at a given font-size.
     *
 
View Full Code Here


        int rasterWidth = Math.max(1, ceiling(width));
        int rasterHeight = Math.max(1, ceiling(height));

        // create raster
        WritableRaster raster = cm.createCompatibleWritableRaster(rasterWidth, rasterHeight);
        BufferedImage image = new BufferedImage(cm, raster, false, null);

        Graphics2D graphics = image.createGraphics();
        graphics.transform(xform); // device transform (i.e. DPI)
        drawer.drawTilingPattern(graphics, pattern, colorSpace, color);
View Full Code Here

    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

        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

    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

        }
        // create a RGB color model
        ColorModel cm = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB),
                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

        }
        // create a target color model
        ColorModel cm = new ComponentColorModel(colorspace,
                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( sourceBuffer, 0,bufferData, 0,sourceBuffer.length );
View Full Code Here

    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

        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(graphics.getClip());
View Full Code Here

    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

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.