java.lang.Objectcom.realtime.crossfire.jxclient.gui.item.ItemPainter
public class ItemPainter
Paints Crossfire item images.
| Field Summary | |
|---|---|
private java.awt.Color |
appliedColor
The background color for applied objects. |
private java.awt.image.BufferedImage |
appliedImage
The overlay image for applied objects. |
private java.awt.Color |
blessedColor
The background color for blessed objects. |
private java.awt.image.BufferedImage |
blessedImage
The overlay image for blessed objects. |
private java.awt.Color |
cursedColor
The background color for cursed objects. |
private java.awt.image.BufferedImage |
cursedImage
The overlay image for cursed objects. |
private java.awt.Color |
damnedColor
The background color for damned objects. |
private java.awt.image.BufferedImage |
damnedImage
The overlay image for damned objects. |
private java.awt.Font |
font
The font for the "nrof" text. |
private int |
h
The item's height in pixel. |
private java.awt.Color |
lockedColor
The background color for locked objects. |
private java.awt.image.BufferedImage |
lockedImage
The overlay image for locked objects. |
private java.awt.Color |
magicColor
The background color for magical objects. |
private java.awt.image.BufferedImage |
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.BufferedImage |
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.BufferedImage |
unidentifiedImage
The overlay image for unidentified objects. |
private java.awt.Color |
unpaidColor
The background color for unpaid objects. |
private java.awt.image.BufferedImage |
unpaidImage
The overlay image for unpaid objects. |
private int |
w
The item's width in pixel. |
| Constructor Summary | |
|---|---|
ItemPainter(java.awt.image.BufferedImage cursedImage,
java.awt.image.BufferedImage damnedImage,
java.awt.image.BufferedImage magicImage,
java.awt.image.BufferedImage blessedImage,
java.awt.image.BufferedImage appliedImage,
java.awt.image.BufferedImage unidentifiedImage,
java.awt.image.BufferedImage selectorImage,
java.awt.image.BufferedImage lockedImage,
java.awt.image.BufferedImage 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,
int w,
int h)
Creates a new instance. |
|
| Method Summary | |
|---|---|
ItemPainter |
newItemPainter(int w,
int h)
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)
Paints an CfItem. |
private void |
paintColor(java.awt.Graphics g,
java.awt.Color color,
boolean isActive)
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
@Nullable private final java.awt.Color appliedColor
@Nullable private final java.awt.image.BufferedImage appliedImage
@Nullable private final java.awt.Color blessedColor
@Nullable private final java.awt.image.BufferedImage blessedImage
@Nullable private final java.awt.Color cursedColor
@Nullable private final java.awt.image.BufferedImage cursedImage
@Nullable private final java.awt.Color damnedColor
@Nullable private final java.awt.image.BufferedImage damnedImage
@NotNull private final java.awt.Font font
private final int h
@Nullable private final java.awt.Color lockedColor
@Nullable private final java.awt.image.BufferedImage lockedImage
@Nullable private final java.awt.Color magicColor
@Nullable private final java.awt.image.BufferedImage magicImage
@NotNull private final java.awt.Color nrofColor
@Nullable private final java.awt.Color selectorColor
@Nullable private final java.awt.image.BufferedImage selectorImage
private static final int TEXT_OFFSET
@Nullable private final java.awt.Color unidentifiedColor
@Nullable private final java.awt.image.BufferedImage unidentifiedImage
@Nullable private final java.awt.Color unpaidColor
@Nullable private final java.awt.image.BufferedImage unpaidImage
private final int w
| Constructor Detail |
|---|
public ItemPainter(@Nullable
java.awt.image.BufferedImage cursedImage,
@Nullable
java.awt.image.BufferedImage damnedImage,
@Nullable
java.awt.image.BufferedImage magicImage,
@Nullable
java.awt.image.BufferedImage blessedImage,
@Nullable
java.awt.image.BufferedImage appliedImage,
@Nullable
java.awt.image.BufferedImage unidentifiedImage,
@Nullable
java.awt.image.BufferedImage selectorImage,
@Nullable
java.awt.image.BufferedImage lockedImage,
@Nullable
java.awt.image.BufferedImage 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,
int w,
int h)
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 informationw - the item's width in pixelh - the item's height in pixel| Method Detail |
|---|
@NotNull
public ItemPainter newItemPainter(int w,
int h)
w - the item's width in pixelh - the item's height in pixel
public void paint(@NotNull
java.awt.Graphics2D g,
@NotNull
CfItem item,
boolean selected,
@NotNull
java.awt.Image face)
CfItem.
g - the graphics instance to paint intoitem - the itemselected - whether the item is selectedface - the item's face
private void paintColor(@NotNull
java.awt.Graphics g,
@Nullable
java.awt.Color color,
boolean isActive)
g - the context to paint intocolor - the color to useisActive - whether painting should be done at all
private 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 all
private 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 text