Class ItemPainter


  • public class ItemPainter
    extends java.lang.Object
    Paints Crossfire item images.
    • Constructor Summary

      Constructors 
      Constructor Description
      ItemPainter​(@Nullable java.awt.Image cursedImage, @Nullable java.awt.Image damnedImage, @Nullable java.awt.Image magicImage, @Nullable java.awt.Image blessedImage, @Nullable java.awt.Image appliedImage, @Nullable java.awt.Image unidentifiedImage, @Nullable java.awt.Image selectorImage, @Nullable java.awt.Image lockedImage, @Nullable java.awt.Image unpaidImage, @Nullable java.awt.Color cursedColor, @Nullable java.awt.Color damnedColor, @Nullable java.awt.Color magicColor, @Nullable java.awt.Color blessedColor, @Nullable java.awt.Color appliedColor, @Nullable java.awt.Color unidentifiedColor, @Nullable java.awt.Color selectorColor, @Nullable java.awt.Color lockedColor, @Nullable java.awt.Color unpaidColor, @NotNull java.awt.Font font, @NotNull java.awt.Color nrofColor)
      Creates a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      @NotNull java.awt.Dimension getMinimumSize()
      Returns the minimal size needed to display this item.
      @NotNull ItemPainter newItemPainter()
      Creates a new instance having the same parameters as this instance except for the item's size.
      void paint​(@NotNull java.awt.Graphics2D g, @NotNull CfItem item, boolean selected, @NotNull java.awt.Image face, int w, int h)
      Paints an CfItem.
      • Methods inherited from class java.lang.Object

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

      • ItemPainter

        public ItemPainter​(@Nullable
                           @Nullable java.awt.Image cursedImage,
                           @Nullable
                           @Nullable java.awt.Image damnedImage,
                           @Nullable
                           @Nullable java.awt.Image magicImage,
                           @Nullable
                           @Nullable java.awt.Image blessedImage,
                           @Nullable
                           @Nullable java.awt.Image appliedImage,
                           @Nullable
                           @Nullable java.awt.Image unidentifiedImage,
                           @Nullable
                           @Nullable java.awt.Image selectorImage,
                           @Nullable
                           @Nullable java.awt.Image lockedImage,
                           @Nullable
                           @Nullable java.awt.Image unpaidImage,
                           @Nullable
                           @Nullable java.awt.Color cursedColor,
                           @Nullable
                           @Nullable java.awt.Color damnedColor,
                           @Nullable
                           @Nullable java.awt.Color magicColor,
                           @Nullable
                           @Nullable java.awt.Color blessedColor,
                           @Nullable
                           @Nullable java.awt.Color appliedColor,
                           @Nullable
                           @Nullable java.awt.Color unidentifiedColor,
                           @Nullable
                           @Nullable java.awt.Color selectorColor,
                           @Nullable
                           @Nullable java.awt.Color lockedColor,
                           @Nullable
                           @Nullable java.awt.Color unpaidColor,
                           @NotNull
                           @NotNull java.awt.Font font,
                           @NotNull
                           @NotNull java.awt.Color nrofColor)
        Creates a new instance.
        Parameters:
        cursedImage - the overlay image for cursed objects
        damnedImage - the overlay image for damned objects
        magicImage - the overlay image for magical objects
        blessedImage - the overlay image for blessed objects
        appliedImage - the overlay image for applied objects
        unidentifiedImage - the overlay image for unidentified objects
        selectorImage - the overlay image for selected objects
        lockedImage - the overlay image for locked objects
        unpaidImage - the overlay image for unpaid objects
        cursedColor - the background color for cursed objects
        damnedColor - the background color for damned objects
        magicColor - the background color for magical objects
        blessedColor - the background color for blessed objects
        appliedColor - the background color for applied objects
        unidentifiedColor - the background color for unidentified objects
        selectorColor - the background color for selected objects
        lockedColor - the background color for locked objects
        unpaidColor - the background color for unpaid objects
        font - the font for nrof information
        nrofColor - the color for nrof information
    • Method Detail

      • newItemPainter

        @NotNull
        public @NotNull ItemPainter newItemPainter()
        Creates a new instance having the same parameters as this instance except for the item's size.
        Returns:
        the new instance
      • getMinimumSize

        @NotNull
        public @NotNull java.awt.Dimension getMinimumSize()
        Returns the minimal size needed to display this item.
        Returns:
        the minimal size
      • paint

        public void paint​(@NotNull
                          @NotNull java.awt.Graphics2D g,
                          @NotNull
                          @NotNull CfItem item,
                          boolean selected,
                          @NotNull
                          @NotNull java.awt.Image face,
                          int w,
                          int h)
        Paints an CfItem.
        Parameters:
        g - the graphics instance to paint into
        item - the item
        selected - whether the item is selected
        face - the item's face
        w - the item's width in pixel
        h - the item's height in pixel