org.apache.batik.bridge

Class AbstractSVGGradientElementBridge

public abstract class AbstractSVGGradientElementBridge extends AnimatableGenericSVGBridge implements PaintBridge, ErrorConstants

Bridge class for vending gradients.
Nested Class Summary
static classAbstractSVGGradientElementBridge.Stop
This class represents a gradient <stop> element.
static classAbstractSVGGradientElementBridge.SVGStopElementBridge
Bridge class for the gradient <stop> element.
Constructor Summary
protected AbstractSVGGradientElementBridge()
Constructs a new AbstractSVGGradientElementBridge.
Method Summary
protected abstract PaintbuildGradient(Element paintElement, Element paintedElement, GraphicsNode paintedNode, MultipleGradientPaint.CycleMethodEnum spreadMethod, MultipleGradientPaint.ColorSpaceEnum colorSpace, AffineTransform transform, Color[] colors, float[] offsets, BridgeContext ctx)
Builds a concrete gradient according to the specified parameters.
protected static MultipleGradientPaint.CycleMethodEnumconvertSpreadMethod(Element paintElement, String s, BridgeContext ctx)
Converts the spreadMethod attribute.
PaintcreatePaint(BridgeContext ctx, Element paintElement, Element paintedElement, GraphicsNode paintedNode, float opacity)
Creates a Paint according to the specified parameters.
protected static ListextractLocalStop(Element gradientElement, float opacity, BridgeContext ctx)
Returns a list of Stop elements, children of the specified paintElement can have or null if any.
protected static ListextractStop(Element paintElement, float opacity, BridgeContext ctx)
Returns the stops elements of the specified gradient element.

Constructor Detail

AbstractSVGGradientElementBridge

protected AbstractSVGGradientElementBridge()
Constructs a new AbstractSVGGradientElementBridge.

Method Detail

buildGradient

protected abstract Paint buildGradient(Element paintElement, Element paintedElement, GraphicsNode paintedNode, MultipleGradientPaint.CycleMethodEnum spreadMethod, MultipleGradientPaint.ColorSpaceEnum colorSpace, AffineTransform transform, Color[] colors, float[] offsets, BridgeContext ctx)
Builds a concrete gradient according to the specified parameters.

Parameters: paintElement the element that defines a Paint paintedElement the element referencing the paint paintedNode the graphics node on which the Paint will be applied spreadMethod the spread method colorSpace the color space (sRGB | LinearRGB) transform the gradient transform colors the colors of the gradient offsets the offsets ctx the bridge context to use

convertSpreadMethod

protected static MultipleGradientPaint.CycleMethodEnum convertSpreadMethod(Element paintElement, String s, BridgeContext ctx)
Converts the spreadMethod attribute.

Parameters: paintElement the paint Element with a spreadMethod s the spread method ctx the BridgeContext to use for error information

createPaint

public Paint createPaint(BridgeContext ctx, Element paintElement, Element paintedElement, GraphicsNode paintedNode, float opacity)
Creates a Paint according to the specified parameters.

Parameters: ctx the bridge context to use paintElement the element that defines a Paint paintedElement the element referencing the paint paintedNode the graphics node on which the Paint will be applied opacity the opacity of the Paint to create

extractLocalStop

protected static List extractLocalStop(Element gradientElement, float opacity, BridgeContext ctx)
Returns a list of Stop elements, children of the specified paintElement can have or null if any.

Parameters: gradientElement the paint element opacity the opacity ctx the bridge context

extractStop

protected static List extractStop(Element paintElement, float opacity, BridgeContext ctx)
Returns the stops elements of the specified gradient element. Stops can be children of the gradients or defined on one of its 'ancestor' (linked with the xlink:href attribute).

Parameters: paintElement the gradient element opacity the opacity ctx the bridge context to use

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