|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.enough.polish.util.BitMapFontViewer
public class BitMapFontViewer
Is used for a performant showing of String with a bitmap font.
Copyright Enough Software 2004 - 2009
| Field Summary | |
|---|---|
static int |
ABSOLUTE_LINE_BREAK
|
static int |
ARTIFICAL_LINE_BREAK
|
static int |
COLORIZE_MASK
|
| Constructor Summary | |
|---|---|
BitMapFontViewer(Image image,
int[] indeces,
short[] xPositions,
byte[] characterWidths,
int fontHeight,
int spaceIndex,
int verticalPadding)
Views a specific input string with a specific bitmap font. |
|
BitMapFontViewer(Image image,
int color,
int[] indeces,
short[] xPositions,
byte[] characterWidths,
int fontHeight,
int spaceIndex,
int verticalPadding)
Views a specific input string with a specific bitmap font. |
|
| Method Summary | |
|---|---|
protected Image |
applyColor(Image img,
int mask,
int color)
Applies the color to the pixels in the image that fits the mask |
protected int |
colorizePixel(int argb,
int color)
Colorizes the given argb pixel to the given color while maintaining the alpha value |
int |
getFontHeight()
Returns the height of used font. |
int |
getHeight()
Retrieves the height needed for this viewer. |
int |
getNumberOfLines()
Retrieves the number of lines which are used to display the embedded text. |
byte[] |
getUsedCharactersWidths()
Returns the used character widths. |
int |
getWidth()
Retrieves the width needed for this viewer. |
boolean |
isInitialized()
|
protected boolean |
isValidPixel(int argb,
int mask)
|
void |
layout(int firstLineWidth,
int lineWidth,
int paddingVertical,
int orientationSetting)
Layouts this text-viewer. |
void |
layout(int firstLineWidth,
int lineWidth,
int paddingVertical,
int orientationSetting,
int maxLines,
String maxLinesAppendix,
BitMapFont maxLinesAppendixFont)
Layouts this text-viewer. |
void |
paint(int x,
int y,
Graphics g)
Paints this viewer on the screen. |
void |
setHorizontalOrientation(int orientation)
Sets the orientation of the text |
String[] |
wrap(String text)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int ABSOLUTE_LINE_BREAK
public static final int ARTIFICAL_LINE_BREAK
public static final int COLORIZE_MASK
| Constructor Detail |
|---|
public BitMapFontViewer(Image image,
int[] indeces,
short[] xPositions,
byte[] characterWidths,
int fontHeight,
int spaceIndex,
int verticalPadding)
image - the basic font-imageindeces - array of the x-positions of the to-be-displayed charactersxPositions - array of the x-positions of the to-be-displayed characterscharacterWidths - array of the widths of the to-be-displayed charactersfontHeight - the height of the fontspaceIndex - the index of the space characterverticalPadding - the padding between two lines
public BitMapFontViewer(Image image,
int color,
int[] indeces,
short[] xPositions,
byte[] characterWidths,
int fontHeight,
int spaceIndex,
int verticalPadding)
image - the basic font-imagecolor - the color for the font; -1 when it should be ignoredindeces - array of the x-positions of the to-be-displayed charactersxPositions - array of the x-positions of the to-be-displayed characterscharacterWidths - array of the widths of the to-be-displayed charactersfontHeight - the height of the fontspaceIndex - the index of the space characterverticalPadding - the padding between two lines| Method Detail |
|---|
protected Image applyColor(Image img,
int mask,
int color)
img - the image to get the pixels frommask - the maskcolor - the color
protected boolean isValidPixel(int argb,
int mask)
argb - the argb valuemask - the mask
protected int colorizePixel(int argb,
int color)
argb - the argb pixelcolor - the color
public void paint(int x,
int y,
Graphics g)
x - the x-position for the text.
When the orientation is LEFT, x defines the left-border;
when the orientation is RIGHT, x defines the rigth border;
when the orientation is HCENTER, x defines the middle between left and right border.y - the top y-position of the first line.g - the graphics objectpublic int getWidth()
public int getHeight()
public void layout(int firstLineWidth,
int lineWidth,
int paddingVertical,
int orientationSetting)
firstLineWidth - the available width for the first linelineWidth - the available width for the following linespaddingVertical - the space between linesorientationSetting - the orientation of this viewer, either Grapics.LEFT, Graphics.RIGHT or Graphics.HCENTERgetHeight(),
getWidth()
public void layout(int firstLineWidth,
int lineWidth,
int paddingVertical,
int orientationSetting,
int maxLines,
String maxLinesAppendix,
BitMapFont maxLinesAppendixFont)
firstLineWidth - the available width for the first linelineWidth - the available width for the following linespaddingVertical - the space between linesorientationSetting - the orientation of this viewer, either Grapics.LEFT, Graphics.RIGHT or Graphics.HCENTERmaxLines - the maximum number of lines, -1 when this should be ignoredmaxLinesAppendix - the appendix that should be added to the last line when the line number is greater than maxLines, null when it should be ignoredmaxLinesAppendixFont - the font that should be used for the appendixgetHeight(),
getWidth()public void setHorizontalOrientation(int orientation)
orientation - the horizontal text orientation like Graphics.LEFT, Graphics.RIGHT or Graphics.HCENTERpublic int getFontHeight()
public int getNumberOfLines()
public byte[] getUsedCharactersWidths()
public boolean isInitialized()
public String[] wrap(String text)
text -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||