protected void gatherRegionInfo(BridgeContext ctx, Element rgn, float verticalAlign, List regions) { for (Node n = rgn.getFirstChild(); n != null; n = n.getNextSibling()) { if (n.getNodeType() != Node.ELEMENT_NODE) continue; if (!getNamespaceURI().equals(n.getNamespaceURI())) continue; Element e = (Element)n; String ln = n.getLocalName(); if (ln.equals(SVGConstants.SVG_RECT_TAG)) { UnitProcessor.Context uctx; uctx = UnitProcessor.createContext(ctx, e); RegionInfo ri = buildRegion(uctx, e, verticalAlign); if (ri != null) regions.add(ri); } } }
protected void gatherRegionInfo(BridgeContext ctx, Element rgn, float verticalAlign, List regions) { for (Node n = rgn.getFirstChild(); n != null; n = n.getNextSibling()) { if (n.getNodeType() != Node.ELEMENT_NODE) continue; if (!getNamespaceURI().equals(n.getNamespaceURI())) continue; Element e = (Element)n; String ln = n.getLocalName(); if (ln.equals(SVGConstants.SVG_RECT_TAG)) { UnitProcessor.Context uctx; uctx = UnitProcessor.createContext(ctx, e); RegionInfo ri = buildRegion(uctx, e, verticalAlign); if (ri != null) regions.add(ri); } } }
protected void gatherRegionInfo(BridgeContext ctx, Element rgn, float verticalAlign, List regions) { for (Node n = rgn.getFirstChild(); n != null; n = n.getNextSibling()) { if (n.getNodeType() != Node.ELEMENT_NODE) continue; if (!getNamespaceURI().equals(n.getNamespaceURI())) continue; Element e = (Element)n; String ln = n.getLocalName(); if (ln.equals(SVGConstants.SVG_RECT_TAG)) { UnitProcessor.Context uctx; uctx = UnitProcessor.createContext(ctx, e); RegionInfo ri = buildRegion(uctx, e, verticalAlign); if (ri != null) regions.add(ri); } } }
/** * Returns the float list that represents a set of values or percentage. * * * @param element the element that defines the specified coordinates * @param attrName the name of the attribute (used by error handling) * @param valueStr the delimited string containing values of the coordinate * @param ctx the bridge context */ public static ArrayList svgVerticalCoordinateArrayToUserSpace(Element element, String attrName, String valueStr, BridgeContext ctx) { UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, element); ArrayList values = new ArrayList(); StringTokenizer st = new StringTokenizer(valueStr, ", ", false); while (st.hasMoreTokens()) { values.add (UnitProcessor.svgVerticalCoordinateToUserSpace (st.nextToken(), attrName, uctx)); } return values; }
/** * Returns the float list that represents a set of horizontal * values or percentage. * * @param element the element that defines the specified coordinates * @param attrName the name of the attribute (used by error handling) * @param valueStr the delimited string containing values of the coordinate * @param ctx the bridge context */ public static ArrayList svgHorizontalCoordinateArrayToUserSpace(Element element, String attrName, String valueStr, BridgeContext ctx) { UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, element); ArrayList values = new ArrayList(); StringTokenizer st = new StringTokenizer(valueStr, ", ", false); while (st.hasMoreTokens()) { values.add (new Float(UnitProcessor.svgHorizontalCoordinateToUserSpace (st.nextToken(), attrName, uctx))); } return values; }
/** * Returns the float list that represents a set of horizontal * values or percentage. * * @param element the element that defines the specified coordinates * @param attrName the name of the attribute (used by error handling) * @param valueStr the delimited string containing values of the coordinate * @param ctx the bridge context */ public static ArrayList svgHorizontalCoordinateArrayToUserSpace(Element element, String attrName, String valueStr, BridgeContext ctx) { UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, element); ArrayList values = new ArrayList(); StringTokenizer st = new StringTokenizer(valueStr, ", ", false); while (st.hasMoreTokens()) { values.add (UnitProcessor.svgHorizontalCoordinateToUserSpace (st.nextToken(), attrName, uctx)); } return values; }
/** * Returns the float list that represents a set of values or percentage. * * * @param element the element that defines the specified coordinates * @param attrName the name of the attribute (used by error handling) * @param valueStr the delimited string containing values of the coordinate * @param ctx the bridge context */ public static ArrayList svgVerticalCoordinateArrayToUserSpace(Element element, String attrName, String valueStr, BridgeContext ctx) { UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, element); ArrayList values = new ArrayList(); StringTokenizer st = new StringTokenizer(valueStr, ", ", false); while (st.hasMoreTokens()) { values.add (new Float(UnitProcessor.svgVerticalCoordinateToUserSpace (st.nextToken(), attrName, uctx))); } return values; }
/** * Returns the float list that represents a set of horizontal * values or percentage. * * @param element the element that defines the specified coordinates * @param attrName the name of the attribute (used by error handling) * @param valueStr the delimited string containing values of the coordinate * @param ctx the bridge context */ public static ArrayList svgHorizontalCoordinateArrayToUserSpace(Element element, String attrName, String valueStr, BridgeContext ctx) { UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, element); ArrayList values = new ArrayList(); StringTokenizer st = new StringTokenizer(valueStr, ", ", false); while (st.hasMoreTokens()) { values.add (UnitProcessor.svgHorizontalCoordinateToUserSpace (st.nextToken(), attrName, uctx)); } return values; }
/** * Returns the float list that represents a set of values or percentage. * * * @param element the element that defines the specified coordinates * @param attrName the name of the attribute (used by error handling) * @param valueStr the delimited string containing values of the coordinate * @param ctx the bridge context */ public static ArrayList svgVerticalCoordinateArrayToUserSpace(Element element, String attrName, String valueStr, BridgeContext ctx) { UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, element); ArrayList values = new ArrayList(); StringTokenizer st = new StringTokenizer(valueStr, ", ", false); while (st.hasMoreTokens()) { values.add (UnitProcessor.svgVerticalCoordinateToUserSpace (st.nextToken(), attrName, uctx)); } return values; }
/** * Associates the {@link SVGContext} with the element. This method should * be called even for static documents, since some bridges will need to * access animated attribute values even during the first build. */ protected void associateSVGContext(BridgeContext ctx, Element e, GraphicsNode node) { this.e = e; this.node = node; this.ctx = ctx; this.unitContext = UnitProcessor.createContext(ctx, e); this.isSVG12 = ctx.isSVG12(); ((SVGOMElement)e).setSVGContext(this); }
/** * Associates the {@link SVGContext} with the element. This method should * be called even for static documents, since some bridges will need to * access animated attribute values even during the first build. */ protected void associateSVGContext(BridgeContext ctx, Element e, GraphicsNode node) { this.e = e; this.node = node; this.ctx = ctx; this.unitContext = UnitProcessor.createContext(ctx, e); this.isSVG12 = ctx.isSVG12(); ((SVGOMElement)e).setSVGContext(this); }
/** * Associates the {@link SVGContext} with the element. This method should * be called even for static documents, since some bridges will need to * access animated attribute values even during the first build. */ protected void associateSVGContext(BridgeContext ctx, Element e, GraphicsNode node) { this.e = e; this.node = node; this.ctx = ctx; this.unitContext = UnitProcessor.createContext(ctx, e); this.isSVG12 = ctx.isSVG12(); ((SVGOMElement)e).setSVGContext(this); }
uctx = UnitProcessor.createContext(ctx, filteredElement);
uctx = UnitProcessor.createContext(ctx, filteredElement);
Rectangle2D getImageBounds(BridgeContext ctx, Element element) { UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, element);
Rectangle2D getImageBounds(BridgeContext ctx, Element element) { UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, element);
protected void transcode(Document document, String uri, TranscoderOutput output) throws TranscoderException { setupImageInfrastructure(uri); super.transcode(document, uri, output); if (getLogger().isTraceEnabled()) { getLogger().trace("document size: " + width + " x " + height); } // prepare the image to be painted UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, document.getDocumentElement()); float widthInPt = UnitProcessor.userSpaceToSVG(width, SVGLength.SVG_LENGTHTYPE_PT, UnitProcessor.HORIZONTAL_LENGTH, uctx); int w = (int) (widthInPt + 0.5); float heightInPt = UnitProcessor.userSpaceToSVG(height, SVGLength.SVG_LENGTHTYPE_PT, UnitProcessor.HORIZONTAL_LENGTH, uctx); int h = (int) (heightInPt + 0.5); if (getLogger().isTraceEnabled()) { getLogger().trace("document size: " + w + "pt x " + h + "pt"); } this.root.paint(graphics); } }
UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, e);
UnitProcessor.Context context = org.apache.batik.bridge.UnitProcessor.createContext( new BridgeContext(userAgent), svgElement);
UnitProcessor.Context context = org.apache.batik.bridge.UnitProcessor.createContext( new BridgeContext(userAgent), svgElement);