|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.media.jai.Interpolation | +--javax.media.jai.InterpolationNearest
A class representing nearest-neighbor interpolation. Since nearest-neighbor interpolation is simply pixel copying, and not really interpolation at all, most code that performs nearest-neighbor sampling will want to use special-purpose code. However, this class is provided both as a way to specify such interpolation, with the consumer making use of 'instanceof' to detect the particular class, and as a way to force general Interpolation users to use nearest-neighbor sampling. Note that this interpolator does not actually select the "nearest" pixel, but only uses the truncated integer pixel location (floor). This is an optimization reflecting an assumption about the implementation of the resampler. It is assumed that the conversion of continuous source image coordinates to discrete pixel indices drops the final subtraction of 0.5 for the case of a nearest-neighbor interpolator.
Neighborhoods of sizes 2x1, 1x2, 2x2, 4x1, 1x4, 4x4, Nx1 and 1xN, that is, all the interpolate() methods defined in the Interpolation class, are supported in the interest of simplifying code that handles a number of types of interpolation. In each case, the central sample is returned and the rest are ignored.
The class is marked 'final' so that it may be more easily inlined.
Fields inherited from class javax.media.jai.Interpolation |
bottomPadding, height, INTERP_BICUBIC, INTERP_BICUBIC_2, INTERP_BILINEAR, INTERP_NEAREST, leftPadding, rightPadding, subsampleBitsH, subsampleBitsV, topPadding, width |
Constructor Summary | |
InterpolationNearest()
Constructs an InterpolationNearest . |
Method Summary | |
double |
interpolate(double[][] samples,
float xfrac,
float yfrac)
Performs interpolation on a two-dimensional array of double samples. |
double |
interpolate(double s__,
double s_0,
double s_1,
double s_2,
double s0_,
double s00,
double s01,
double s02,
double s1_,
double s10,
double s11,
double s12,
double s2_,
double s20,
double s21,
double s22,
float xfrac,
float yfrac)
Performs interpolation on a 4x4 grid of double samples. |
double |
interpolate(double s00,
double s01,
double s10,
double s11,
float xfrac,
float yfrac)
Performs interpolation on a 2x2 grid of double samples. |
float |
interpolate(float[][] samples,
float xfrac,
float yfrac)
Performs interpolation on a two-dimensional array of floating-point samples. |
float |
interpolate(float s00,
float s01,
float s10,
float s11,
float xfrac,
float yfrac)
Performs interpolation on a 2x2 grid of floating-point samples. |
float |
interpolate(float s__,
float s_0,
float s_1,
float s_2,
float s0_,
float s00,
float s01,
float s02,
float s1_,
float s10,
float s11,
float s12,
float s2_,
float s20,
float s21,
float s22,
float xfrac,
float yfrac)
Performs interpolation on a 4x4 grid of floating-point samples. |
int |
interpolate(int[][] samples,
int xfrac,
int yfrac)
Performs interpolation on a two-dimensional array of integral samples. |
int |
interpolate(int s00,
int s01,
int s10,
int s11,
int xfrac,
int yfrac)
Performs interpolation on a 2x2 grid of integral samples. |
int |
interpolate(int s__,
int s_0,
int s_1,
int s_2,
int s0_,
int s00,
int s01,
int s02,
int s1_,
int s10,
int s11,
int s12,
int s2_,
int s20,
int s21,
int s22,
int xfrac,
int yfrac)
Performs interpolation on a 4x4 grid of integral samples. |
double |
interpolateH(double[] samples,
float xfrac)
Performs horizontal interpolation on a one-dimensional array of double samples. |
double |
interpolateH(double s0,
double s1,
float xfrac)
Performs horizontal interpolation on a pair of double samples. |
float |
interpolateH(float[] samples,
float xfrac)
Performs horizontal interpolation on a one-dimensional array of floating-point samples. |
float |
interpolateH(float s0,
float s1,
float xfrac)
Performs horizontal interpolation on a pair of floating-point samples. |
int |
interpolateH(int[] samples,
int xfrac)
Performs horizontal interpolation on a one-dimensional array of integral samples. |
int |
interpolateH(int s0,
int s1,
int xfrac)
Performs horizontal interpolation on a pair of integral samples. |
double |
interpolateV(double[] samples,
float yfrac)
Performs vertical interpolation on a one-dimensional array of double samples. |
double |
interpolateV(double s0,
double s1,
float yfrac)
Performs vertical interpolation on a pair of double samples. |
float |
interpolateV(float[] samples,
float yfrac)
Performs vertical interpolation on a one-dimensional array of floating-point samples. |
float |
interpolateV(float s0,
float s1,
float yfrac)
Performs vertical interpolation on a pair of floating-point samples. |
int |
interpolateV(int[] samples,
int yfrac)
Performs vertical interpolation on a one-dimensional array of integral samples. |
int |
interpolateV(int s0,
int s1,
int yfrac)
Performs vertical interpolation on a pair of integral samples. |
Methods inherited from class javax.media.jai.Interpolation |
getBottomPadding, getHeight, getInstance, getLeftPadding, getRightPadding, getSubsampleBitsH, getSubsampleBitsV, getTopPadding, getWidth, interpolateH, interpolateH, interpolateH, interpolateV, interpolateV, interpolateV, isSeparable |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public InterpolationNearest()
InterpolationNearest
. The return
value of getSubsampleBitsH()
and
getSubsampleBitsV()
will be 0.Method Detail |
public int interpolateH(int[] samples, int xfrac)
interpolateH
in class Interpolation
javax.media.jai.Interpolation
samples
- an array of ints.xfrac
- the subsample position, multiplied by 2(subsampleBitsH).public int interpolateV(int[] samples, int yfrac)
interpolateV
in class Interpolation
javax.media.jai.Interpolation
samples
- an array of ints.yfrac
- the Y subsample position, multiplied by 2(subsampleBitsV).Interpolation.interpolateH(int[], int)
public int interpolate(int[][] samples, int xfrac, int yfrac)
interpolate
in class Interpolation
javax.media.jai.Interpolation
samples
- a two-dimensional array of ints.xfrac
- the X subsample position, multiplied by 2(subsampleBitsH).yfrac
- the Y subsample position, multiplied by 2(subsampleBitsV).Interpolation.interpolateH(int[], int)
public int interpolateH(int s0, int s1, int xfrac)
interpolateH
in class Interpolation
javax.media.jai.Interpolation
s0
- the central sample.s1
- the sample to the right of the central sample.xfrac
- the subsample position, ranging from zero to
2(subsampleBitsH) - 1.Interpolation.interpolateH(int[], int)
public int interpolateV(int s0, int s1, int yfrac)
interpolateV
in class Interpolation
javax.media.jai.Interpolation
s0
- the central sample.s1
- the sample below the central sample.yfrac
- the Y subsample position, multiplied by 2(subsampleBitsV).Interpolation.interpolateH(int[], int)
public int interpolate(int s00, int s01, int s10, int s11, int xfrac, int yfrac)
interpolate
in class Interpolation
javax.media.jai.Interpolation
s00
- the central sample.s01
- the sample to the right of the central sample.s10
- the sample below the central sample.s11
- the sample below and to the right of the central sample.xfrac
- the X subsample position, multiplied by 2(subsampleBitsH).yfrac
- the Y subsample position, multiplied by 2(subsampleBitsV).Interpolation.interpolateH(int[], int)
public int interpolate(int s__, int s_0, int s_1, int s_2, int s0_, int s00, int s01, int s02, int s1_, int s10, int s11, int s12, int s2_, int s20, int s21, int s22, int xfrac, int yfrac)
interpolate
in class Interpolation
javax.media.jai.Interpolation
s__
- the sample above and to the left of the central sample.s_0
- the sample above the central sample.s_1
- the sample above and one to the right of the central sample.s_2
- the sample above and two to the right of the central sample.s0_
- the sample to the left of the central sample.s00
- the central sample.s01
- the sample to the right of the central sample.s02
- the sample two to the right of the central sample.s1_
- the sample below and one to the left of the central sample.s10
- the sample below the central sample.s11
- the sample below and one to the right of the central sample.s12
- the sample below and two to the right of the central sample.s2_
- the sample two below and one to the left of the central sample.s20
- the sample two below the central sample.s21
- the sample two below and one to the right of the central sample.s22
- the sample two below and two to the right of the central sample.xfrac
- the X subsample position, multiplied by 2(subsampleBitsH).yfrac
- the Y subsample position, multiplied by 2(subsampleBitsV).Interpolation.interpolateH(int[], int)
public float interpolateH(float[] samples, float xfrac)
interpolateH
in class Interpolation
javax.media.jai.Interpolation
samples
- an array of floats.xfrac
- the X subsample position, in the range [0.0F, 1.0F).public float interpolateV(float[] samples, float yfrac)
interpolateV
in class Interpolation
javax.media.jai.Interpolation
samples
- an array of floats.yfrac
- the Y subsample position, in the range [0.0F, 1.0F).public float interpolate(float[][] samples, float xfrac, float yfrac)
interpolate
in class Interpolation
javax.media.jai.Interpolation
samples
- an array of floats.xfrac
- the X subsample position, in the range [0.0F, 1.0F).yfrac
- the Y subsample position, in the range [0.0F, 1.0F).public float interpolateH(float s0, float s1, float xfrac)
interpolateH
in class Interpolation
javax.media.jai.Interpolation
s0
- the central sample.s1
- the sample to the right of the central sample.xfrac
- the subsample position, in the range [0.0F, 1.0F).public float interpolateV(float s0, float s1, float yfrac)
interpolateV
in class Interpolation
javax.media.jai.Interpolation
s0
- the central sample.s1
- the sample below the central sample.yfrac
- the Y subsample position, in the range [0.0F, 1.0F).public float interpolate(float s00, float s01, float s10, float s11, float xfrac, float yfrac)
interpolate
in class Interpolation
javax.media.jai.Interpolation
s00
- the central sample.s01
- the sample to the right of the central sample.s10
- the sample below the central sample.s11
- the sample below and to the right of the central sample.xfrac
- the X subsample position, in the range [0.0F, 1.0F).yfrac
- the Y subsample position, in the range [0.0F, 1.0F).public float interpolate(float s__, float s_0, float s_1, float s_2, float s0_, float s00, float s01, float s02, float s1_, float s10, float s11, float s12, float s2_, float s20, float s21, float s22, float xfrac, float yfrac)
interpolate
in class Interpolation
javax.media.jai.Interpolation
s__
- the sample above and to the left of the central sample.s_0
- the sample above the central sample.s_1
- the sample above and one to the right of the central sample.s_2
- the sample above and two to the right of the central sample.s0_
- the sample to the left of the central sample.s00
- the central sample.s01
- the sample to the right of the central sample.s02
- the sample two to the right of the central sample.s1_
- the sample below and one to the left of the central sample.s10
- the sample below the central sample.s11
- the sample below and one to the right of the central sample.s12
- the sample below and two to the right of the central sample.s2_
- the sample two below and one to the left of the central sample.s20
- the sample two below the central sample.s21
- the sample two below and one to the right of the central sample.s22
- the sample two below and two to the right of the central sample.xfrac
- the X subsample position, in the range [0.0F, 1.0F).yfrac
- the Y subsample position, in the range [0.0F, 1.0F).public double interpolateH(double[] samples, float xfrac)
interpolateH
in class Interpolation
javax.media.jai.Interpolation
samples
- an array of doubles.xfrac
- the X subsample position, in the range [0.0F, 1.0F).public double interpolateV(double[] samples, float yfrac)
interpolateV
in class Interpolation
javax.media.jai.Interpolation
samples
- an array of doubles.yfrac
- the Y subsample position, in the range [0.0F, 1.0F).public double interpolate(double[][] samples, float xfrac, float yfrac)
interpolate
in class Interpolation
javax.media.jai.Interpolation
samples
- an array of doubles.xfrac
- the X subsample position, in the range [0.0F, 1.0F).yfrac
- the Y subsample position, in the range [0.0F, 1.0F).public double interpolateH(double s0, double s1, float xfrac)
interpolateH
in class Interpolation
javax.media.jai.Interpolation
s0
- the central sample.s1
- the sample to the right of the central sample.xfrac
- the subsample position, in the range [0.0F, 1.0F).public double interpolateV(double s0, double s1, float yfrac)
interpolateV
in class Interpolation
javax.media.jai.Interpolation
s0
- the central sample.s1
- the sample below the central sample.yfrac
- the Y subsample position, in the range [0.0F, 1.0F).public double interpolate(double s00, double s01, double s10, double s11, float xfrac, float yfrac)
interpolate
in class Interpolation
javax.media.jai.Interpolation
s00
- the central sample.s01
- the sample to the right of the central sample.s10
- the sample below the central sample.s11
- the sample below and to the right of the central sample.xfrac
- the X subsample position, in the range [0.0F, 1.0F).yfrac
- the Y subsample position, in the range [0.0F, 1.0F).public double interpolate(double s__, double s_0, double s_1, double s_2, double s0_, double s00, double s01, double s02, double s1_, double s10, double s11, double s12, double s2_, double s20, double s21, double s22, float xfrac, float yfrac)
interpolate
in class Interpolation
javax.media.jai.Interpolation
s__
- the sample above and to the left of the central sample.s_0
- the sample above the central sample.s_1
- the sample above and one to the right of the central sample.s_2
- the sample above and two to the right of the central sample.s0_
- the sample to the left of the central sample.s00
- the central sample.s01
- the sample to the right of the central sample.s02
- the sample two to the right of the central sample.s1_
- the sample below and one to the left of the central sample.s10
- the sample below the central sample.s11
- the sample below and one to the right of the central sample.s12
- the sample below and two to the right of the central sample.s2_
- the sample two below and one to the left of the central sample.s20
- the sample two below the central sample.s21
- the sample two below and one to the right of the central sample.s22
- the sample two below and two to the right of the central sample.xfrac
- the X subsample position, in the range [0.0F, 1.0F).yfrac
- the Y subsample position, in the range [0.0F, 1.0F).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |