public class SmoothMinifier extends java.lang.Object implements PushbroomScaler
SmoothMinifier downscaler = new SmoothMinifier(sourceWidth, sourceHeight, numBands, destWidth, destHeight); for(int i = 0; i < sourceHeight; i++) { byte[] b = source.getLine(i); if (shrinker.putSourceScanline(b, 0)) { break; } } NIOBuffer destBuf = downscaler.getDestination();The algorithm used calculates the destination sample in each band by averaging over a box centered on the backward mapped location of the destination pixel. The box has dimensions
ceil(sourceWidth/destWidth) x ceil(sourceHeight/destHeight)
.Modifier and Type | Field and Description |
---|---|
protected int[] |
bottomPoints |
protected int |
boxHeight |
protected java.nio.ByteBuffer |
destBuf |
protected int |
destHeight |
protected int |
destLine |
protected int |
destWidth |
protected int[] |
leftPoints |
protected int |
numBands |
protected int[] |
rightPoints |
protected double |
scaleY |
protected byte[][] |
sourceData |
protected int |
sourceDataLine |
protected int |
sourceHeight |
protected int |
sourceLine |
protected int |
sourceWidth |
protected int[] |
tmpBuf |
protected int[] |
topPoints |
Constructor and Description |
---|
SmoothMinifier(int sourceWidth,
int sourceHeight,
int numBands,
int destWidth,
int destHeight)
Instantiates a new
SmoothMinifier object. |
Modifier and Type | Method and Description |
---|---|
java.nio.ByteBuffer |
getDestination()
Retrieves the destination buffer.
|
boolean |
putSourceScanline(byte[] scanline,
int off)
Push one scanline of source pixels into the downscaling engine.
|
protected int sourceWidth
protected int sourceHeight
protected int numBands
protected int destWidth
protected int destHeight
protected double scaleY
protected java.nio.ByteBuffer destBuf
protected int boxHeight
protected byte[][] sourceData
protected int[] leftPoints
protected int[] rightPoints
protected int[] topPoints
protected int[] bottomPoints
protected int sourceLine
protected int sourceDataLine
protected int destLine
protected int[] tmpBuf
SmoothMinifier(int sourceWidth, int sourceHeight, int numBands, int destWidth, int destHeight)
SmoothMinifier
object.sourceWidth
- The source image widthsourceHeight
- The source image heightnumBands
- The number of components per pixel in the imagesdestWidth
- The destination image widthdestHeight
- The destination image heightjava.lang.IllegalArgumentException
- if any of the parameters is non-positive
or either destination dimension is greater than the corresponding source
dimension.public java.nio.ByteBuffer getDestination()
getDestination
in interface PushbroomScaler
public boolean putSourceScanline(byte[] scanline, int off)
putSourceScanline
in interface PushbroomScaler
scanline
- One scanline of source data.off
- The offline into the buffer.java.lang.IllegalArgumentException
- if off < 0
.