Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.batik.ext.awt.image.renderable
Class FilterResRable8Bit  view FilterResRable8Bit download FilterResRable8Bit.java

java.lang.Object
  extended byorg.apache.batik.ext.awt.image.renderable.AbstractRable
      extended byorg.apache.batik.ext.awt.image.renderable.FilterResRable8Bit
All Implemented Interfaces:
Filter, FilterResRable, PaintRable, java.awt.image.renderable.RenderableImage

public class FilterResRable8Bit
extends AbstractRable
implements FilterResRable, PaintRable

Interface for implementing filter resolution.

Version:
$Id: FilterResRable8Bit.java,v 1.11 2004/08/18 07:13:59 vhardy Exp $

Field Summary
private  int filterResolutionX
          Filter resolution along the x-axis
private  int filterResolutionY
          Filter resolution along the y-axis
(package private)  java.lang.ref.Reference resRed
          Cached Rendered image at filterRes.
(package private)  float resScale
           
 
Fields inherited from class org.apache.batik.ext.awt.image.renderable.AbstractRable
props, srcs, stamp
 
Fields inherited from interface java.awt.image.renderable.RenderableImage
HINTS_OBSERVED
 
Constructor Summary
FilterResRable8Bit()
           
FilterResRable8Bit(Filter src, int filterResX, int filterResY)
           
 
Method Summary
 boolean allPaintRable(java.awt.image.renderable.RenderableImage ri)
          This returns true if ri and all of ri's sources implement the PaintRable interface.
 java.awt.image.RenderedImage createRendering(java.awt.image.renderable.RenderContext renderContext)
           
 boolean distributeAcross(java.awt.image.renderable.RenderableImage src, java.awt.Graphics2D g2d)
          This function attempts to distribute the filterRes operation across src.
 int getFilterResolutionX()
          Returns the resolution along the X axis.
 int getFilterResolutionY()
          Returns the resolution along the Y axis.
private  java.awt.image.RenderedImage getResRed(java.awt.RenderingHints hints)
           
private  float getResScale()
           
 Filter getSource()
          Returns the source to be cropped.
 boolean paintRable(java.awt.Graphics2D g2d)
          Should perform the equivilent action as createRendering followed by drawing the RenderedImage.
 void setFilterResolutionX(int filterResolutionX)
          Sets the resolution along the X axis, i.e., the maximum size for intermediate images along that axis.
 void setFilterResolutionY(int filterResolutionY)
          Sets the resolution along the Y axis, i.e., the maximum size for intermediate images along that axis.
 void setSource(Filter src)
          Sets the source to be cropped
 
Methods inherited from class org.apache.batik.ext.awt.image.renderable.AbstractRable
createDefaultRendering, createScaledRendering, getBounds2D, getDependencyRegion, getDirtyRegion, getHeight, getMinX, getMinY, getProperty, getPropertyNames, getSources, getTimeStamp, getWidth, init, init, init, init, isDynamic, touch
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.batik.ext.awt.image.renderable.Filter
getBounds2D, getDependencyRegion, getDirtyRegion, getTimeStamp
 
Methods inherited from interface java.awt.image.renderable.RenderableImage
createDefaultRendering, createScaledRendering, getHeight, getMinX, getMinY, getProperty, getPropertyNames, getSources, getWidth, isDynamic
 

Field Detail

filterResolutionX

private int filterResolutionX
Filter resolution along the x-axis


filterResolutionY

private int filterResolutionY
Filter resolution along the y-axis


resRed

java.lang.ref.Reference resRed
Cached Rendered image at filterRes.


resScale

float resScale
Constructor Detail

FilterResRable8Bit

public FilterResRable8Bit()

FilterResRable8Bit

public FilterResRable8Bit(Filter src,
                          int filterResX,
                          int filterResY)
Method Detail

getSource

public Filter getSource()
Returns the source to be cropped.

Specified by:
getSource in interface FilterResRable

setSource

public void setSource(Filter src)
Sets the source to be cropped

Specified by:
setSource in interface FilterResRable

getFilterResolutionX

public int getFilterResolutionX()
Returns the resolution along the X axis.

Specified by:
getFilterResolutionX in interface FilterResRable

setFilterResolutionX

public void setFilterResolutionX(int filterResolutionX)
Sets the resolution along the X axis, i.e., the maximum size for intermediate images along that axis. The value should be greater than zero to have an effect. Negative values are illegal.

Specified by:
setFilterResolutionX in interface FilterResRable

getFilterResolutionY

public int getFilterResolutionY()
Returns the resolution along the Y axis.

Specified by:
getFilterResolutionY in interface FilterResRable

setFilterResolutionY

public void setFilterResolutionY(int filterResolutionY)
Sets the resolution along the Y axis, i.e., the maximum size for intermediate images along that axis. If the Y-value is less than zero, the scale applied to the rendered images is computed to preserve the image's aspect ratio

Specified by:
setFilterResolutionY in interface FilterResRable

allPaintRable

public boolean allPaintRable(java.awt.image.renderable.RenderableImage ri)
This returns true if ri and all of ri's sources implement the PaintRable interface. This is used to indicate that the chain has a good potential for bypassing the filterRes operation entirely. Ideally there would be a checkPaintRable method in PaintRable that could be used to get a definate answer about a filters ability to draw directly to a Graphics2D (this can sometimes 'fail' because of the way the Graphics2D is currently configured).


distributeAcross

public boolean distributeAcross(java.awt.image.renderable.RenderableImage src,
                                java.awt.Graphics2D g2d)
This function attempts to distribute the filterRes operation across src. Right now it knows about two operations, pad and composite. It's main target is the composite but often pad operations are sprinked in the chain so it needs to know about them. This list could be extended however if it gets much longer it should probably be rolled into a new 'helper interface' like PaintRable. NOTE: This is essentially a bad hack, but it is a hack that is recomended by the SVG specification so I do it.


paintRable

public boolean paintRable(java.awt.Graphics2D g2d)
Should perform the equivilent action as createRendering followed by drawing the RenderedImage.

Specified by:
paintRable in interface PaintRable

getResScale

private float getResScale()

getResRed

private java.awt.image.RenderedImage getResRed(java.awt.RenderingHints hints)

createRendering

public java.awt.image.RenderedImage createRendering(java.awt.image.renderable.RenderContext renderContext)
Specified by:
createRendering in interface java.awt.image.renderable.RenderableImage