Package java.awt.image

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


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

                    final int alphaMask, final int transferType,
                    final boolean isAlphaPremultiplied) {
        final ColorModel model = new DirectColorModel(colorSpace, 32, redMask,
                        greenMask, blueMask, alphaMask, isAlphaPremultiplied,
                        transferType);
        return new ImageTypeSpecifier(model, model.createCompatibleSampleModel(
            1, 1));
    }

    public static ImageTypeSpecifier createInterleaved(ColorSpace colorSpace,
                                                       int[] bandOffsets,
View Full Code Here

                    final int alphaMask, final int transferType,
                    final boolean isAlphaPremultiplied) {
        final ColorModel model = new DirectColorModel(colorSpace, 32, redMask,
                        greenMask, blueMask, alphaMask, isAlphaPremultiplied,
                        transferType);
        return new ImageTypeSpecifier(model, model.createCompatibleSampleModel(
            1, 1));
    }

    public static ImageTypeSpecifier createInterleaved(ColorSpace colorSpace,
                                                       int[] bandOffsets,
View Full Code Here

            numBits[1] = bits;
        }
        int transparency = hasAlpha ? Transparency.TRANSLUCENT : Transparency.OPAQUE;
        ColorModel model = new ComponentColorModel(colorSpace, numBits, hasAlpha, isAlphaPremultiplied, transparency, dataType);

        return new ImageTypeSpecifier(model, model.createCompatibleSampleModel(1, 1));
    }


    public static ImageTypeSpecifier createIndexed(byte[] redLUT,
                                                   byte[] greenLUT,
View Full Code Here

           model = new IndexColorModel(bits, size, redLUT, greenLUT, blueLUT);
       } else {
           model = new IndexColorModel(bits, size, redLUT, greenLUT, blueLUT, alphaLUT);
       }
      
       return new ImageTypeSpecifier(model, model.createCompatibleSampleModel(1, 1));
    }

    public static ImageTypeSpecifier createFromBufferedImageType(int bufferedImageType) {
        switch (bufferedImageType) {
        case BufferedImage.TYPE_INT_RGB :
View Full Code Here

                    final int alphaMask, final int transferType,
                    final boolean isAlphaPremultiplied) {
        final ColorModel model = new DirectColorModel(colorSpace, 32, redMask,
                        greenMask, blueMask, alphaMask, isAlphaPremultiplied,
                        transferType);
        return new ImageTypeSpecifier(model, model.createCompatibleSampleModel(
            1, 1));
    }

    public static ImageTypeSpecifier createInterleaved(ColorSpace colorSpace,
                                                       int[] bandOffsets,
View Full Code Here

        
        ColorModel cm = RasterFactory.createComponentColorModel(
          DataBuffer.TYPE_BYTE, cs, false, false,
          Transparency.OPAQUE);
        
        SampleModel sm = cm.createCompatibleSampleModel(srcImg.getWidth(), srcImg.getHeight());
        
        ImageLayout imageLayout = new ImageLayout();
        imageLayout.setSampleModel(sm);
        imageLayout.setColorModel(cm);
        
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.