Package limn.backend

Record Class ImageCursor

java.lang.Object
java.lang.Record
limn.backend.ImageCursor
Record Components:
image - the cursor bitmap (straight-alpha RGBA, top-down)
hotspotX - hotspot x within the image, pixels, [0, width)
hotspotY - hotspot y within the image, pixels, [0, height)

public record ImageCursor(Image image, int hotspotX, int hotspotY) extends Record
A custom mouse cursor built from an Image (a themed crosshair, a brush outline, a spell-target reticle), where the ten stock Cursor shapes are not enough.

Widgets request one via Widget.setImageCursor(limn.backend.ImageCursor); the scene resolves it exactly like the standard shapes (walking up from the hovered leaf, an image cursor winning over a shape declared on the same widget) and pushes it to the window through NativeWindow.setImageCursor(limn.backend.ImageCursor).

The hotspot is the image pixel that sits on the click point (a crosshair centers it; an arrow puts it at the tip). Two ImageCursors are equal when they share the same Image instance and hotspot (images compare by identity). Reuse one Image per cursor design, since the backend caches the native cursor object it creates per distinct ImageCursor.

Platform note: the image is used at its pixel size 1:1 in screen coordinates; there is no HiDPI variant selection at the native layer, so on scaled displays a 32 px cursor appears visually smaller than UI content at the same nominal size. Size cursors for the display class you target.

  • Constructor Summary

    Constructors
    Constructor
    Description
    ImageCursor(Image image, int hotspotX, int hotspotY)
    Creates an instance of a ImageCursor record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the hotspotX record component.
    int
    Returns the value of the hotspotY record component.
    Returns the value of the image record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ImageCursor

      public ImageCursor(Image image, int hotspotX, int hotspotY)
      Creates an instance of a ImageCursor record class.
      Parameters:
      image - the value for the image record component
      hotspotX - the value for the hotspotX record component
      hotspotY - the value for the hotspotY record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • image

      public Image image()
      Returns the value of the image record component.
      Returns:
      the value of the image record component
    • hotspotX

      public int hotspotX()
      Returns the value of the hotspotX record component.
      Returns:
      the value of the hotspotX record component
    • hotspotY

      public int hotspotY()
      Returns the value of the hotspotY record component.
      Returns:
      the value of the hotspotY record component