Examples of createCompatibleWritableRaster()


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

    }
        
        BufferedImage target = null;
        if (type == BufferedImage.TYPE_CUSTOM) {  
            ColorModel cm = image.getColorModel();   
            WritableRaster raster = cm.createCompatibleWritableRaster(tw,   
                    th);   
            boolean alphaPremultiplied = cm.isAlphaPremultiplied();   
            target = new BufferedImage(cm, raster, alphaPremultiplied, null);   
        } else
            target = new BufferedImage(tw, th, type)
View Full Code Here

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

        ColorModel cmt = getColorModel(transparency);
        if (cmt == null) {
            throw new IllegalArgumentException("Transparency is not supported.");
        }

        return new BufferedImage(cmt, cmt.createCompatibleWritableRaster(width, height), false, null);
    }

    @Override
    public ColorModel getColorModel() {
        return cm;
View Full Code Here

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

      if (palette.isDirect) {
          // no alpha data?
          if(data.alphaData==null) {
              colorModel = new DirectColorModel(32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000);              
              BufferedImage bufferedImage = new BufferedImage(colorModel,
                      colorModel.createCompatibleWritableRaster(data.width, data.height),
                      false, null);              
              WritableRaster raster = bufferedImage.getRaster();             
              int[] pixelArray = new int[4];
              for (int y = 0; y < data.height; y++) {
                  for (int x = 0; x < data.width; x++) {
View Full Code Here

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

         
          // image has alpha data, preserve it
          else {
              colorModel = new DirectColorModel(32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000);              
              BufferedImage bufferedImage = new BufferedImage(colorModel,
                      colorModel.createCompatibleWritableRaster(data.width, data.height),
                      false, null);              
              WritableRaster raster = bufferedImage.getRaster();             
              int[] pixelArray = new int[4];
              for (int y = 0; y < data.height; y++) {
                  for (int x = 0; x < data.width; x++) {
View Full Code Here

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

        } else {
          colorModel = new IndexColorModel(data.depth, rgbs.length, red,
              green, blue);
        }
        BufferedImage bufferedImage = new BufferedImage(colorModel,
            colorModel.createCompatibleWritableRaster(data.width,
                data.height), false, null);
        WritableRaster raster = bufferedImage.getRaster();
        int[] pixelArray = new int[1];
        for (int y = 0; y < data.height; y++) {
          for (int x = 0; x < data.width; x++) {
View Full Code Here

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

        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

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

            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<String, Object> properties = new Hashtable<String, Object>();
            String[] keys = img.getPropertyNames();
            if (keys!=null) {
                for (String key : keys) {
View Full Code Here

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

     *   of <code>image</code>
     */
    public static BufferedImage createColorModelCompatibleImage(BufferedImage image) {
        ColorModel cm = image.getColorModel();
        return new BufferedImage(cm,
            cm.createCompatibleWritableRaster(image.getWidth(),
                                              image.getHeight()),
            cm.isAlphaPremultiplied(), null);
    }

    /**
 
View Full Code Here

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

        else
        {
            byte[] map = new byte[] { (byte) 0x00, (byte) 0xFF };
            colorModel = new IndexColorModel(1, map.length, map, map, map, Transparency.OPAQUE);
        }
        WritableRaster raster = colorModel.createCompatibleWritableRaster(cols, rows);
        DataBufferByte buffer = (DataBufferByte) raster.getDataBuffer();
        bufferData = buffer.getData();
        IOUtils.populateBuffer(stream.getUnfilteredStream(), bufferData);
        BufferedImage image = new BufferedImage(colorModel, raster, false, null);
        if (!blackIsOne)
View Full Code Here

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
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.