Class SpriteUtility


  • public class SpriteUtility
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      SpriteUtility()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.awt.image.BufferedImage getItemOutlineSprite​(int itemId, int itemQuantity, java.awt.Color outlineColor)
      Get item outline with a specific color.
      static AsyncBufferedImage getItemSprite​(int itemId)
      Get item sprite image as BufferedImage.
      static AsyncBufferedImage getItemSprite​(int itemId, int quantity, boolean stackable)
      Get item sprite image as BufferedImage.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SpriteUtility

        public SpriteUtility()
    • Method Detail

      • getItemSprite

        @Nullable
        public static AsyncBufferedImage getItemSprite​(int itemId)
        Get item sprite image as BufferedImage.

        This method may return immediately with a blank image if not called on the game thread. The image will be filled in later. If this is used for a UI label/button, it should be added using AsyncBufferedImage::addTo to ensure it is painted properly

        Parameters:
        itemId -
        Returns:
        image
      • getItemSprite

        @Nullable
        public static AsyncBufferedImage getItemSprite​(int itemId,
                                                       int quantity,
                                                       boolean stackable)
        Get item sprite image as BufferedImage.

        This method may return immediately with a blank image if not called on the game thread. The image will be filled in later. If this is used for a UI label/button, it should be added using AsyncBufferedImage::addTo to ensure it is painted properly

        Parameters:
        itemId - item id
        quantity - item quantity
        stackable - whether the item is stackable
        Returns:
        image
      • getItemOutlineSprite

        @Nullable
        public static java.awt.image.BufferedImage getItemOutlineSprite​(int itemId,
                                                                        int itemQuantity,
                                                                        java.awt.Color outlineColor)
        Get item outline with a specific color.
        Parameters:
        itemId - item id
        itemQuantity - item quantity
        outlineColor - outline color
        Returns:
        image