org.apache.batik.ext.awt.image.renderable

Class FilterResRable8Bit

public class FilterResRable8Bit extends AbstractRable implements FilterResRable, PaintRable

Interface for implementing filter resolution.
Constructor Summary
FilterResRable8Bit()
FilterResRable8Bit(Filter src, int filterResX, int filterResY)
Method Summary
booleanallPaintRable(RenderableImage ri)
This returns true if ri and all of ri's sources implement the PaintRable interface.
RenderedImagecreateRendering(RenderContext renderContext)
booleandistributeAcross(RenderableImage src, Graphics2D g2d)
This function attempts to distribute the filterRes operation across src.
intgetFilterResolutionX()
Returns the resolution along the X axis.
intgetFilterResolutionY()
Returns the resolution along the Y axis.
FiltergetSource()
Returns the source to be cropped.
booleanpaintRable(Graphics2D g2d)
Should perform the equivilent action as createRendering followed by drawing the RenderedImage.
voidsetFilterResolutionX(int filterResolutionX)
Sets the resolution along the X axis, i.e., the maximum size for intermediate images along that axis.
voidsetFilterResolutionY(int filterResolutionY)
Sets the resolution along the Y axis, i.e., the maximum size for intermediate images along that axis.
voidsetSource(Filter src)
Sets the source to be cropped

Constructor Detail

FilterResRable8Bit

public FilterResRable8Bit()

FilterResRable8Bit

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

Method Detail

allPaintRable

public boolean allPaintRable(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).

createRendering

public RenderedImage createRendering(RenderContext renderContext)

distributeAcross

public boolean distributeAcross(RenderableImage src, 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.

getFilterResolutionX

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

getFilterResolutionY

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

getSource

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

paintRable

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

Parameters: g2d The Graphics2D to draw to.

Returns: true if the paint call succeeded, false if for some reason the paint failed (in which case a createRendering should be used).

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.

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

setSource

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

Parameters: src image to offset.

Copyright B) 2007 Apache Software Foundation. All Rights Reserved.