Package java.awt.image

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


        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);
        javax.media.jai.ParameterBlockJAI pb = new javax.media.jai.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

        // Attempt to derive compatible SampleModel/ColorModel combination.
        if(cm != null && (sm == null ||
                          !JDKWorkarounds.areCompatibleDataModels(sm, cm))) {
            // If the ColorModel is non-null and the SampleModel is null
            // or incompatible then create a new SampleModel.
            sm = cm.createCompatibleSampleModel(tileWidth, tileHeight);
        } else if(cm == null && sm != null) {
            // If the ColorModel is null but the SampleModel is not,
            // try to guess a reasonable ColorModel.
            cm = PlanarImage.createColorModel(sm);
View Full Code Here

                        // Set the ColorModel to that desired.
                        il.setColorModel(cmLayout);

                        // Derive a new SampleModel from the desired ColorModel
                        SampleModel derivedSM =
                            cmLayout.createCompatibleSampleModel(
                                il.getTileWidth(null),
                                il.getTileHeight(null));

                        // Set the SampleModel to that derived from the CM.
                        il.setSampleModel(derivedSM);
View Full Code Here

              cmSource.getNumComponents());

          SampleModel newSM;
          if (newCM != null) {
        newSM =
            newCM.createCompatibleSampleModel(
                   il.getTileWidth(null),
                   il.getTileHeight(null));
          } else {
        newSM =
            RasterFactory.createPixelInterleavedSampleModel(
View Full Code Here

    cm = PlanarImage.getDefaultColorModel(srcSM.getDataType(),
                  icm.getNumComponents());
   
    SampleModel newSM;
    if (cm != null) {
        newSM = cm.createCompatibleSampleModel(srcSM.getWidth(),
                 srcSM.getHeight());
    } else {
        newSM = RasterFactory.createPixelInterleavedSampleModel(
                  srcSM.getDataType(),
                  srcSM.getWidth(),
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

            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

        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

                (cs, 24, 0x00FF0000, 0x0000FF00, 0x000000FF, 0x0,
                 false, DataBuffer.TYPE_INT);

        int tileSize = AbstractTiledRed.getDefaultTileSize();
        init((CachableRed)null, devRect, cm,
             cm.createCompatibleSampleModel(tileSize, tileSize),
             0, 0, null);
    }

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