Package java.awt.image

Examples of java.awt.image.SampleModel


            // byte colorMaps only
            return null;
        }

        // Check source compatibility.
        SampleModel sourceSM = source.getSampleModel();
        if(sourceSM.getDataType() != DataBuffer.TYPE_BYTE) {
            // byte source images only
            return null;
        } else if(sourceSM.getNumBands() != colorMap.getNumBands()) {
            // band counts must match
            return null;
        }

        // Get ImageLayout from RenderingHints if any.
        ImageLayout layoutHint = RIFUtil.getImageLayoutHint(hints);

        // Calculate the final ImageLayout.
        ImageLayout layout =
            MlibOrderedDitherOpImage.layoutHelper(layoutHint,
                                                  source, colorMap);

        // Check for source and destination compatibility. The ColorModel
        // is suppressed in the second test because it will be an
        // IndexColorModel which would cause the test to fail.
        SampleModel destSM = layout.getSampleModel(null);
        if (!MediaLibAccessor.isMediaLibCompatible(args) ||
            (!MediaLibAccessor.isMediaLibCompatible(destSM, null) &&
             !ImageUtil.isBinary(destSM))) {
            return null;
        }
View Full Code Here


        // Get sources.
        Vector sources = paramBlock.getSources();

        // Get target SampleModel.
        SampleModel targetSM = null;
        if(sources.size() > 0) {
            targetSM = ((RenderedImage)sources.get(0)).getSampleModel();
        } else if(layout != null &&
                  layout.isValid(ImageLayout.SAMPLE_MODEL_MASK)) {
            targetSM = layout.getSampleModel(null);
        }

        if(targetSM != null) {
            // Return if target data type is floating point. Other more
            // extensive type checking is done in MosaicOpImage constructor.
            int dataType = targetSM.getDataType();
            if(dataType == DataBuffer.TYPE_FLOAT ||
               dataType == DataBuffer.TYPE_DOUBLE) {
                return null;
            }
        }
View Full Code Here

            // NOTE: this depends on JDK ordering
            destDataType = typei > destDataType ? typei : destDataType;
        }

        SampleModel sm = layout.getSampleModel((RenderedImage)sources.get(0));

        if ( sm.getNumBands() < destNumBands ) {
            int[] destOffsets = new int[destNumBands];

            for(int i=0; i < destNumBands; i++) {
                destOffsets[i] = i;
            }

            // determine the proper width and height to use
            int destTileWidth = sm.getWidth();
            int destTileHeight = sm.getHeight();
            if(layout.isValid(ImageLayout.TILE_WIDTH_MASK))
            {
                destTileWidth =
                    layout.getTileWidth((RenderedImage)sources.get(0));
            }
View Full Code Here

        // Handle the special case of multiplying each band of an N-band
        // image by a 1-band image if the SampleModel.
        int numBandsDst;
        if(layout != null && layout.isValid(ImageLayout.SAMPLE_MODEL_MASK)) {
            SampleModel sm = layout.getSampleModel(null);
            numBandsDst = sm.getNumBands();

            // One of the sources must be single-banded and the other must
            // have at most the number of bands in the SampleModel hint.
            if(numBandsDst > 1 &&
               ((numBands1 == 1 && numBands2 > 1) ||
View Full Code Here

        }

  boolean isDataTypeChange = false;

        // Get prospective destination SampleModel.
        SampleModel sampleModel = layout.getSampleModel(src);

        // Create a new SampleModel if the type is not as desired.
        if (sampleModel.getDataType() != type) {
            int tileWidth = layout.getTileWidth(src);
            int tileHeight = layout.getTileHeight(src);
            int numBands = src.getSampleModel().getNumBands();

            SampleModel csm =
                RasterFactory.createComponentSampleModel(sampleModel,
                                                         type,
                                                         tileWidth,
                                                         tileHeight,
                                                         numBands);
View Full Code Here

        KernelJAI unRotatedKernel =
            (KernelJAI)paramBlock.getObjectParameter(0);
        KernelJAI kJAI = unRotatedKernel.getRotatedKernel();

  RenderedImage source = paramBlock.getRenderedSource(0);
  SampleModel sm = source.getSampleModel();

  // check dataType and binary
        int dataType = sm.getDataType();

        boolean isBinary = (sm instanceof MultiPixelPackedSampleModel) &&
            (sm.getSampleSize(0) == 1) &&
            (dataType == DataBuffer.TYPE_BYTE ||
             dataType == DataBuffer.TYPE_USHORT ||
             dataType == DataBuffer.TYPE_INT);

  // possible speed up later: 3x3 with table lookup
View Full Code Here

  if (source == null){
      throw new IllegalArgumentException(JaiI18N.getString("SerializableRenderedImage0"));
  }

  SampleModel sm = source.getSampleModel();
        if (sm != null &&
      SerializerFactory.getSerializer(sm.getClass()) == null) {
            throw new IllegalArgumentException(JaiI18N.getString("SerializableRenderedImage2"));
        }

  ColorModel cm = source.getColorModel();
        if (cm != null &&
View Full Code Here

        }

        Rectangle region;
        if(dest == null) {
            region = imageBounds;
            SampleModel destSM =
                getSampleModel().createCompatibleSampleModel(region.width,
                                                             region.height);
            dest = Raster.createWritableRaster(destSM,
                                               new Point(region.x,
                                                         region.y));
View Full Code Here

        // Handle the special case of subtracting from each band of an N-band
        // image a single-band image.
        int numBandsDst;
        if(layout != null && layout.isValid(ImageLayout.SAMPLE_MODEL_MASK)) {
            SampleModel sm = layout.getSampleModel(null);
            numBandsDst = sm.getNumBands();

            // The second source must be single-banded and the first must
            // be multi-banded.
            if(numBandsDst > 1 &&
               ((numBands1 > 1 && numBands2 == 1) ||
View Full Code Here

        ROI roi= (ROI)paramBlock.getObjectParameter(3);
        int xPeriod = paramBlock.getIntParameter(4);
        int yPeriod = paramBlock.getIntParameter(5);

        // check if 3-band byte-type image
  SampleModel sm = source.getSampleModel();
        if (sm.getNumBands() != && sm.getDataType() == DataBuffer.TYPE_BYTE)
            throw new IllegalArgumentException("ColorQuantizerRIF0");

        if (algorithm.equals(ColorQuantizerDescriptor.NEUQUANT))
            return new NeuQuantOpImage(source, (Map)renderHints, layout,
                                        maxColorNum, upperBound, roi,
View Full Code Here

TOP

Related Classes of java.awt.image.SampleModel

Copyright © 2018 www.massapicom. 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.