Package com.lightcrafts.mediax.jai

Examples of com.lightcrafts.mediax.jai.UnpackedImageData


            }
        } else {
            int srcSampleType = accessor.sampleType == PixelAccessor.TYPE_BIT ?
                DataBuffer.TYPE_BYTE : accessor.sampleType;
            UnpackedImageData uid = accessor.getPixels(raster, rect,
                                                    srcSampleType, false);
            rect = uid.rect;
            int lineStride = uid.lineStride;
            int pixelStride = uid.pixelStride;

            switch(uid.type) {
            case DataBuffer.TYPE_BYTE:
                byte[][] bdata = uid.getByteData();
                for (int b = 0; b < accessor.numBands; b++) {
                    byte value = (byte)backgroundValues[b];
                    byte[] bd = bdata[b];
                    int lastLine = uid.bandOffsets[b] + rect.height * lineStride;

                    for (int lo = uid.bandOffsets[b]; lo < lastLine; lo += lineStride) {
                        int lastPixel = lo + rect.width * pixelStride;
                        for (int po = lo; po < lastPixel; po += pixelStride) {
                            bd[po] = value;
                        }
                    }
                }
                break;
            case DataBuffer.TYPE_USHORT:
            case DataBuffer.TYPE_SHORT:
                short[][] sdata = uid.getShortData();
                for (int b = 0; b < accessor.numBands; b++) {
                    short value = (short)backgroundValues[b];
                    short[] sd = sdata[b];
                    int lastLine = uid.bandOffsets[b] + rect.height * lineStride;

                    for (int lo = uid.bandOffsets[b]; lo < lastLine; lo += lineStride) {
                        int lastPixel = lo + rect.width * pixelStride;
                        for (int po = lo; po < lastPixel; po += pixelStride) {
                            sd[po] = value;
                        }
                    }
                }
                break;
            case DataBuffer.TYPE_INT:
                int[][] idata = uid.getIntData();
                for (int b = 0; b < accessor.numBands; b++) {
                    int value = (int)backgroundValues[b];
                    int[] id = idata[b];
                    int lastLine = uid.bandOffsets[b] + rect.height * lineStride;

                    for (int lo = uid.bandOffsets[b]; lo < lastLine; lo += lineStride) {
                        int lastPixel = lo + rect.width * pixelStride;
                        for (int po = lo; po < lastPixel; po += pixelStride) {
                            id[po] = value;
                        }
                    }
                }
                break;
            case DataBuffer.TYPE_FLOAT:
                float[][] fdata = uid.getFloatData();
                for (int b = 0; b < accessor.numBands; b++) {
                    float value = (float)backgroundValues[b];
                    float[] fd = fdata[b];
                    int lastLine = uid.bandOffsets[b] + rect.height * lineStride;

                    for (int lo = uid.bandOffsets[b]; lo < lastLine; lo += lineStride) {
                        int lastPixel = lo + rect.width * pixelStride;
                        for (int po = lo; po < lastPixel; po += pixelStride) {
                            fd[po] = value;
                        }
                    }
                }
                break;
            case DataBuffer.TYPE_DOUBLE:
                double[][] ddata = uid.getDoubleData();
                for (int b = 0; b < accessor.numBands; b++) {
                    double value = backgroundValues[b];
                    double[] dd = ddata[b];
                    int lastLine = uid.bandOffsets[b] + rect.height * lineStride;

 
View Full Code Here


        int dnbands     = dest.getNumBands();
        int destType    = dest.getTransferType();
        PixelAccessor d = new PixelAccessor(dest.getSampleModel(), null);

        UnpackedImageData dimd = d.getPixels(dest,
                                             destRect,    //liney,
                                             destType,
                                             true);

        byte[][] dstdata = (byte[][])dimd.data;

        for ( int sindex = 0, db = 0; sindex < nSrcs; sindex++ ) {

            UnpackedImageData simd =
                colorModels[sindex] instanceof IndexColorModel ?
                pas[sindex].getComponents(sources[sindex],
                                          destRect,
                                          sources[sindex].getSampleModel().getTransferType()) :
                pas[sindex].getPixels(sources[sindex],
View Full Code Here

        int dnbands     = dest.getNumBands();
        int destType    = dest.getTransferType();
        PixelAccessor d = new PixelAccessor(dest.getSampleModel(),null);

        UnpackedImageData dimd = d.getPixels(dest,
                                             destRect,    //liney,
                                             destType,
                                             true);

        short[][] dstdata = (short[][])dimd.data;

        for ( int sindex = 0, db = 0; sindex < nSrcs; sindex++ ) {

            UnpackedImageData simd =
                colorModels[sindex] instanceof IndexColorModel ?
                pas[sindex].getComponents(sources[sindex],
                                          destRect,
                                          sources[sindex].getSampleModel().getTransferType()) :
                pas[sindex].getPixels(sources[sindex],
View Full Code Here

        int dnbands     = dest.getNumBands();
        int destType    = dest.getTransferType();
        PixelAccessor d = new PixelAccessor(dest.getSampleModel(),null);

        UnpackedImageData dimd = d.getPixels(dest,
                                             destRect,    //liney,
                                             destType,
                                             true);

        int[][] dstdata = (int[][])dimd.data;

        for ( int sindex = 0, db = 0; sindex < nSrcs; sindex++ ) {

            UnpackedImageData simd =
                colorModels[sindex] instanceof IndexColorModel ?
                pas[sindex].getComponents(sources[sindex],
                                          destRect,
                                          sources[sindex].getSampleModel().getTransferType()) :
                pas[sindex].getPixels(sources[sindex],
View Full Code Here

        int dnbands     = dest.getNumBands();
        int destType    = dest.getTransferType();
        PixelAccessor d = new PixelAccessor(dest.getSampleModel(), null);

        UnpackedImageData dimd = d.getPixels(dest,
                                             destRect,    //liney,
                                             destType,
                                             true);

        float[][] dstdata = (float[][])dimd.data;

        for ( int sindex = 0, db = 0; sindex < nSrcs; sindex++ ) {

            UnpackedImageData simd =
                colorModels[sindex] instanceof IndexColorModel ?
                pas[sindex].getComponents(sources[sindex],
                                          destRect,
                                          sources[sindex].getSampleModel().getTransferType()) :
                pas[sindex].getPixels(sources[sindex],
View Full Code Here

        int dnbands     = dest.getNumBands();
        int destType    = dest.getTransferType();
        PixelAccessor d = new PixelAccessor(dest.getSampleModel(), null);

        UnpackedImageData dimd = d.getPixels(dest,
                                             destRect,    //liney,
                                             destType,
                                             true);

        double[][] dstdata = (double[][])dimd.data;

        for ( int sindex = 0, db = 0; sindex < nSrcs; sindex++ ) {

            UnpackedImageData simd =
                colorModels[sindex] instanceof IndexColorModel ?
                pas[sindex].getComponents(sources[sindex],
                                          destRect,
                                          sources[sindex].getSampleModel().getTransferType()) :
                pas[sindex].getPixels(sources[sindex],
View Full Code Here

                continue// no pixel to count in this rectangle
            }

            initializeState(source);

            UnpackedImageData uid = srcPA.getPixels(source, rect,
                                                    srcSampleType, false);
            switch (uid.type) {
            case DataBuffer.TYPE_BYTE:
                accumulateStatisticsByte(uid);
                break;
View Full Code Here

                if (rect.isEmpty()) {
                    continue// no pixel to count in this rectangle
                }

                UnpackedImageData uid = srcPA.getPixels(source, rect,
                                                        srcSampleType, false);
                switch (uid.type) {
                case DataBuffer.TYPE_BYTE:
                    constructTreeByte(uid);
                    break;
View Full Code Here

        PixelAccessor   pa  = new PixelAccessor(dest.getSampleModel(), null);
        PackedImageData pid = pa.getPackedPixels(dest, destRect, true, false);
  int offset = pid.offset;
        PixelAccessor   srcPa  = new PixelAccessor(source.getSampleModel(), null);

        UnpackedImageData srcImD = srcPa.getPixels(source, srcRect, DataBuffer.TYPE_BYTE, false);
  int srcOffset  = srcImD.bandOffsets[0];
  byte[] srcData = ((byte[][])srcImD.data)[0];
  int pixelStride= srcImD.pixelStride;

  int ind0 = pid.bitOffset;
View Full Code Here

        PixelAccessor   pa  = new PixelAccessor(dest.getSampleModel(), null);
        PackedImageData pid = pa.getPackedPixels(dest, destRect, true, false);
  int offset = pid.offset;
        PixelAccessor   srcPa  = new PixelAccessor(source.getSampleModel(), null);

        UnpackedImageData srcImD = srcPa.getPixels(source, srcRect, DataBuffer.TYPE_SHORT, false);
  int srcOffset  = srcImD.bandOffsets[0];
  short[] srcData = ((short[][])srcImD.data)[0];
  int pixelStride= srcImD.pixelStride;

  int ind0 = pid.bitOffset;
View Full Code Here

TOP

Related Classes of com.lightcrafts.mediax.jai.UnpackedImageData

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.