Class RandomIterComponentByte

Object
RandomIterComponentByte
All Implemented Interfaces:
RandomIter

public class RandomIterComponentByte extends Object implements RandomIter
Cached random iterator specialized for byte ComponentSampleModel sources: reads the backing byte[] arrays directly instead of going through SampleModel.getSample(int, int, int, java.awt.image.DataBuffer). The current tile is kept and only re-fetched when the requested pixel leaves its bounds, so the common warp access pattern (many reads inside one tile) pays no per-pixel tile lookup.

Reads are cheap here, tile switches are not. That fits how warp, scale and affine read: the source point moves a little at a time, so one tile serves many reads. A caller that jumps to a new tile on almost every read should build a RandomIterFallbackByte instead, because RandomIterFactory always picks this one for a byte source. RandomIterBenchmark, in the test sources, measures both cases.

  • Constructor Details

    • RandomIterComponentByte

      public RandomIterComponentByte(RenderedImage im)
  • Method Details

    • applies

      public static boolean applies(RenderedImage im)
      True when the factory can use this iterator for the given source.
    • getSample

      public int getSample(int x, int y, int b)
      Specified by:
      getSample in interface RandomIter
    • getSampleFloat

      public float getSampleFloat(int x, int y, int b)
      Specified by:
      getSampleFloat in interface RandomIter
    • getSampleDouble

      public double getSampleDouble(int x, int y, int b)
      Specified by:
      getSampleDouble in interface RandomIter
    • getPixel

      public int[] getPixel(int x, int y, int[] iArray)
      Specified by:
      getPixel in interface RandomIter
    • getPixel

      public float[] getPixel(int x, int y, float[] fArray)
      Specified by:
      getPixel in interface RandomIter
    • getPixel

      public double[] getPixel(int x, int y, double[] dArray)
      Specified by:
      getPixel in interface RandomIter
    • done

      public void done()
      Specified by:
      done in interface RandomIter