Tabnine Logo
UnitProcessor
Code IndexAdd Tabnine to your IDE (free)

How to use
UnitProcessor
in
org.apache.batik.parser

Best Java code snippets using org.apache.batik.parser.UnitProcessor (Showing top 20 results out of 315)

origin: avianey/androidsvgdrawable-plugin

private float svgLengthInPixels(SVGLength length, UnitProcessor.Context context) {
  return UnitProcessor.svgToUserSpace(length.getValueAsString(), "px", UnitProcessor.OTHER_LENGTH, context);
}
origin: fr.avianey.apache-xmlgraphics/batik

/**
 * <b>DOM</b>: Implements {@link SVGLength#setValue(float)}.
 */
public void setValue(float value) throws DOMException {
  this.value = UnitProcessor.userSpaceToSVG(value, unitType,
                       direction, context);
  reset();
}
origin: apache/batik

  return (v * (6f * ctx.getPixelUnitToMillimeter()) / 25.4f);
case SVGLength.SVG_LENGTHTYPE_EMS:
  return pixelsToEms(v, d, ctx);
case SVGLength.SVG_LENGTHTYPE_EXS:
  return pixelsToExs(v, d, ctx);
case SVGLength.SVG_LENGTHTYPE_PERCENTAGE:
  return pixelsToPercentages(v, d, ctx);
default:
  throw new IllegalArgumentException("Length has unknown type");
origin: fr.avianey.apache-xmlgraphics/batik

  return (v * 25.4f / (6f * ctx.getPixelUnitToMillimeter()));
case SVGLength.SVG_LENGTHTYPE_EMS:
  return emsToPixels(v, d, ctx);
case SVGLength.SVG_LENGTHTYPE_EXS:
  return exsToPixels(v, d, ctx);
case SVGLength.SVG_LENGTHTYPE_PERCENTAGE:
  return percentagesToPixels(v, d, ctx);
default:
  throw new IllegalArgumentException("Length has unknown type");
origin: org.apache.xmlgraphics/batik-bridge

/**
 * Returns the specified value with the specified direction in
 * objectBoundingBox units.
 *
 * @param s the value
 * @param attr the attribute name that represents the value
 * @param d the direction of the value
 * @param ctx the context used to resolve relative value
 */
public static float svgToObjectBoundingBox(String s,
                      String attr,
                      short d,
                      Context ctx) {
  try {
    return org.apache.batik.parser.UnitProcessor.
      svgToObjectBoundingBox(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 });
  }
}
origin: org.apache.xmlgraphics/batik-parser

  return (v * (6f * ctx.getPixelUnitToMillimeter()) / 25.4f);
case SVGLength.SVG_LENGTHTYPE_EMS:
  return pixelsToEms(v, d, ctx);
case SVGLength.SVG_LENGTHTYPE_EXS:
  return pixelsToExs(v, d, ctx);
case SVGLength.SVG_LENGTHTYPE_PERCENTAGE:
  return pixelsToPercentages(v, d, ctx);
default:
  throw new IllegalArgumentException("Length has unknown type");
origin: apache/batik

  return (v * 25.4f / (6f * ctx.getPixelUnitToMillimeter()));
case SVGLength.SVG_LENGTHTYPE_EMS:
  return emsToPixels(v, d, ctx);
case SVGLength.SVG_LENGTHTYPE_EXS:
  return exsToPixels(v, d, ctx);
case SVGLength.SVG_LENGTHTYPE_PERCENTAGE:
  return percentagesToPixels(v, d, ctx);
default:
  throw new IllegalArgumentException("Length has unknown type");
origin: apache/batik

/**
 * Returns the specified value with the specified direction in
 * objectBoundingBox units.
 *
 * @param s the value
 * @param attr the attribute name that represents the value
 * @param d the direction of the value
 * @param ctx the context used to resolve relative value
 */
public static float svgToObjectBoundingBox(String s,
                      String attr,
                      short d,
                      Context ctx) {
  try {
    return org.apache.batik.parser.UnitProcessor.
      svgToObjectBoundingBox(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 });
  }
}
origin: org.apache.xmlgraphics/batik-parser

  return svgToUserSpace(value, type, d, ctx);
default:
  throw new IllegalArgumentException("Length has unknown type");
origin: fr.avianey.apache-xmlgraphics/batik

  return (v * (6f * ctx.getPixelUnitToMillimeter()) / 25.4f);
case SVGLength.SVG_LENGTHTYPE_EMS:
  return pixelsToEms(v, d, ctx);
case SVGLength.SVG_LENGTHTYPE_EXS:
  return pixelsToExs(v, d, ctx);
case SVGLength.SVG_LENGTHTYPE_PERCENTAGE:
  return pixelsToPercentages(v, d, ctx);
default:
  throw new IllegalArgumentException("Length has unknown type");
origin: org.apache.xmlgraphics/batik-parser

  return (v * 25.4f / (6f * ctx.getPixelUnitToMillimeter()));
case SVGLength.SVG_LENGTHTYPE_EMS:
  return emsToPixels(v, d, ctx);
case SVGLength.SVG_LENGTHTYPE_EXS:
  return exsToPixels(v, d, ctx);
case SVGLength.SVG_LENGTHTYPE_PERCENTAGE:
  return percentagesToPixels(v, d, ctx);
default:
  throw new IllegalArgumentException("Length has unknown type");
origin: fr.avianey.apache-xmlgraphics/batik

/**
 * Returns the specified value with the specified direction in
 * objectBoundingBox units.
 *
 * @param s the value
 * @param attr the attribute name that represents the value
 * @param d the direction of the value
 * @param ctx the context used to resolve relative value
 */
public static float svgToObjectBoundingBox(String s,
                      String attr,
                      short d,
                      Context ctx) {
  try {
    return org.apache.batik.parser.UnitProcessor.
      svgToObjectBoundingBox(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 });
  }
}
origin: org.apache.xmlgraphics/batik-anim

/**
 * <b>DOM</b>: Implements {@link SVGLength#setValue(float)}.
 */
public void setValue(float value) throws DOMException {
  this.value = UnitProcessor.userSpaceToSVG(value, unitType,
                       direction, context);
  reset();
}
origin: apache/batik

  return svgToUserSpace(value, type, d, ctx);
default:
  throw new IllegalArgumentException("Length has unknown type");
origin: org.apache.xmlgraphics/batik-parser

/**
 * Returns the specified value with the specified direction in
 * objectBoundingBox units.
 *
 * @param s the value
 * @param attr the attribute name that represents the value
 * @param d the direction of the value
 * @param ctx the context used to resolve relative value
 */
public static float svgToObjectBoundingBox(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 svgToObjectBoundingBox(ur.value, ur.unit, d, ctx);
}
origin: apache/batik

/**
 * <b>DOM</b>: Implements {@link SVGLength#setValue(float)}.
 */
public void setValue(float value) throws DOMException {
  this.value = UnitProcessor.userSpaceToSVG(value, unitType,
                       direction, context);
  reset();
}
origin: fr.avianey.apache-xmlgraphics/batik

  return svgToUserSpace(value, type, d, ctx);
default:
  throw new IllegalArgumentException("Length has unknown type");
origin: fr.avianey.apache-xmlgraphics/batik

/**
 * Returns the specified value with the specified direction in
 * objectBoundingBox units.
 *
 * @param s the value
 * @param attr the attribute name that represents the value
 * @param d the direction of the value
 * @param ctx the context used to resolve relative value
 */
public static float svgToObjectBoundingBox(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 svgToObjectBoundingBox(ur.value, ur.unit, d, ctx);
}
origin: org.apache.xmlgraphics/batik-anim

/**
 * <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;
  }
}
origin: apache/batik

/**
 * Returns the specified value with the specified direction in
 * objectBoundingBox units.
 *
 * @param s the value
 * @param attr the attribute name that represents the value
 * @param d the direction of the value
 * @param ctx the context used to resolve relative value
 */
public static float svgToObjectBoundingBox(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 svgToObjectBoundingBox(ur.value, ur.unit, d, ctx);
}
org.apache.batik.parserUnitProcessor

Javadoc

This class provides methods to convert SVG length and coordinate to float in user units.

Most used methods

  • svgToUserSpace
    Returns the specified coordinate with the specified direction in user units.
  • svgToObjectBoundingBox
    Returns the specified value with the specified direction in objectBoundingBox units.
  • emsToPixels
    Converts ems units to user units.
  • exsToPixels
    Converts exs units to user units.
  • percentagesToPixels
    Converts percentages to user units.
  • pixelsToEms
    Converts user units to ems units.
  • pixelsToExs
    Converts user units to exs units.
  • pixelsToPercentages
    Converts user units to percentages relative to the viewport.
  • userSpaceToSVG
    Converts the specified value of the specified type and direction to SVG units.

Popular in Java

  • Updating database using SQL prepared statement
  • getSupportFragmentManager (FragmentActivity)
  • compareTo (BigDecimal)
  • putExtra (Intent)
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • JOptionPane (javax.swing)
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now