com.bbn.openmap.omGraphics
Class OMRasterObject.TrimScaleFilter
java.lang.Object
|
+--java.awt.image.ImageFilter
|
+--java.awt.image.ReplicateScaleFilter
|
+--java.awt.image.AreaAveragingScaleFilter
|
+--com.bbn.openmap.omGraphics.OMRasterObject.TrimScaleFilter
- All Implemented Interfaces:
- java.lang.Cloneable, java.awt.image.ImageConsumer
- Enclosing class:
- OMRasterObject
- protected class OMRasterObject.TrimScaleFilter
- extends java.awt.image.AreaAveragingScaleFilter
This is an effort to create an scaling ImageFilter that will
trim off the unused pixels, lessoning the load on the display
server. It depends on knowing several things about the
projection and the current image parameters, which is why it's
not a stand-alone filter class.
Fields inherited from class java.awt.image.ReplicateScaleFilter |
destHeight, destWidth, outpixbuf, srccols, srcHeight, srcrows, srcWidth |
Fields inherited from class java.awt.image.ImageFilter |
consumer |
Fields inherited from interface java.awt.image.ImageConsumer |
COMPLETESCANLINES, IMAGEABORTED, IMAGEERROR, RANDOMPIXELORDER, SINGLEFRAME, SINGLEFRAMEDONE, SINGLEPASS, STATICIMAGEDONE, TOPDOWNLEFTRIGHT |
Constructor Summary |
|
OMRasterObject.TrimScaleFilter(int width,
int height)
Constructs an TrimScaleFilter that scales the pixels from
its source Image as specified by the width and height
parameters. |
protected |
OMRasterObject.TrimScaleFilter(int width,
int height,
int algorithmType)
Constructs an AreaAveragingScaleFilter that scales the
pixels from its source Image as specified by the width and
height parameters. |
Method Summary |
protected java.awt.image.ImageFilter |
getFilterWithChanges()
The filter must change if the requested image size changes
because of clipping. |
void |
setHints(int hints)
Detect if the data is being delivered with the necessary
hints to allow the averaging algorithm to do its work. |
protected java.awt.Image |
trimExcessPixels()
Get a trimmed-down image to expand to the map, that
contains all the pixels that will be visible after
expansion. |
Methods inherited from class java.awt.image.AreaAveragingScaleFilter |
setPixels, setPixels |
Methods inherited from class java.awt.image.ReplicateScaleFilter |
setDimensions, setProperties |
Methods inherited from class java.awt.image.ImageFilter |
clone, getFilterInstance, imageComplete, resendTopDownLeftRight, setColorModel |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
OMRasterObject.TrimScaleFilter
public OMRasterObject.TrimScaleFilter(int width,
int height)
- Constructs an TrimScaleFilter that scales the pixels from
its source Image as specified by the width and height
parameters.
- Parameters:
width
- the target width to scale the imageheight
- the target height to scale the image
OMRasterObject.TrimScaleFilter
protected OMRasterObject.TrimScaleFilter(int width,
int height,
int algorithmType)
- Constructs an AreaAveragingScaleFilter that scales the
pixels from its source Image as specified by the width and
height parameters.
- Parameters:
width
- the target width to scale the imageheight
- the target height to scale the imagealgorithmType
- FAST_SCALING or SMOOTH_SCALING - FAST
is much faster!
setHints
public void setHints(int hints)
- Detect if the data is being delivered with the necessary
hints to allow the averaging algorithm to do its work. If
the algorithmType is set to FAST, I manipulate the hints to
force the filter to act like a ReplicateScaleFilter.
- Specified by:
setHints
in interface java.awt.image.ImageConsumer
- Overrides:
setHints
in class java.awt.image.AreaAveragingScaleFilter
- See Also:
ImageConsumer.setHints(int)
getFilterWithChanges
protected java.awt.image.ImageFilter getFilterWithChanges()
- The filter must change if the requested image size changes
because of clipping. Get the good filter here, after
calling trimExcessPixels().
trimExcessPixels
protected java.awt.Image trimExcessPixels()
- Get a trimmed-down image to expand to the map, that
contains all the pixels that will be visible after
expansion. Returns null if the image should be used as is,
and the filter as well.
Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details