|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.enough.polish.ui.TextEffect
public abstract class TextEffect
Allows text effects for StringItems, IconItems and ChoiceItems.
Copyright (c) Enough Software 2005 - 2008
history
16-Nov-2005 - rob creation
| Field Summary | |
|---|---|
protected Style |
style
|
| Constructor Summary | |
|---|---|
TextEffect()
Creates a new effect |
|
| Method Summary | |
|---|---|
boolean |
animate()
Animates this effect. |
void |
animate(Item parent,
long currentTime,
ClippingRegion repaintRegion)
Animates this effect. |
abstract void |
drawString(java.lang.String text,
int textColor,
int x,
int y,
int orientation,
javax.microedition.lcdui.Graphics g)
Paints the text and applies the text effect. |
void |
drawStrings(java.lang.String[] textLines,
int textColor,
int x,
int y,
int leftBorder,
int rightBorder,
int lineHeight,
int maxWidth,
int layout,
javax.microedition.lcdui.Graphics g)
Paints the text and applies the text effect. |
protected javax.microedition.lcdui.Font |
getFont()
Retrieves the font that should be used. |
int |
getFontHeight()
Retrieves the font height by default. |
int |
getLeftX(int x,
int orientation,
int textWidth)
Retrieves the left start position for a text. |
static int[] |
getRgbData(java.lang.String text,
int textColor,
javax.microedition.lcdui.Font font)
Retrieves an RGB integer array in which the text is written on MIDP 2.0 devices. |
static int[] |
getRgbData(java.lang.String text,
int textColor,
javax.microedition.lcdui.Font font,
int x,
int y,
int width,
int height)
Retrieves an RGB integer array in which the text is written on MIDP 2.0 devices. |
static int[] |
getRgbData(java.lang.String text,
int textColor,
javax.microedition.lcdui.Font font,
int x,
int y,
int width,
int height,
int transparentColor)
Retrieves an RGB integer array in which the text is written on MIDP 2.0 devices. |
int |
getTopY(int y,
int orientation,
javax.microedition.lcdui.Font font)
Retrieves the top y position for a text. |
int |
getTopY(int y,
int orientation,
int height,
int baseLine)
Retrieves the top y position for a text. |
void |
hideNotify()
Notifies this effect that the corresponding item is to be hidden. |
void |
releaseResources()
Releases any resources this effect might contain. |
void |
setStyle(Style style)
Sets the style of this item. |
void |
showNotify()
Notifies this effect that the corresponding item is to be shown. |
int |
stringWidth(java.lang.String str)
Calculates the width of the given text. |
java.lang.String[] |
wrap(java.lang.String text,
javax.microedition.lcdui.Font font,
int firstLineWidth,
int lineWidth)
Wraps the text into several lines. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected transient Style style
| Constructor Detail |
|---|
public TextEffect()
| Method Detail |
|---|
public void setStyle(Style style)
style - the new style for this item.
java.lang.NullPointerException - when style is nullpublic boolean animate()
public void animate(Item parent,
long currentTime,
ClippingRegion repaintRegion)
parent - the parent itemcurrentTime - the current time in millisecondsrepaintRegion - the repaint area that needs to be updated when this item is animatedItem.addRelativeToContentRegion(ClippingRegion, int, int, int, int)
public void drawStrings(java.lang.String[] textLines,
int textColor,
int x,
int y,
int leftBorder,
int rightBorder,
int lineHeight,
int maxWidth,
int layout,
javax.microedition.lcdui.Graphics g)
textLines - the texttextColor - the color of the textx - horizontal start coordinatey - vertical start coordinateleftBorder - the left border, nothing must be painted left of this positionrightBorder - the right border, nothing must be painted right of this positionlineHeight - the height of a single text linemaxWidth - the width of the longest linelayout - the anchor or the text, e.g. Item.LAYOUT_CENTER or Item.LAYOUT_RIGHTg - the graphics contextdrawString( String,int,int,int,int,Graphics)
public abstract void drawString(java.lang.String text,
int textColor,
int x,
int y,
int orientation,
javax.microedition.lcdui.Graphics g)
text - the texttextColor - the color of the textx - x coordinatey - y coordinateorientation - the orientation, e.g. Graphics.TOP | Graphics.LEFT or Graphics.TOP | Graphics.HCENTERg - the graphics context
public int getLeftX(int x,
int orientation,
int textWidth)
x - the x position given in drawString()orientation - the orientation given in drawString()textWidth - the width of the text given in drawString()
public int getTopY(int y,
int orientation,
javax.microedition.lcdui.Font font)
y - the y position given in drawString()orientation - the orientation given in drawString()font - the used font, usually g.getFont()
public int getTopY(int y,
int orientation,
int height,
int baseLine)
y - the y position given in drawString()orientation - the orientation given in drawString()height - the height of the used fontbaseLine - the base line of the used font
public static int[] getRgbData(java.lang.String text,
int textColor,
javax.microedition.lcdui.Font font)
int[] rgbData = getRgbData(text, textColor, font); int height = font.getHeight(); int width = rgbData.length / height;
text - the texttextColor - the color of the textfont - the font of the text
public static int[] getRgbData(java.lang.String text,
int textColor,
javax.microedition.lcdui.Font font,
int x,
int y,
int width,
int height)
text - the texttextColor - the color of the textfont - the font of the textx - the left corner of the text in the created rgb datay - the top corner of the text in the created rgb datawidth - the desired width of the data array array, e.g. font.stringWidth(text)height - the desired height of the data array, e.g. font.getHeight()
DrawUtil.getComplementaryColor(int)
public static int[] getRgbData(java.lang.String text,
int textColor,
javax.microedition.lcdui.Font font,
int x,
int y,
int width,
int height,
int transparentColor)
text - the texttextColor - the color of the textfont - the font of the textx - the left corner of the text in the created rgb datay - the top corner of the text in the created rgb datawidth - the desired width of the data array array, e.g. font.stringWidth(text)height - the desired height of the data array, e.g. font.getHeight()transparentColor - the color that should be used to flag transparent parts, using DrawUtil.getComplementaryColor( textColor ) might be a good idea
DrawUtil.getComplementaryColor(int)public void showNotify()
public void hideNotify()
public void releaseResources()
public int stringWidth(java.lang.String str)
str - the text of which the width should be determined
public int getFontHeight()
protected javax.microedition.lcdui.Font getFont()
public java.lang.String[] wrap(java.lang.String text,
javax.microedition.lcdui.Font font,
int firstLineWidth,
int lineWidth)
text - the textfont - used fontfirstLineWidth - width of the first linelineWidth - width of following lines
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||