public class ItemPainter
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.awt.Color |
appliedColor
The background color for applied objects.
|
private java.awt.Image |
appliedImage
The overlay image for applied objects.
|
private java.awt.Color |
blessedColor
The background color for blessed objects.
|
private java.awt.Image |
blessedImage
The overlay image for blessed objects.
|
private java.awt.Color |
cursedColor
The background color for cursed objects.
|
private java.awt.Image |
cursedImage
The overlay image for cursed objects.
|
private java.awt.Color |
damnedColor
The background color for damned objects.
|
private java.awt.Image |
damnedImage
The overlay image for damned objects.
|
private java.awt.Font |
font
The font for the "nrof" text.
|
private java.awt.Color |
lockedColor
The background color for locked objects.
|
private java.awt.Image |
lockedImage
The overlay image for locked objects.
|
private java.awt.Color |
magicColor
The background color for magical objects.
|
private java.awt.Image |
magicImage
The overlay image for magical objects.
|
private java.awt.Color |
nrofColor
The color for the "nrof" text.
|
private java.awt.Color |
selectorColor
The background color for selected objects.
|
private java.awt.Image |
selectorImage
The overlay image for selected objects.
|
private static int |
TEXT_OFFSET
The indentation of the item's text from the icon.
|
private java.awt.Color |
unidentifiedColor
The background color for unidentified objects.
|
private java.awt.Image |
unidentifiedImage
The overlay image for unidentified objects.
|
private java.awt.Color |
unpaidColor
The background color for unpaid objects.
|
private java.awt.Image |
unpaidImage
The overlay image for unpaid objects.
|
Constructor and Description |
---|
ItemPainter(java.awt.Image cursedImage,
java.awt.Image damnedImage,
java.awt.Image magicImage,
java.awt.Image blessedImage,
java.awt.Image appliedImage,
java.awt.Image unidentifiedImage,
java.awt.Image selectorImage,
java.awt.Image lockedImage,
java.awt.Image unpaidImage,
java.awt.Color cursedColor,
java.awt.Color damnedColor,
java.awt.Color magicColor,
java.awt.Color blessedColor,
java.awt.Color appliedColor,
java.awt.Color unidentifiedColor,
java.awt.Color selectorColor,
java.awt.Color lockedColor,
java.awt.Color unpaidColor,
java.awt.Font font,
java.awt.Color nrofColor)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
java.awt.Dimension |
getMinimumSize()
Returns the minimal size needed to display this item.
|
ItemPainter |
newItemPainter()
Creates a new instance having the same parameters as this instance except
for the item's size.
|
void |
paint(java.awt.Graphics2D g,
CfItem item,
boolean selected,
java.awt.Image face,
int w,
int h)
Paints an
CfItem . |
private static void |
paintColor(java.awt.Graphics g,
java.awt.Color color,
boolean isActive,
int w,
int h)
Conditionally paints the background with a solid color.
|
private static void |
paintImage(java.awt.Graphics g,
java.awt.Image image,
boolean isActive)
Conditionally paints an image.
|
private void |
renderText(java.awt.Graphics2D g,
int dx,
int dy,
int height,
java.lang.String text)
Renders a text string.
|
private static void |
updateMinimumSize(java.awt.Dimension minimumSize,
java.awt.Image image)
Updates the minimum size to contain an image.
|
@Nullable private final java.awt.Color appliedColor
@Nullable private final java.awt.Image appliedImage
@Nullable private final java.awt.Color blessedColor
@Nullable private final java.awt.Image blessedImage
@Nullable private final java.awt.Color cursedColor
@Nullable private final java.awt.Image cursedImage
@Nullable private final java.awt.Color damnedColor
@Nullable private final java.awt.Image damnedImage
@NotNull private final java.awt.Font font
@Nullable private final java.awt.Color lockedColor
@Nullable private final java.awt.Image lockedImage
@Nullable private final java.awt.Color magicColor
@Nullable private final java.awt.Image magicImage
@NotNull private final java.awt.Color nrofColor
@Nullable private final java.awt.Color selectorColor
@Nullable private final java.awt.Image selectorImage
private static final int TEXT_OFFSET
@Nullable private final java.awt.Color unidentifiedColor
@Nullable private final java.awt.Image unidentifiedImage
@Nullable private final java.awt.Color unpaidColor
@Nullable private final java.awt.Image unpaidImage
public 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)
cursedImage
- the overlay image for cursed objectsdamnedImage
- the overlay image for damned objectsmagicImage
- the overlay image for magical objectsblessedImage
- the overlay image for blessed objectsappliedImage
- the overlay image for applied objectsunidentifiedImage
- the overlay image for unidentified objectsselectorImage
- the overlay image for selected objectslockedImage
- the overlay image for locked objectsunpaidImage
- the overlay image for unpaid objectscursedColor
- the background color for cursed objectsdamnedColor
- the background color for damned objectsmagicColor
- the background color for magical objectsblessedColor
- the background color for blessed objectsappliedColor
- the background color for applied objectsunidentifiedColor
- the background color for unidentified objectsselectorColor
- the background color for selected objectslockedColor
- the background color for locked objectsunpaidColor
- the background color for unpaid objectsfont
- the font for nrof informationnrofColor
- the color for nrof information@NotNull public java.awt.Dimension getMinimumSize()
@NotNull public ItemPainter newItemPainter()
public void paint(@NotNull java.awt.Graphics2D g, @NotNull CfItem item, boolean selected, @NotNull java.awt.Image face, int w, int h)
CfItem
.g
- the graphics instance to paint intoitem
- the itemselected
- whether the item is selectedface
- the item's facew
- the item's width in pixelh
- the item's height in pixelprivate static void paintColor(@NotNull java.awt.Graphics g, @Nullable java.awt.Color color, boolean isActive, int w, int h)
g
- the context to paint intocolor
- the color to useisActive
- whether painting should be done at allw
- the item's width in pixelh
- the item's height in pixelprivate static void paintImage(@NotNull java.awt.Graphics g, @Nullable java.awt.Image image, boolean isActive)
g
- the context to paint intoimage
- the image to paintisActive
- whether painting should be done at allprivate void renderText(@NotNull java.awt.Graphics2D g, int dx, int dy, int height, @NotNull java.lang.String text)
g
- the graphics context to paint intodx
- the x-coordinatedy
- the y-coordinateheight
- the text heighttext
- the textprivate static void updateMinimumSize(@NotNull java.awt.Dimension minimumSize, @Nullable java.awt.Image image)
minimumSize
- the minimum sizeimage
- the image