* @param e the element that describes the graphics node to build
* @return a graphics node that represents the specified element
*/
public GraphicsNode createGraphicsNode(BridgeContext ctx, Element e) {
TextNode node = new TextNode();
// 'transform'
String s = e.getAttributeNS(null, SVG_TRANSFORM_ATTRIBUTE);
if (s.length() != 0) {
node.setTransform
(SVGUtilities.convertTransform(e, SVG_TRANSFORM_ATTRIBUTE, s));
}
// 'visibility'
node.setVisible(CSSUtilities.convertVisibility(e));
// 'text-rendering' and 'color-rendering'
Map textHints = CSSUtilities.convertTextRendering(e);
Map colorHints = CSSUtilities.convertColorRendering(e);
if (textHints != null || colorHints != null) {
RenderingHints hints;
if (textHints == null) {
hints = new RenderingHints(colorHints);
} else if (colorHints == null) {
hints = new RenderingHints(textHints);
} else {
hints = new RenderingHints(textHints);
hints.putAll(colorHints);
}
node.setRenderingHints(hints);
}
UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, e);
// 'x' attribute - default is 0
s = e.getAttributeNS(null, SVG_X_ATTRIBUTE);
float x = 0;
if (s.length() != 0) {
x = UnitProcessor.svgHorizontalCoordinateToUserSpace
(s, SVG_X_ATTRIBUTE, uctx);
}
// 'y' attribute - default is 0
s = e.getAttributeNS(null, SVG_Y_ATTRIBUTE);
float y = 0;
if (s.length() != 0) {
y = UnitProcessor.svgVerticalCoordinateToUserSpace
(s, SVG_Y_ATTRIBUTE, uctx);
}
node.setLocation(new Point2D.Float(x, y));
return node;
}