APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.javafx.iio.common

public Class SmoothMinifier

extends Object
implements PushbroomScaler
Class Inheritance
All Implemented Interfaces
com.sun.javafx.iio.common.PushbroomScaler
Imports
java.nio.ByteBuffer, java.util.Arrays

A class which implements smooth downscaling for sources acquired line-by-line. Source scanlines are pushed into the algorithm one at a time in sequence from the top to the bottom of the source image. The destination is also populated in line-by-line fashion as soon as enough source lines are available to calculate a given line. The class is used as follows:
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).

Field Summary

Modifier and TypeField and Description
protected int[]
protected int
protected ByteBuffer
protected int
protected int
protected int
protected int[]
protected int
protected int[]
protected double
protected byte[][]
protected int
protected int
protected int
protected int
protected int[]
protected int[]

Constructor Summary

AccessConstructor and Description
pack-priv
SmoothMinifier(int
The source image width
sourceWidth
,
int
The source image height
sourceHeight
,
int
The number of components per pixel in the images
numBands
,
int
The destination image width
destWidth
,
int
The destination image height
destHeight
)

Instantiates a new SmoothMinifier object.

Method Summary

Modifier and TypeMethod and Description
public ByteBuffer

Returns:

The destination buffer.
getDestination
()

Implements com.sun.javafx.iio.common.PushbroomScaler.getDestination.

Retrieves the destination buffer.

public boolean

Returns:

Whether the destination image is complete.
putSourceScanline
(byte[]
One scanline of source data.
scanline
,
int
The offline into the buffer.
off
)

Implements com.sun.javafx.iio.common.PushbroomScaler.putSourceScanline.

Push one scanline of source pixels into the downscaling engine.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bottomPointsback to summary
protected int[] bottomPoints
boxHeightback to summary
protected int boxHeight
destBufback to summary
protected ByteBuffer destBuf
destHeightback to summary
protected int destHeight
destLineback to summary
protected int destLine
destWidthback to summary
protected int destWidth
leftPointsback to summary
protected int[] leftPoints
numBandsback to summary
protected int numBands
rightPointsback to summary
protected int[] rightPoints
scaleYback to summary
protected double scaleY
sourceDataback to summary
protected byte[][] sourceData
sourceDataLineback to summary
protected int sourceDataLine
sourceHeightback to summary
protected int sourceHeight
sourceLineback to summary
protected int sourceLine
sourceWidthback to summary
protected int sourceWidth
tmpBufback to summary
protected int[] tmpBuf
topPointsback to summary
protected int[] topPoints

Constructor Detail

SmoothMinifierback to summary
pack-priv SmoothMinifier(int sourceWidth, int sourceHeight, int numBands, int destWidth, int destHeight)

Instantiates a new SmoothMinifier object.

Parameters
sourceWidth:int

The source image width

sourceHeight:int

The source image height

numBands:int

The number of components per pixel in the images

destWidth:int

The destination image width

destHeight:int

The destination image height

Exceptions
IllegalArgumentException:
if any of the parameters is non-positive or either destination dimension is greater than the corresponding source dimension.

Method Detail

getDestinationback to summary
public ByteBuffer getDestination()

Implements com.sun.javafx.iio.common.PushbroomScaler.getDestination.

Retrieves the destination buffer.

Returns:ByteBuffer

The destination buffer.

Annotations
@Override
putSourceScanlineback to summary
public boolean putSourceScanline(byte[] scanline, int off)

Implements com.sun.javafx.iio.common.PushbroomScaler.putSourceScanline.

Push one scanline of source pixels into the downscaling engine. A smooth downscaling algorithm is used.

Parameters
scanline:byte[]

One scanline of source data.

off:int

The offline into the buffer.

Returns:boolean

Whether the destination image is complete.

Annotations
@Override
Exceptions
IllegalArgumentException:
if off < 0.