java.lang.Object
org.apache.batik.bridge.UserAgentAdapter
de.klassenserver7b.danceinterpreter.graphics.util.icons.SVGIcon
All Implemented Interfaces:
Icon, org.apache.batik.bridge.UserAgent

public class SVGIcon extends org.apache.batik.bridge.UserAgentAdapter implements Icon
A Swing Icon that draws an SVG image.
Author:
Cameron McCormack
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected class 
    A transcoder that generates a BufferedImage.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected BufferedImage
    The BufferedImage generated from the SVG document.
    protected int
    The height of the rendered image.
    protected int
    The width of the rendered image.

    Fields inherited from class org.apache.batik.bridge.UserAgentAdapter

    ctx, extensions, FEATURES
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a new SVGIcon object.
    SVGIcon(String uri, int w, int h)
    Create a new SVGIcon object.
    Create a new SVGIcon object.
    SVGIcon(Document doc, int w, int h)
    Create a new SVGIcon object.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    generateBufferedImage(org.apache.batik.transcoder.TranscoderInput in, int w, int h)
    Generate the BufferedImage.
    int
    Returns the icon's height.
    int
    Returns the icon's width.
     
    Returns the default size of this user agent.
    void
    paintIcon(Component c, Graphics g, int x, int y)
    Draw the icon at the specified location.

    Methods inherited from class org.apache.batik.bridge.UserAgentAdapter

    addStdFeatures, checkLoadExternalResource, checkLoadScript, deselectAll, displayError, displayError, displayMessage, getAlternateStyleSheet, getBolderFontWeight, getBrokenLinkDocument, getClientAreaLocationOnScreen, getDefaultFontFamily, getEventDispatcher, getExternalResourceSecurity, getFontFamilyResolver, getLanguages, getLighterFontWeight, getMedia, getMediumFontSize, getPixelToMM, getPixelUnitToMillimeter, getScriptSecurity, getStandardBolderFontWeight, getStandardLighterFontWeight, getTransform, getUserStyleSheetURI, getXMLParserClassName, handleElement, hasFeature, isXMLParserValidating, loadDocument, openLink, registerExtension, runThread, setBridgeContext, setSVGCursor, setTextSelection, setTransform, showAlert, showConfirm, showPrompt, showPrompt, supportExtension

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • bufferedImage

      protected BufferedImage bufferedImage
      The BufferedImage generated from the SVG document.
    • width

      protected int width
      The width of the rendered image.
    • height

      protected int height
      The height of the rendered image.
  • Constructor Details

    • SVGIcon

      public SVGIcon(String uri) throws org.apache.batik.transcoder.TranscoderException
      Create a new SVGIcon object.
      Parameters:
      uri - The URI to read the SVG document from.
      Throws:
      org.apache.batik.transcoder.TranscoderException
    • SVGIcon

      public SVGIcon(String uri, int w, int h) throws org.apache.batik.transcoder.TranscoderException
      Create a new SVGIcon object.
      Parameters:
      uri - The URI to read the SVG document from.
      w - The width of the icon.
      h - The height of the icon.
      Throws:
      org.apache.batik.transcoder.TranscoderException
    • SVGIcon

      public SVGIcon(Document doc) throws org.apache.batik.transcoder.TranscoderException
      Create a new SVGIcon object.
      Parameters:
      doc - The SVG document.
      Throws:
      org.apache.batik.transcoder.TranscoderException
    • SVGIcon

      public SVGIcon(Document doc, int w, int h) throws org.apache.batik.transcoder.TranscoderException
      Create a new SVGIcon object.
      Parameters:
      doc - The SVG document.
      w - The width of the icon.
      h - The height of the icon.
      Throws:
      org.apache.batik.transcoder.TranscoderException
  • Method Details

    • generateBufferedImage

      protected void generateBufferedImage(org.apache.batik.transcoder.TranscoderInput in, int w, int h) throws org.apache.batik.transcoder.TranscoderException
      Generate the BufferedImage.
      Throws:
      org.apache.batik.transcoder.TranscoderException
    • getIconWidth

      public int getIconWidth()
      Returns the icon's width.
      Specified by:
      getIconWidth in interface Icon
    • getIconHeight

      public int getIconHeight()
      Returns the icon's height.
      Specified by:
      getIconHeight in interface Icon
    • paintIcon

      public void paintIcon(Component c, Graphics g, int x, int y)
      Draw the icon at the specified location.
      Specified by:
      paintIcon in interface Icon
    • getImage

      public BufferedImage getImage()
    • getViewportSize

      public Dimension2D getViewportSize()
      Returns the default size of this user agent.
      Specified by:
      getViewportSize in interface org.apache.batik.bridge.UserAgent
      Overrides:
      getViewportSize in class org.apache.batik.bridge.UserAgentAdapter