Top Inners Fields Constructors Methods
org.apache.pdfbox.jbig2.image

pack-priv Class Resizer

extends Object
Class Inheritance
Imports
java.awt.Rectangle, java.awt.image.WritableRaster, org.apache.pdfbox.jbig2.Bitmap, org.apache.pdfbox.jbig2.util.Utils

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
private static enum
Resizer.Order

Order in which to apply filter

Field Summary

Modifier and TypeField and Description
private int[]
bitsPerChannel

Number of bits per channel

private final boolean
coerce

Should filters be simplified if possible?

pack-priv static final boolean
private static final double
EPSILON

Error tolerance

private int[]
private final Resizer.Mapping
private final Resizer.Mapping
private static final int[]
private final Resizer.Order
order

The order in which data is processed.

private final boolean
trimZeros

Should zeros be trimmed in x filter weight tables?

private int
weightBits

Number of bits in filter coefficients

private int

Constructor Summary

AccessConstructor and Description
public
Resizer(double
the scale factor for x and y direction
scale
)

Creates an instance of Resizer with one scale factor for both x and y directions.

public
Resizer(double
the scale factor for x direction
scaleX
,
double
the scale factor for y direction
scaleY
)

Creates an instance of Resizer with a scale factor for each direction.

Method Summary

Modifier and TypeMethod and Description
private static Scanline
createScanline(final Object src, Object dst, final int length)

private Weighttab[]
createXWeights(Rectangle srcBounds, final Rectangle dstBounds, final ParameterizedFilter filter)

private static boolean

Returns:

true if x is an integer, false if not.
isInteger
(final double
the double to check
x
)

Is x an integer?

public void
resize(final Object
Source object
src
,
final Rectangle
Bounds of the source object
srcBounds
,
final Object
Destination object
dst
,
Rectangle
Bounds of the destination object
dstBounds
,
Filter
The filter used for x direction filtering
xFilter
,
Filter
The filter used for y direction filtering
yFilter
)

private void
resizeXfirst(final Object src, final Rectangle srcBounds, final Object dst, final Rectangle dstBounds, final ParameterizedFilter xFilter, final ParameterizedFilter yFilter)

Filtered zoom, x direction filtering before y direction filtering

Note

when calling Resizer#createXWeights(Rectangle, Rectangle, ParameterizedFilter), we can trim leading and trailing zeros from the x weight buffers as an optimization, but not for y weight buffers since the split formula is anticipating a constant amount of buffering of source scanlines; trimming zeros in y weight could cause feedback.

private void
resizeYfirst(final Object src, final Rectangle srcBounds, final Object dst, final Rectangle dstBounds, final ParameterizedFilter xFilter, final ParameterizedFilter yFilter)

Filtered zoom, y direction filtering before x direction filtering

private ParameterizedFilter
simplifyFilter(final ParameterizedFilter
the parameterized filter instance to be simplified
filter
,
final double
the scale of the coordinate mapping
scale
,
final double
the offset of the coordinate mapping
offset
)

Checks if our discrete sampling of an arbitrary continuous filter, parameterized by the filter spacing (ParameterizedFilter#scale), its radius (ParameterizedFilter#support), and the scale and offset of the coordinate mapping, causes the filter to reduce to point sampling.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bitsPerChannelback to summary
private int[] bitsPerChannel

Number of bits per channel

coerceback to summary
private final boolean coerce

Should filters be simplified if possible?

debugback to summary
pack-priv static final boolean debug
EPSILONback to summary
private static final double EPSILON

Error tolerance

finalShiftback to summary
private int[] finalShift
mappingXback to summary
private final Resizer.Mapping mappingX
mappingYback to summary
private final Resizer.Mapping mappingY
NO_SHIFTback to summary
private static final int[] NO_SHIFT
orderback to summary
private final Resizer.Order order

The order in which data is processed.

See Also
Order
trimZerosback to summary
private final boolean trimZeros

Should zeros be trimmed in x filter weight tables?

weightBitsback to summary
private int weightBits

Number of bits in filter coefficients

weightOneback to summary
private int weightOne

Constructor Detail

Resizerback to summary
public Resizer(double scale)

Creates an instance of Resizer with one scale factor for both x and y directions.

Parameters
scale:double

the scale factor for x and y direction

Resizerback to summary
public Resizer(double scaleX, double scaleY)

Creates an instance of Resizer with a scale factor for each direction.

Parameters
scaleX:double

the scale factor for x direction

scaleY:double

the scale factor for y direction

Method Detail

createScanlineback to summary
private static Scanline createScanline(final Object src, Object dst, final int length)
createXWeightsback to summary
private Weighttab[] createXWeights(Rectangle srcBounds, final Rectangle dstBounds, final ParameterizedFilter filter)
isIntegerback to summary
private static boolean isInteger(final double x)

Is x an integer?

Parameters
x:double

the double to check

Returns:boolean

true if x is an integer, false if not.

resizeback to summary
public void resize(final Object src, final Rectangle srcBounds, final Object dst, Rectangle dstBounds, Filter xFilter, Filter yFilter)
Parameters
src:Object

Source object

srcBounds:Rectangle

Bounds of the source object

dst:Object

Destination object

dstBounds:Rectangle

Bounds of the destination object

xFilter:Filter

The filter used for x direction filtering

yFilter:Filter

The filter used for y direction filtering

resizeXfirstback to summary
private void resizeXfirst(final Object src, final Rectangle srcBounds, final Object dst, final Rectangle dstBounds, final ParameterizedFilter xFilter, final ParameterizedFilter yFilter)

Filtered zoom, x direction filtering before y direction filtering

Note

when calling Resizer#createXWeights(Rectangle, Rectangle, ParameterizedFilter), we can trim leading and trailing zeros from the x weight buffers as an optimization, but not for y weight buffers since the split formula is anticipating a constant amount of buffering of source scanlines; trimming zeros in y weight could cause feedback.

resizeYfirstback to summary
private void resizeYfirst(final Object src, final Rectangle srcBounds, final Object dst, final Rectangle dstBounds, final ParameterizedFilter xFilter, final ParameterizedFilter yFilter)

Filtered zoom, y direction filtering before x direction filtering

simplifyFilterback to summary
private ParameterizedFilter simplifyFilter(final ParameterizedFilter filter, final double scale, final double offset)

Checks if our discrete sampling of an arbitrary continuous filter, parameterized by the filter spacing (ParameterizedFilter#scale), its radius (ParameterizedFilter#support), and the scale and offset of the coordinate mapping, causes the filter to reduce to point sampling.

It reduces if support is less than 1 pixel or if integer scale and translation, and filter is cardinal.

Parameters
filter:ParameterizedFilter

the parameterized filter instance to be simplified

scale:double

the scale of the coordinate mapping

offset:double

the offset of the coordinate mapping

org.apache.pdfbox.jbig2.image back to summary

pack-priv final Class Resizer.Mapping

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final double
private final double
pack-priv final double
offset

x and y offset used by MAP, private fields

pack-priv final double
scale

x and y scales

Constructor Summary

AccessConstructor and Description
pack-priv
Mapping(double a0, double aw, double b0, double bw)

pack-priv
Mapping(double scaleX)

Method Summary

Modifier and TypeMethod and Description
pack-priv double
dstToSrc(final double b)

pack-priv double
mapPixelCenter(final int b)

pack-priv double
srcToDst(final double a)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

a0back to summary
private final double a0
b0back to summary
private final double b0
offsetback to summary
pack-priv final double offset

x and y offset used by MAP, private fields

scaleback to summary
pack-priv final double scale

x and y scales

Constructor Detail

Mappingback to summary
pack-priv Mapping(double a0, double aw, double b0, double bw)
Mappingback to summary
pack-priv Mapping(double scaleX)

Method Detail

dstToSrcback to summary
pack-priv double dstToSrc(final double b)
mapPixelCenterback to summary
pack-priv double mapPixelCenter(final int b)
srcToDstback to summary
pack-priv double srcToDst(final double a)
org.apache.pdfbox.jbig2.image back to summary

private final Enum Resizer.Order

extends Enum<Resizer.Order>
Class Inheritance

Order in which to apply filter

Field Summary

Modifier and TypeField and Description
public static final Resizer.Order
public static final Resizer.Order
public static final Resizer.Order

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Resizer.Order
public static Resizer.Order[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

AUTOback to summary
public static final Resizer.Order AUTO
XYback to summary
public static final Resizer.Order XY
YXback to summary
public static final Resizer.Order YX

Constructor Detail

Orderback to summary
private Order()

Method Detail

valueOfback to summary
public static Resizer.Order valueOf(String name)
valuesback to summary
public static Resizer.Order[] values()