Class CursorManager

java.lang.Object
org.apache.batik.bridge.CursorManager
All Implemented Interfaces:
ErrorConstants, XMLConstants, CSSConstants, SVGConstants

public class CursorManager extends Object implements SVGConstants, ErrorConstants
The CursorManager class is a helper class which preloads the cursors corresponding to the SVG built in cursors.
Version:
$Id: CursorManager.java 1810674 2017-10-03 09:12:00Z ssteiner $
  • Field Details

    • cursorMap

      protected static Map cursorMap
      Maps SVG Cursor Values to Java Cursors
    • DEFAULT_CURSOR

      public static final Cursor DEFAULT_CURSOR
      Default cursor when value is not found
    • ANCHOR_CURSOR

      public static final Cursor ANCHOR_CURSOR
      Cursor used over anchors
    • TEXT_CURSOR

      public static final Cursor TEXT_CURSOR
      Cursor used over text
    • DEFAULT_PREFERRED_WIDTH

      public static final int DEFAULT_PREFERRED_WIDTH
      Default preferred cursor size, used for SVG images
      See Also:
    • DEFAULT_PREFERRED_HEIGHT

      public static final int DEFAULT_PREFERRED_HEIGHT
      See Also:
    • ctx

      protected BridgeContext ctx
      BridgeContext associated with this CursorManager
    • cursorCache

      protected CursorManager.CursorCache cursorCache
      Cache used to hold references to cursors
  • Constructor Details

    • CursorManager

      public CursorManager(BridgeContext ctx)
      Creates a new CursorManager object.
      Parameters:
      ctx - the BridgeContext associated to this CursorManager
  • Method Details

    • getPredefinedCursor

      public static Cursor getPredefinedCursor(String cursorName)
      Returns a Cursor object for a given cursor value. This initial implementation does not handle user-defined cursors, so it always uses the cursor at the end of the list
    • convertCursor

      public Cursor convertCursor(Element e)
      Returns the Cursor corresponding to the input element's cursor property
      Parameters:
      e - the element on which the cursor property is set
    • convertBuiltInCursor

      public Cursor convertBuiltInCursor(Element e, String cursorStr)
    • convertSVGCursor

      public Cursor convertSVGCursor(Element e, Value l)
      Returns a cursor for the given value list. Note that the code assumes that the input value has at least two entries. So the caller should check that before calling the method. For example, CSSUtilities.convertCursor performs that check.
    • convertSVGCursorElement

      public Cursor convertSVGCursorElement(Element cursorElement)
      Returns a cursor for a given element
    • cursorHrefToFilter

      protected Filter cursorHrefToFilter(Element cursorElement, ParsedURL purl, Point2D hotSpot)
      Converts the input ParsedURL into a Filter and transforms the input hotSpot point (in image space) to cursor space
    • renderedImageToImage

      protected Image renderedImageToImage(RenderedImage ri)
      Implementation helper: converts a RenderedImage to an Image