Package com.lightcrafts.mediax.jai

Examples of com.lightcrafts.mediax.jai.PixelAccessor


  // int thresholdI = (int)Math.ceil(this.threshold);
  // or through a lookup table for byte case

  Rectangle srcRect = mapDestRect(destRect,0); // should be identical to destRect

        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


  // int thresholdI = (int)Math.ceil(this.threshold);
  // or through a lookup table for byte case

  Rectangle srcRect = mapDestRect(destRect,0); // should be identical to destRect

        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

  // int thresholdI = (int)Math.ceil(this.threshold);
  // or through a lookup table for byte case

  Rectangle srcRect = mapDestRect(destRect,0); // should be identical to destRect

        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_USHORT, false);
  int srcOffset  = srcImD.bandOffsets[0];
  short[] srcData = ((short[][])srcImD.data)[0];
  int pixelStride= srcImD.pixelStride;

  int ind0 = pid.bitOffset;
View Full Code Here

  // even though threshold is of double type
  // int thresholdI = (int)Math.ceil(this.threshold);

  Rectangle srcRect = mapDestRect(destRect,0); // should be identical to destRect

        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_INT, false);
  int srcOffset  = srcImD.bandOffsets[0];
  int[] srcData = ((int[][])srcImD.data)[0];
  int pixelStride= srcImD.pixelStride;

  int ind0 = pid.bitOffset;
View Full Code Here

        WritableRaster dest,
        Rectangle destRect){

  Rectangle srcRect = mapDestRect(destRect,0); // should be identical to destRect

        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_FLOAT, false);
  int srcOffset  = srcImD.bandOffsets[0];
  float[] srcData = ((float[][])srcImD.data)[0];
  int pixelStride= srcImD.pixelStride;

  int ind0 = pid.bitOffset;
View Full Code Here

        WritableRaster dest,
        Rectangle destRect){

  Rectangle srcRect = mapDestRect(destRect,0); // should be identical to destRect

        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_DOUBLE, false);
  int srcOffset  = srcImD.bandOffsets[0];
  double[] srcData = ((double[][])srcImD.data)[0];
  int pixelStride= srcImD.pixelStride;

  int ind0 = pid.bitOffset;
View Full Code Here

    // set all bits in a rectangular region to be 1
    // need to be sure that paddings not changing
    private void setTo1(Raster dest, Rectangle destRect){
        initBitsOn();
        PixelAccessor   pa  = new PixelAccessor(dest.getSampleModel(), null);
        PackedImageData pid = pa.getPackedPixels(dest, destRect, true, false);
  int offset = pid.offset;

  for(int h = 0; h < destRect.height; h++){
     int ind0 = pid.bitOffset;
     int indE = ind0 + destRect.width - 1;
     if (indE < 8){
        // the entire row in data[offset]
        pid.data[offset] = (byte)(pid.data[offset] | bitsOn[indE]); // (0<<3) + indE
     }else{
            //1st byte
        pid.data[offset] = (byte)(pid.data[offset] | bitsOn[7]); // (0<<3) + 7
        //middle bytes
        for(int b = offset + 1; b <= offset +  (indE-7)/8; b++){
     pid.data[b] = (byte)(0xff);
        }
        //last byte

        int remBits = indE % 8;
        if(remBits % 8 != 7){
      indE = offset + indE/8;
      pid.data[indE] = (byte)(pid.data[indE] | bitsOn[remBits]); // (0<<3)+remBits
        }
     }
     offset += pid.lineStride;
  }
  pa.setPackedPixels(pid);
    }
View Full Code Here

    RuntimeException(JaiI18N.getString("SubsampleBinaryToGrayOpImage0"));
        }
    }

    private void byteLoop(Raster source, WritableRaster dest, Rectangle  destRect){
        PixelAccessor pa = new PixelAccessor(source.getSampleModel(), null);
  PackedImageData pid =
            pa.getPackedPixels(source, source.getBounds(), false, false);
  byte[] sourceData   = pid.data;
        int sourceDBOffset  = pid.offset;
  int dx  = destRect.x;
  int dy  = destRect.y;
  int dwi = destRect.width;
View Full Code Here


    // speed up for the case of 4x4
    // and data buffer bitOffset is 0 or 4
    private void byteLoop4x4(Raster source, WritableRaster dest, Rectangle  destRect) {
        PixelAccessor pa = new PixelAccessor(source.getSampleModel(), null);
  PackedImageData pid =
            pa.getPackedPixels(source, source.getBounds(), false, false);

  if(pid.bitOffset % 4 !=0){
     // special treatment only for offsets 0 and 4
     byteLoop(source, dest, destRect);
     return;
View Full Code Here


    // same as SubsampleBinaryToGray, and change byteLoop to protected in superclass?
    // extends that and save this? using prote
    private void byteLoop(Raster source, WritableRaster dest, Rectangle  destRect) {
        PixelAccessor pa = new PixelAccessor(source.getSampleModel(), null);
  PackedImageData pid =
            pa.getPackedPixels(source, source.getBounds(), false, false);
  byte[] sourceData   = pid.data;
        int sourceDBOffset  = pid.offset;
  int dx  = destRect.x;        int dy  = destRect.y;
  int dwi = destRect.width;    int dhi = destRect.height;
        int sourceTransX = pid.rect.x;   // source.getSampleModelTranslateX();
View Full Code Here

TOP

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

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.