Package org.openstreetmap.josm.tools
Class ImageWarp.GridTransform
- java.lang.Object
-
- org.openstreetmap.josm.tools.ImageWarp.GridTransform
-
- All Implemented Interfaces:
ImageWarp.PointTransform
- Enclosing class:
- ImageWarp
public static class ImageWarp.GridTransform extends Object implements ImageWarp.PointTransform
Wrapper that optimizes a givenImageWarp.PointTransform
. It does so by spanning a grid with certain step size. It will invoke the potentially expensive master transform only at those grid points and use bilinear interpolation to approximate transformed values in between.For memory optimization, this class assumes that rows are more or less scanned one-by-one as is done in
ImageWarp.warp(java.awt.image.BufferedImage, java.awt.Dimension, org.openstreetmap.josm.tools.ImageWarp.PointTransform, org.openstreetmap.josm.tools.ImageWarp.Interpolation)
. I.e. this transform is not random access in the y coordinate.
-
-
Field Summary
Fields Modifier and Type Field Description private Map<Integer,Map<Integer,Point2D>>
cache
private boolean
consistencyTest
private Set<Integer>
deletedRows
private double
stride
private ImageWarp.PointTransform
trfm
-
Constructor Summary
Constructors Constructor Description GridTransform(ImageWarp.PointTransform trfm, double stride)
Create a new GridTransform.
-
-
-
Field Detail
-
stride
private final double stride
-
trfm
private final ImageWarp.PointTransform trfm
-
consistencyTest
private final boolean consistencyTest
-
deletedRows
private final Set<Integer> deletedRows
-
-
Constructor Detail
-
GridTransform
public GridTransform(ImageWarp.PointTransform trfm, double stride)
Create a new GridTransform.- Parameters:
trfm
- the master transform, that needs to be optimizedstride
- step size
-
-
Method Detail
-
transform
public Point2D transform(Point2D pt)
Description copied from interface:ImageWarp.PointTransform
Translates pixel coordinates.- Specified by:
transform
in interfaceImageWarp.PointTransform
- Parameters:
pt
- pixel coordinates- Returns:
- transformed pixel coordinates
-
cleanUp
private void cleanUp(int yIdx)
-
-