Examples of PixelInterleavedSampleModel


Examples of java.awt.image.PixelInterleavedSampleModel

                    && !cm.hasAlpha()) {
                Raster raster = image.getTile(0, 0);
                DataBuffer buffer = raster.getDataBuffer();
                SampleModel sampleModel = raster.getSampleModel();
                if (sampleModel instanceof PixelInterleavedSampleModel) {
                    PixelInterleavedSampleModel piSampleModel;
                    piSampleModel = (PixelInterleavedSampleModel)sampleModel;
                    int[] offsets = piSampleModel.getBandOffsets();
                    for (int i = 0; i < offsets.length; i++) {
                        if (offsets[i] != i && offsets[i] != offsets.length - 1 - i) {
                            //Don't encode directly as samples are not next to each other
                            //i.e. offsets are not 012 (RGB) or 0123 (CMYK)
                            // let also pass 210 BGR and 3210 (KYMC); 3210 will be skipped below
View Full Code Here

Examples of java.awt.image.PixelInterleavedSampleModel

            ColorModel cm = new ComponentColorModel(
                    ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB),
                    new int[] {8, 8, 8},
                    false, false,
                    ColorModel.OPAQUE, DataBuffer.TYPE_BYTE);
            SampleModel sampleModel = new PixelInterleavedSampleModel(
                    DataBuffer.TYPE_BYTE, w, h, 3, w * 3, new int[] {0, 1, 2});
            DataBuffer dbuf = new DataBufferByte(raw, w * h * 3);

            WritableRaster raster = Raster.createWritableRaster(sampleModel,
                    dbuf, null);
View Full Code Here

Examples of java.awt.image.PixelInterleavedSampleModel

                    new int[] {8, 8, 8},
                    false, false,
                    ColorModel.OPAQUE, DataBuffer.TYPE_BYTE);
            int imgw = fopimage.getWidth();
            int imgh = fopimage.getHeight();
            SampleModel sampleModel = new PixelInterleavedSampleModel(
                    DataBuffer.TYPE_BYTE, imgw, imgh, 3, imgw * 3, new int[] {0, 1, 2});
            DataBuffer dbuf = new DataBufferByte(imgmap, imgw * imgh * 3);

            WritableRaster raster = Raster.createWritableRaster(sampleModel,
                    dbuf, null);
View Full Code Here

Examples of java.awt.image.PixelInterleavedSampleModel

        ColorModel cm = new ComponentColorModel(
                ColorSpace.getInstance(ColorSpace.CS_sRGB),
                new int[] {8, 8, 8},
                false, false,
                ColorModel.OPAQUE, DataBuffer.TYPE_BYTE);
        SampleModel sampleModel = new PixelInterleavedSampleModel(
                DataBuffer.TYPE_BYTE, image.getWidth(), image.getHeight(), 3, image.getWidth() * 3,
                new int[] {0, 1, 2});
        DataBuffer dbuf = new DataBufferByte(image.getBitmaps(),
                image.getWidth() * image.getHeight() * 3);

 
View Full Code Here

Examples of java.awt.image.PixelInterleavedSampleModel

        (int dataType, int tileWidth, int tileHeight, int bands) {
        int [] bandOffsets = new int[bands];
        for (int i = 0; i < bands; i++) {
            bandOffsets[i] = i;
        }
        return new PixelInterleavedSampleModel
            (dataType, tileWidth, tileHeight, bands,
             tileWidth * bands, bandOffsets);
    }
View Full Code Here

Examples of java.awt.image.PixelInterleavedSampleModel

                // band offsets.
                int[] reverseOffsets = new int[numBands];
                for (int i = 0; i < numBands; i++) {
                    reverseOffsets[i] = numBands - 1 - i;
                }
                sampleModel = new PixelInterleavedSampleModel
                    (dataType, tileWidth, tileHeight,
                     numBands, numBands * tileWidth, reverseOffsets);

                if (imageType == TYPE_GRAY) {
                  colorModel = new ComponentColorModel
                    (ColorSpace.getInstance(ColorSpace.CS_GRAY),
                     new int[] {sampleSize}, false, false,
                     Transparency.OPAQUE, dataType);
                } else if (imageType == TYPE_RGB) {
                  colorModel = new ComponentColorModel
                    (ColorSpace.getInstance(ColorSpace.CS_sRGB),
                     new int[] {sampleSize, sampleSize, sampleSize},
                     false, false, Transparency.OPAQUE, dataType);
                } else { // hasAlpha
                    // Transparency.OPAQUE signifies image data that is
                    // completely opaque, meaning that all pixels have an alpha
                    // value of 1.0. So the extra band gets ignored, which is
                    // what we want.
                    int transparency = Transparency.OPAQUE;
                    if (extraSamples == 1) { // associated (premultiplied) alpha
                        transparency = Transparency.TRANSLUCENT;
                    } else if (extraSamples == 2) { // unassociated alpha
                        transparency = Transparency.BITMASK;
                    }

                    colorModel =
                        createAlphaComponentColorModel(dataType,
                                                       numBands,
                                                       extraSamples == 1,
                                                       transparency);
                }
                break;

            case TYPE_GENERIC:
            case TYPE_YCBCR_SUB:
                // For this case we can't display the image, so we create a
                // SampleModel with increasing bandOffsets, and keep the
                // ColorModel as null, as there is no appropriate ColorModel.

                int[] bandOffsets = new int[numBands];
                for (int i = 0; i < numBands; i++) {
                    bandOffsets[i] = i;
                }

                sampleModel = new PixelInterleavedSampleModel
                    (dataType, tileWidth, tileHeight,
                     numBands, numBands * tileWidth, bandOffsets);
                colorModel = null;
                break;

View Full Code Here

Examples of java.awt.image.PixelInterleavedSampleModel

                new TIFFImageEncoder(ostream, params);
            int bands = sppsm.getNumBands();
            int [] off = new int[bands];
            for (int i=0; i<bands; i++)
                off[i] = i;
            SampleModel sm = new PixelInterleavedSampleModel
                (DataBuffer.TYPE_BYTE, w, h, bands, w*bands, off);
           
            RenderedImage rimg = new FormatRed(GraphicsUtil.wrap(img), sm);
            tiffEncoder.encode(rimg);
        } catch (IOException ex) {
View Full Code Here

Examples of java.awt.image.PixelInterleavedSampleModel

                new TIFFImageEncoder(ostream, params);
            int bands = sppsm.getNumBands();
            int [] off = new int[bands];
            for (int i=0; i<bands; i++)
                off[i] = i;
            SampleModel sm = new PixelInterleavedSampleModel
                (DataBuffer.TYPE_BYTE, w, h, bands, w*bands, off);
           
            RenderedImage rimg = new FormatRed(GraphicsUtil.wrap(img), sm);
            tiffEncoder.encode(rimg);
        } catch (IOException ex) {
View Full Code Here

Examples of java.awt.image.PixelInterleavedSampleModel

  implements Testlet
{
  public void test(TestHarness h)
  {
    SampleModel sm;
    PixelInterleavedSampleModel psm, sub;
    int[] subBands;

    psm = new PixelInterleavedSampleModel(DataBuffer.TYPE_BYTE,
                                          5, 2, 4, 20,
                                          new int[] { 3, 0, 1 });
    sm = psm.createSubsetSampleModel(new int[] { 0, 2 });

    // Check #1.
    if (sm instanceof PixelInterleavedSampleModel)
      {
        h.check(true);
View Full Code Here

Examples of java.awt.image.PixelInterleavedSampleModel

      harness.check(dst.getDataBuffer().getDataType(), DataBuffer.TYPE_BYTE);
      harness.check(dst.getNumDataElements(), cs2.getNumComponents());
      harness.check(dst.getSampleModel() instanceof PixelInterleavedSampleModel);
      harness.check(dst.getDataBuffer() instanceof DataBufferByte);
     
      PixelInterleavedSampleModel sm = (PixelInterleavedSampleModel)dst.getSampleModel();

      harness.check(sm.getPixelStride(), cs2.getNumComponents());
      harness.check(sm.getScanlineStride(), cs2.getNumComponents() * src.getWidth());
      int[] expected = new int[cs2.getNumComponents()];
     
      for (int i = 0; i < expected.length; i++)
        expected[i] = i;
      harness.check(Arrays.equals(sm.getBandOffsets(), expected));
     
      harness.check(dst.getDataBuffer().getNumBanks(), 1);
      harness.check(dst.getDataBuffer().getOffset(), 0);
      harness.check(dst.getDataBuffer().getSize(), src.getHeight() * src.getWidth() * cs2.getNumComponents());
     
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.