com.ngs.image.source
Class ScalingCompositeSource

java.lang.Object
  extended by com.ngs.image.ImageSource
      extended by com.ngs.image.source.DefaultThumbnailSource
          extended by com.ngs.image.source.CompositeSource
              extended by 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.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.ngs.image.source.CompositeSource
CompositeSource.Compositable
 
Field Summary
 
Fields inherited from class com.ngs.image.source.CompositeSource
identity, layers
 
Constructor Summary
ScalingCompositeSource()
           
ScalingCompositeSource(ImageSource bottom)
           
 
Method Summary
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.
 int getThreashold()
          Gets the rescale threashold.
 AffineTransform getTransform()
          Gets the current transform
protected  void init()
          Sets up the default threashold (8), and requires the next calculateTransform to calculate the scale transform.
 void setThreashold(int rescaleThreashold)
          Set the threashold for subsequent rescaling.
 
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 com.ngs.image.source.DefaultThumbnailSource
getThumbnail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScalingCompositeSource

public ScalingCompositeSource()

ScalingCompositeSource

public ScalingCompositeSource(ImageSource bottom)
Method Detail

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