Package java.awt.image

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


            tw = 1;
            th = 1;
        }

        // fix my sample model so it makes sense given my size.
        SampleModel sm = cm.createCompatibleSampleModel(tw, th);

        // Finish initializing our base class...
        init((CachableRed)null, bounds, cm, sm, tgX, tgY, null);
    }
View Full Code Here


            cm = GraphicsUtil.Linear_sRGB_Pre;
        else
            cm = GraphicsUtil.sRGB_Pre;

        SampleModel sm =
            cm.createCompatibleSampleModel(litRegion.width,
                                           litRegion.height);
                                            
        init((CachableRed)null, litRegion, cm, sm,
             litRegion.x, litRegion.y, null);
    }
View Full Code Here

        if (tw > defSz) tw = defSz;
        int th = bounds.height;
        if (th > defSz) th = defSz;

        // fix my sample model so it makes sense given my size.
        SampleModel sm = cm.createCompatibleSampleModel(tw, th);

        // Finish initializing our base class...
        init((CachableRed)null, bounds, cm, sm, 0, 0, null);

        raster = Raster.createWritableRaster(sm, new Point(0, 0));
View Full Code Here

        SampleModel sm = src.getSampleModel();
        int tw = sm.getWidth();
        int th = sm.getHeight();
        if (tw > myBounds.widthtw = myBounds.width;
        if (th > myBounds.height) th = myBounds.height;
        sm = cm.createCompatibleSampleModel(tw, th);

        init(src, myBounds, cm, sm,
             src.getTileGridXOffset()+xinset,
             src.getTileGridYOffset()+yinset, null);
View Full Code Here

        int tw = litRegion.width;
        int th = litRegion.height;
        int defSz = AbstractTiledRed.getDefaultTileSize();
        if (tw > defSz) tw = defSz;
        if (th > defSz) th = defSz;
        SampleModel sm = cm.createCompatibleSampleModel(tw, th);
                                            
        init((CachableRed)null, litRegion, cm, sm,
             litRegion.x, litRegion.y, null);
    }
View Full Code Here

        super();
        ColorModel  cm = cr.getColorModel();
        Rectangle bounds = cr.getBounds();
        if (tileWidth  > bounds.widthtileWidth  = bounds.width;
        if (tileHeight > bounds.height) tileHeight = bounds.height;
        SampleModel sm = cm.createCompatibleSampleModel(tileWidth, tileHeight);
        init(cr, cr.getBounds(), cm, sm,
             cr.getTileGridXOffset(), cr.getTileGridYOffset(),
             null);
    }
View Full Code Here

            else
                cm = GraphicsUtil.sRGB_Unpre;
        }

        SampleModel sm =
            cm.createCompatibleSampleModel(src.getWidth(),
                                           src.getHeight());

        init(src, src.getBounds(), cm, sm,
             src.getTileGridXOffset(), src.getTileGridYOffset(), null);
    }
View Full Code Here

     */
    public static BufferedImage intensityArrayToBufferedImage(byte[] array, int w, int h){
    ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
        int[] nBits = {8};
        ColorModel cm = new ComponentColorModel(cs, nBits, false, true, Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
        SampleModel sm = cm.createCompatibleSampleModel(w, h);
        DataBufferByte db = new DataBufferByte(array, w*h);
        WritableRaster raster = Raster.createWritableRaster(sm, db, null);
        BufferedImage bm = new BufferedImage(cm, raster, false, null);
    return bm;
  }
View Full Code Here

        super();
        ColorModel  cm = cr.getColorModel();
        Rectangle bounds = cr.getBounds();
        if (tileWidth  > bounds.widthtileWidth  = bounds.width;
        if (tileHeight > bounds.height) tileHeight = bounds.height;
        SampleModel sm = cm.createCompatibleSampleModel(tileWidth, tileHeight);
        init(cr, cr.getBounds(), cm, sm, 0, 0, null);
    }

    public void genRect(WritableRaster wr) {
        // Get my source.
View Full Code Here

        if (tw > defSz) tw = defSz;
        int th = bounds.height;
        if (th > defSz) th = defSz;

        // fix my sample model so it makes sense given my size.
        SampleModel sm = cm.createCompatibleSampleModel(tw, th);

        // Finish initializing our base class...
        init((CachableRed)null, bounds, cm, sm, 0, 0, null);

        raster = Raster.createWritableRaster(sm, new Point(0, 0));
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.