|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmhframework.media.MHImageFont
public class MHImageFont
The MHImageFont class allows loading and drawing of text using images for the characters. Reads all the png images in a directory in the form "charXX.png" where "XX" is a decimal unicode value. Characters can have different widths and heights.
Field Summary | |
---|---|
static int |
BOTTOM
|
static int |
HCENTER
|
static int |
LEFT
|
static int |
RIGHT
|
static int |
TOP
|
static int |
VCENTER
|
Constructor Summary | |
---|---|
MHImageFont()
Creates a new MHImageFont with no characters. |
|
MHImageFont(java.lang.String path)
Creates a new MHImageFont and loads character images from the specified path. |
Method Summary | |
---|---|
int |
charHeight(char ch)
Gets the char height, in pixels, for the specified char. |
int |
charWidth(char ch)
Gets the char width, in pixels, for the specified char. |
void |
drawChar(java.awt.Graphics g,
char ch,
int x,
int y)
Draws the specified character at the (x, y) location. |
void |
drawChar(java.awt.Graphics g,
char ch,
int x,
int y,
int anchor)
Draws the specified character at the (x, y) location. |
void |
drawString(java.awt.Graphics g,
java.lang.String s,
int x,
int y)
Draws the specified string at the (x, y) location. |
void |
drawString(java.awt.Graphics g,
java.lang.String s,
int x,
int y,
int anchor)
Draws the specified string at the (x, y) location. |
java.awt.Image |
getImage(char ch)
Gets the image for a specific character. |
void |
load(java.lang.String path)
Loads the image files for each character from the specified path. |
int |
stringWidth(java.lang.String s)
Gets the string width, in pixels, for the specified string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int HCENTER
public static final int VCENTER
public static final int LEFT
public static final int RIGHT
public static final int TOP
public static final int BOTTOM
Constructor Detail |
---|
public MHImageFont()
public MHImageFont(java.lang.String path)
Method Detail |
---|
public void load(java.lang.String path) throws java.lang.NumberFormatException
java.lang.NumberFormatException
public java.awt.Image getImage(char ch)
public int stringWidth(java.lang.String s)
public int charWidth(char ch)
public int charHeight(char ch)
public void drawString(java.awt.Graphics g, java.lang.String s, int x, int y)
public void drawString(java.awt.Graphics g, java.lang.String s, int x, int y, int anchor)
public void drawChar(java.awt.Graphics g, char ch, int x, int y)
public void drawChar(java.awt.Graphics g, char ch, int x, int y, int anchor)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |