return svgToUserSpace(value, type, d, ctx); default: throw new IllegalArgumentException("Length has unknown type");
private float svgLengthInPixels(SVGLength length, UnitProcessor.Context context) { return UnitProcessor.svgToUserSpace(length.getValueAsString(), "px", UnitProcessor.OTHER_LENGTH, context); }
return svgToUserSpace(value, type, d, ctx); default: throw new IllegalArgumentException("Length has unknown type");
return svgToUserSpace(value, type, d, ctx); default: throw new IllegalArgumentException("Length has unknown type");
/** * <b>DOM</b>: Implements {@link SVGLength#getValue()}. */ public float getValue() { revalidate(); try { return UnitProcessor.svgToUserSpace(value, unitType, direction, context); } catch (IllegalArgumentException ex) { // XXX Should we throw an exception here when the length // type is unknown? return 0f; } }
private float svgLengthInPixels(SVGLength length, UnitProcessor.Context context) { return UnitProcessor.svgToUserSpace(length.getValueAsString(), "px", UnitProcessor.OTHER_LENGTH, context); }
/** * <b>DOM</b>: Implements {@link SVGLength#getValue()}. */ public float getValue() { revalidate(); try { return UnitProcessor.svgToUserSpace(value, unitType, direction, context); } catch (IllegalArgumentException ex) { // XXX Should we throw an exception here when the length // type is unknown? return 0f; } }
/** * <b>DOM</b>: Implements {@link SVGLength#getValue()}. */ public float getValue() { revalidate(); try { return UnitProcessor.svgToUserSpace(value, unitType, direction, context); } catch (IllegalArgumentException ex) { // XXX Should we throw an exception here when the length // type is unknown? return 0f; } }
/** * Converts the given SVG length into user units. * @param v the SVG length value * @param type the SVG length units (one of the * {@link SVGLength}.SVG_LENGTH_* constants) * @param pcInterp how to interpretet percentage values (one of the * {@link SVGContext}.PERCENTAGE_* constants) * @return the SVG value in user units */ public float svgToUserSpace(float v, short type, short pcInterp) { if (unitContext == null) { unitContext = new UnitContext(); } if (pcInterp == PERCENTAGE_FONT_SIZE && type == SVGLength.SVG_LENGTHTYPE_PERCENTAGE) { // XXX return 0f; } else { return UnitProcessor.svgToUserSpace(v, type, (short) (3 - pcInterp), unitContext); } }
/** * Converts the given SVG length into user units. * @param v the SVG length value * @param type the SVG length units (one of the * {@link SVGLength}.SVG_LENGTH_* constants) * @param pcInterp how to interpretet percentage values (one of the * {@link SVGContext}.PERCENTAGE_* constants) * @return the SVG value in user units */ public float svgToUserSpace(float v, short type, short pcInterp) { if (unitContext == null) { unitContext = new UnitContext(); } if (pcInterp == PERCENTAGE_FONT_SIZE && type == SVGLength.SVG_LENGTHTYPE_PERCENTAGE) { // XXX return 0f; } else { return UnitProcessor.svgToUserSpace(v, type, (short) (3 - pcInterp), unitContext); } }
/** * Converts the given SVG length into user units. * @param v the SVG length value * @param type the SVG length units (one of the * {@link SVGLength}.SVG_LENGTH_* constants) * @param pcInterp how to interpretet percentage values (one of the * {@link SVGContext}.PERCENTAGE_* constants) * @return the SVG value in user units */ public float svgToUserSpace(float v, short type, short pcInterp) { if (unitContext == null) { unitContext = new UnitContext(); } if (pcInterp == PERCENTAGE_FONT_SIZE && type == SVGLength.SVG_LENGTHTYPE_PERCENTAGE) { // XXX return 0f; } else { return UnitProcessor.svgToUserSpace(v, type, (short) (3 - pcInterp), unitContext); } }
/** * Returns the specified coordinate with the specified direction * in user units. * * @param s the 'other' coordinate * @param attr the attribute name that represents the length * @param d the direction of the coordinate * @param ctx the context used to resolve relative value */ public static float svgToUserSpace(String s, String attr, short d, Context ctx) { try { return org.apache.batik.parser.UnitProcessor. svgToUserSpace(s, attr, d, ctx); } catch (ParseException pEx ) { throw new BridgeException (getBridgeContext(ctx), ctx.getElement(), pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, s, pEx, }); } }
/** * Returns the specified coordinate with the specified direction * in user units. * * @param s the 'other' coordinate * @param attr the attribute name that represents the length * @param d the direction of the coordinate * @param ctx the context used to resolve relative value */ public static float svgToUserSpace(String s, String attr, short d, Context ctx) { try { return org.apache.batik.parser.UnitProcessor. svgToUserSpace(s, attr, d, ctx); } catch (ParseException pEx ) { throw new BridgeException (getBridgeContext(ctx), ctx.getElement(), pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, s, pEx, }); } }
/** * Returns the specified coordinate with the specified direction * in user units. * * @param s the 'other' coordinate * @param attr the attribute name that represents the length * @param d the direction of the coordinate * @param ctx the context used to resolve relative value */ public static float svgToUserSpace(String s, String attr, short d, Context ctx) { try { return org.apache.batik.parser.UnitProcessor. svgToUserSpace(s, attr, d, ctx); } catch (ParseException pEx ) { throw new BridgeException (getBridgeContext(ctx), ctx.getElement(), pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attr, s, pEx, }); } }
/** * Returns the specified coordinate with the specified direction * in user units. * * @param s the 'other' coordinate * @param attr the attribute name that represents the length * @param d the direction of the coordinate * @param ctx the context used to resolve relative value */ public static float svgToUserSpace(String s, String attr, short d, Context ctx) throws ParseException { LengthParser lengthParser = new LengthParser(); UnitResolver ur = new UnitResolver(); lengthParser.setLengthHandler(ur); lengthParser.parse(s); return svgToUserSpace(ur.value, ur.unit, d, ctx); }
/** * Returns the specified coordinate with the specified direction * in user units. * * @param s the 'other' coordinate * @param attr the attribute name that represents the length * @param d the direction of the coordinate * @param ctx the context used to resolve relative value */ public static float svgToUserSpace(String s, String attr, short d, Context ctx) throws ParseException { LengthParser lengthParser = new LengthParser(); UnitResolver ur = new UnitResolver(); lengthParser.setLengthHandler(ur); lengthParser.parse(s); return svgToUserSpace(ur.value, ur.unit, d, ctx); }
/** * Returns the specified coordinate with the specified direction * in user units. * * @param s the 'other' coordinate * @param attr the attribute name that represents the length * @param d the direction of the coordinate * @param ctx the context used to resolve relative value */ public static float svgToUserSpace(String s, String attr, short d, Context ctx) throws ParseException { LengthParser lengthParser = new LengthParser(); UnitResolver ur = new UnitResolver(); lengthParser.setLengthHandler(ur); lengthParser.parse(s); return svgToUserSpace(ur.value, ur.unit, d, ctx); }