com.ngs.image.source
Class ScalingCompositeSource
java.lang.Object
com.ngs.image.ImageSource
com.ngs.image.source.DefaultThumbnailSource
com.ngs.image.source.CompositeSource
com.ngs.image.source.ScalingCompositeSource
public class ScalingCompositeSource
- extends CompositeSource
This subclass of CompositeSource will scale all source layers to the exact
dimensions of the destination layer. The scale transform is only re-computed
if the scaled size of the source has a deviance +- rescaleThreashold.
Methods inherited from class com.ngs.image.source.CompositeSource |
addLayer, addLayer, dispose, doComposite, getImage, getImageCount, getImageName, getLayer, getNumLayers, isLayerVisible, removeAllLayers, removeLayer, setLayerVisibility |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ScalingCompositeSource
public ScalingCompositeSource()
ScalingCompositeSource
public ScalingCompositeSource(ImageSource bottom)
init
protected void init()
- Sets up the default threashold (8), and requires the next
calculateTransform to calculate the scale transform.
setThreashold
public void setThreashold(int rescaleThreashold)
- Set the threashold for subsequent rescaling.
getThreashold
public int getThreashold()
- Gets the rescale threashold.
calculateTransform
protected AffineTransform calculateTransform(BufferedImage src,
BufferedImage dst)
- Returns a scaleInstance AffineTransform to resize the src to fit the
bounds of the dst, within the rescale threashold.
- Overrides:
calculateTransform
in class CompositeSource
- Parameters:
src
- The source image about to be composited.dst
- The destination image about to be composited.
- Returns:
- An AffineTransform to use. This implementation returns
identity
getTransform
public AffineTransform getTransform()
- Gets the current transform