Examples of ShortInterleavedRaster


Examples of sun.awt.image.ShortInterleavedRaster

        // System.out.println("RGBColorSelectionMaskOpImage - L:" + L + ", a:" + a + ", b: " + b + ", radius: " + colorSelection.radius);
    }

    protected void computeRect(Raster[] sources, WritableRaster dest, Rectangle destRect) {
        ShortInterleavedRaster src = (ShortInterleavedRaster) sources[0];
        ByteInterleavedRaster dst = (ByteInterleavedRaster) dest;

        dst = (ByteInterleavedRaster) dst.createChild(destRect.x, destRect.y, destRect.width, destRect.height,
                                                      destRect.x, destRect.y, null);

        int width = dst.getWidth();
        int height = dst.getHeight();

        byte dstData[] = dst.getDataStorage();
        int dstBandOffsets[] = dst.getDataOffsets();
        int dstLineStride = dst.getScanlineStride();
        // int dstPixelStride = dst.getPixelStride();

        short srcData[] = src.getDataStorage();
        int srcBandOffsets[] = src.getDataOffsets();
        int srcLineStride = src.getScanlineStride();
        // int srcPixelStride = src.getPixelStride();

        int dstOffset = dstBandOffsets[0];

        float colorSelectionArray[] = {
View Full Code Here

Examples of sun.awt.image.ShortInterleavedRaster

        super(source, createLayout(source), config, true);
        this.colorSelection = colorSelection;
    }

    protected void computeRect(Raster[] sources, WritableRaster dest, Rectangle destRect) {
        ShortInterleavedRaster src = (ShortInterleavedRaster) sources[0];
        ByteInterleavedRaster dst = (ByteInterleavedRaster) dest;

        dst = (ByteInterleavedRaster) dst.createChild(destRect.x, destRect.y, destRect.width, destRect.height,
                                                      destRect.x, destRect.y, null);

        int width = dst.getWidth();
        int height = dst.getHeight();

        byte dstData[] = dst.getDataStorage();
        int dstBandOffsets[] = dst.getDataOffsets();
        int dstLineStride = dst.getScanlineStride();
        // int dstPixelStride = dst.getPixelStride();

        short srcData[] = src.getDataStorage();
        int srcBandOffsets[] = src.getDataOffsets();
        int srcLineStride = src.getScanlineStride();
        // int srcPixelStride = src.getPixelStride();

        int dstOffset = dstBandOffsets[0];

        float colorSelectionArray[] = {
View Full Code Here

Examples of sun.awt.image.ShortInterleavedRaster

            );
        final WritableRaster outBuffer;
        if (dataType == DataBuffer.TYPE_BYTE)
            outBuffer = new ByteInterleavedRaster(sm, new Point(0, 0));
        else
            outBuffer = new ShortInterleavedRaster(sm, new Point(0, 0));

        int stripIndex = 0;
        for ( int y = 0; y < imageHeight; y += stripHeight ) {
            if ( thread != null && thread.isCanceled() )
                return;

            final int currentStripHeight = Math.min( stripHeight, imageHeight - y );

            // Create a child raster of the out buffer for the current strip
            final WritableRaster raster = outBuffer.createWritableChild(0, 0, imageWidth, currentStripHeight, 0, y, null);

            // Prefetch tiles, uses all CPUs
            if (image instanceof PlanarImage)
                ((PlanarImage) image).getTiles(((PlanarImage) image).getTileIndices(raster.getBounds()));

            image.copyData(raster);

            int offset;
            if (raster instanceof ByteInterleavedRaster) {
                final ByteInterleavedRaster interleaved =
                    (ByteInterleavedRaster) raster;

                final int[] offsets = interleaved.getDataOffsets();
                offset = offsets[0];
                for (int i = 1; i < offsets.length; i++)
                    offset = Math.min(offset, offsets[i]);

                final DataBufferByte db = (DataBufferByte)raster.getDataBuffer();

                final int written = writeStripByte( stripIndex, db.getData(), offset, bands * imageWidth * currentStripHeight );

                if ( written != bands * imageWidth * currentStripHeight )
                    throw new LCImageLibException(
                        "something is wrong: " + written + " != " +
                        (bands * imageWidth * currentStripHeight)
                    );
            } else {
                final ShortInterleavedRaster interleaved =
                    (ShortInterleavedRaster) raster;

                final int[] offsets = interleaved.getDataOffsets();
                offset = offsets[0];
                for (int i = 1; i < offsets.length; i++)
                    offset = Math.min(offset, offsets[i]);

                final DataBufferUShort db = (DataBufferUShort) raster.getDataBuffer();
View Full Code Here

Examples of sun.awt.image.ShortInterleavedRaster

                                                                                raster.getHeight(),
                                                                                bands, bands * raster.getWidth(),
                                                                                bands == 1
                                                                                ? new int[] {0}
                                                                                : new int[] {0, 1, 2});
            ShortInterleavedRaster newRaster = new ShortInterleavedRaster(newSM, new Point(raster.getMinX(),
                                                                                           raster.getMinY()));

            Functions.copyData(newRaster, raster);
            raster = newRaster;
        }
View Full Code Here

Examples of sun.awt.image.ShortInterleavedRaster

            Profile cmsOutProfile = new Profile(outProfile);
            Profile cmsInProfile = new Profile(inProfile);

            BufferedImage inputImage = ImageIO.read(new File("/Stuff/Reference/small-q60-adobergb.TIF"));
            ShortInterleavedRaster inputRaster = (ShortInterleavedRaster) inputImage.getTile(0, 0);

            ColorSpace outCS = new ICC_ColorSpace(outProfile);
            ColorModel outCM = new ComponentColorModel(outCS, false, false,
                                                       Transparency.OPAQUE, DataBuffer.TYPE_USHORT);
            ShortInterleavedRaster outputRaster =
                    (ShortInterleavedRaster) outCM.createCompatibleWritableRaster(inputImage.getWidth(),
                                                                                  inputImage.getHeight());
            BufferedImage outputImage = new BufferedImage(outCM, outputRaster, false, null);

            Transform cmsTransform = new Transform(cmsInProfile, TYPE_RGB_16,
View Full Code Here

Examples of sun.awt.image.ShortInterleavedRaster

            cmsDoTransform(cmsTransform.handle, input, output, 1);
        }

        public void doTransform(ShortInterleavedRaster input, ShortInterleavedRaster output) {
            if (cmsTransform != null) {
                ShortInterleavedRaster ri = normalizeRaster(input);
                ShortInterleavedRaster ro;
                int outBands = output.getNumBands();
                if (!input.getBounds().equals(output.getBounds())) {
                    int[] offsets = outBands == 1 ? new int[] {0} : new int[] {0, 1, 2};
                    SampleModel sm = new PixelInterleavedSampleModel(DataBuffer.TYPE_USHORT,
                                                                     ri.getWidth(), ri.getHeight(),
                                                                     outBands, outBands * ri.getWidth(),
                                                                     offsets);
                    ro = new ShortInterleavedRaster(sm, new Point(ri.getMinX(), ri.getMinY()));
                } else
                    ro = normalizeRaster(output);
                int pixels = outBands == 1 ? ro.getDataStorage().length : ro.getDataStorage().length / outBands;
                cmsDoTransform(cmsTransform.handle, ri.getDataStorage(), ro.getDataStorage(), pixels);
                if (ro != output)
                    Functions.copyData(output, ro);
            }
        }
View Full Code Here

Examples of sun.awt.image.ShortInterleavedRaster

        switch(dataType) {
        case DataBuffer.TYPE_BYTE:
            return new ByteInterleavedRaster(sppsm, dataBuffer, location);

        case DataBuffer.TYPE_USHORT:
            return new ShortInterleavedRaster(sppsm, dataBuffer, location);

        case DataBuffer.TYPE_INT:
            return new IntegerInterleavedRaster(sppsm, dataBuffer, location);

        default:
View Full Code Here

Examples of sun.awt.image.ShortInterleavedRaster

            switch(dataType) {
                case DataBuffer.TYPE_BYTE:
                    return new ByteInterleavedRaster(sm, db, location);

                case DataBuffer.TYPE_USHORT:
                    return new ShortInterleavedRaster(sm, db, location);
            }
        } else if (sm instanceof SinglePixelPackedSampleModel) {
            switch(dataType) {
                case DataBuffer.TYPE_BYTE:
                    return new ByteInterleavedRaster(sm, db, location);

                case DataBuffer.TYPE_USHORT:
                    return new ShortInterleavedRaster(sm, db, location);

                case DataBuffer.TYPE_INT:
                    return new IntegerInterleavedRaster(sm, db, location);
            }
        } else if (sm instanceof MultiPixelPackedSampleModel &&
View Full Code Here

Examples of sun.awt.image.ShortInterleavedRaster

            switch(dataType) {
                case DataBuffer.TYPE_BYTE:
                    return new ByteInterleavedRaster(sm, db, location);

                case DataBuffer.TYPE_USHORT:
                    return new ShortInterleavedRaster(sm, db, location);
            }
        } else if (sm instanceof SinglePixelPackedSampleModel) {
            switch(dataType) {
                case DataBuffer.TYPE_BYTE:
                    return new ByteInterleavedRaster(sm, db, location);

                case DataBuffer.TYPE_USHORT:
                    return new ShortInterleavedRaster(sm, db, location);

                case DataBuffer.TYPE_INT:
                    return new IntegerInterleavedRaster(sm, db, location);
            }
        } else if (sm instanceof MultiPixelPackedSampleModel &&
View Full Code Here

Examples of sun.awt.image.ShortInterleavedRaster

        switch(dataType) {
        case DataBuffer.TYPE_BYTE:
            return new ByteInterleavedRaster(csm, dataBuffer, location);

        case DataBuffer.TYPE_USHORT:
            return new ShortInterleavedRaster(csm, dataBuffer, location);

        default:
            throw new IllegalArgumentException("Unsupported data type " +
                                                dataType);
        }
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.