Package java.awt.image

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


        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


        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

        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

            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

        ColorModel cm = new ComponentColorModel (ColorSpace.getInstance(ColorSpace.CS_sRGB),
                                                 new int[] {8,8,8}, false, false,
                                                 Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
        layout.setColorModel(cm);
        layout.setSampleModel(cm.createCompatibleSampleModel(oRenderedImg.getWidth(),oRenderedImg.getHeight()));
        RenderingHints hints = new RenderingHints(javax.media.jai.JAI.KEY_IMAGE_LAYOUT, layout);
        ParameterBlockJAI pb = new ParameterBlockJAI( "format" );
        pb.addSource( oRenderedImg );
        oRenderedImg = javax.media.jai.JAI.create( "format", pb, hints );
      } catch (IllegalArgumentException iae) {
View Full Code Here

            // Create a raster which can contain the entire source.
            Point origin = new Point(im.getMinX(), im.getMinY());
            WritableRaster raster =
                Raster.createWritableRaster(
                    destCM.createCompatibleSampleModel(im.getWidth(),
                                                       im.getHeight()),
                    origin);

            // Copy the source data.
            raster.setRect(im.getData());
View Full Code Here

    public static PlanarImage generalColorConvert(PlanarImage src) {
        ColorSpace sRGBColorSpace = ColorSpace.getInstance(ColorSpace.CS_sRGB);
        ColorModel sRGBColorModel = RasterFactory.createComponentColorModel(DataBuffer.TYPE_BYTE, sRGBColorSpace,
                                                                            false, false, Transparency.OPAQUE);
        ImageLayout rgbImageLayout = new ImageLayout();
        rgbImageLayout.setSampleModel(sRGBColorModel.createCompatibleSampleModel(src.getWidth(), src.getHeight()));
        RenderingHints rgbHints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, rgbImageLayout);
        rgbHints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
        ParameterBlockJAI pb = new ParameterBlockJAI("colorconvert");
        pb.addSource(src);
        pb.setParameter("colormodel", sRGBColorModel);
View Full Code Here

            // -- Convert CMYK to RGB
            ColorSpace rgbColorSpace = ColorSpace.getInstance(ColorSpace.CS_sRGB);
            ColorModel rgbColorModel = RasterFactory.createComponentColorModel(DataBuffer.TYPE_BYTE, rgbColorSpace,
                                                                               false, true, Transparency.OPAQUE);
            ImageLayout rgbImageLayout = new ImageLayout();
            rgbImageLayout.setSampleModel(rgbColorModel.createCompatibleSampleModel(src.getWidth(), src.getHeight()));
            RenderingHints rgbHints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, rgbImageLayout);
            rgbHints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
            ParameterBlockJAI pb = new ParameterBlockJAI("colorconvert");
            pb.addSource(src);
            pb.setParameter("colormodel", rgbColorModel);
View Full Code Here

            // -- Convert CMYK to RGB
            ColorSpace rgbColorSpace = ColorSpace.getInstance(ColorSpace.CS_sRGB);
            ColorModel rgbColorModel = RasterFactory.createComponentColorModel(DataBuffer.TYPE_BYTE, rgbColorSpace,
                                                                               false, true, Transparency.OPAQUE);
            ImageLayout rgbImageLayout = new ImageLayout();
            rgbImageLayout.setSampleModel(rgbColorModel.createCompatibleSampleModel(op.getWidth(), op.getHeight()));
            RenderingHints rgbHints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, rgbImageLayout);
            rgbHints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
            pb = new ParameterBlockJAI("colorconvert");
            pb.addSource(op);
            pb.setParameter("colormodel", rgbColorModel);
View Full Code Here

            il.setColorModel(cmRGB);

            RenderingHints rh = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, il);

            il.setSampleModel(cmRGB.createCompatibleSampleModel(src.getTileWidth(), src.getTileHeight()));
            pb = new ParameterBlock();
            pb.addSource(src);
            src = JAI.create("format", pb, rh);
        }
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.