Class RandomIterComponentByte
Object
RandomIterComponentByte
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanapplies(RenderedImage im) True when the factory can use this iterator for the given source.voiddone()double[]getPixel(int x, int y, double[] dArray) float[]getPixel(int x, int y, float[] fArray) int[]getPixel(int x, int y, int[] iArray) intgetSample(int x, int y, int b) doublegetSampleDouble(int x, int y, int b) floatgetSampleFloat(int x, int y, int b)
-
Constructor Details
-
RandomIterComponentByte
-
-
Method Details
-
applies
True when the factory can use this iterator for the given source. -
getSample
public int getSample(int x, int y, int b) - Specified by:
getSamplein interfaceRandomIter
-
getSampleFloat
public float getSampleFloat(int x, int y, int b) - Specified by:
getSampleFloatin interfaceRandomIter
-
getSampleDouble
public double getSampleDouble(int x, int y, int b) - Specified by:
getSampleDoublein interfaceRandomIter
-
getPixel
public int[] getPixel(int x, int y, int[] iArray) - Specified by:
getPixelin interfaceRandomIter
-
getPixel
public float[] getPixel(int x, int y, float[] fArray) - Specified by:
getPixelin interfaceRandomIter
-
getPixel
public double[] getPixel(int x, int y, double[] dArray) - Specified by:
getPixelin interfaceRandomIter
-
done
public void done()- Specified by:
donein interfaceRandomIter
-