|
||||||||||
| 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 - 2009
history
16-Nov-2005 - rob creation
| Field Summary | |
|---|---|
protected boolean |
isTextSensitive
Specifies if this effect needs a lot of texte dependent resources or processing power. |
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. |
int |
calculateLinesHeight(WrappedText lines,
int lineHeight,
int paddingVertical)
Calculates the content height with the lines, the lineheight and the vertical padding |
int |
charWidth(char c)
Retrieves the width of the given char |
void |
drawChar(char c,
int x,
int y,
int anchor,
Graphics g)
Draws the specified character using this effect. |
abstract void |
drawString(String text,
int textColor,
int x,
int y,
int anchor,
Graphics g)
Paints the text and applies the text effect. |
void |
drawStrings(FakeCustomItem parent,
WrappedText textLines,
int textColor,
int x,
int y,
int leftBorder,
int rightBorder,
int lineHeight,
int maxWidth,
int layout,
Graphics g)
Paints the text and applies the text effect. |
void |
drawStrings(Item parent,
WrappedText textLines,
int textColor,
int x,
int y,
int leftBorder,
int rightBorder,
int lineHeight,
int maxWidth,
int layout,
Graphics g)
Paints the text and applies the text effect. |
void |
drawStrings(WrappedText textLines,
int textColor,
int x,
int y,
int leftBorder,
int rightBorder,
int lineHeight,
int maxWidth,
int layout,
Graphics g)
Paints the text and applies the text effect. |
protected Font |
getFont()
Retrieves the font that should be used. |
int |
getFontHeight()
Retrieves the font height by default. |
int |
getLeftX(int x,
int anchor,
int textWidth)
Retrieves the left start position for a text. |
static int[] |
getRgbData(String text,
int textColor,
Font font)
Retrieves an RGB integer array in which the text is written on MIDP 2.0 devices. |
static int[] |
getRgbData(String text,
int textColor,
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(String text,
int textColor,
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 anchor,
Font font)
Retrieves the top y position for a text. |
int |
getTopY(int y,
int anchor,
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 |
onAttach(Item parent)
Notifies the text effect that it has been attached to the specified item. |
void |
onDetach(Item parent)
Notifies the text effect that it has been detached to the specified item Subclasses can override this method to get access to the parent item. |
void |
releaseResources()
Releases any resources this effect might contain. |
void |
setStyle(Style style)
Sets the style of this item. |
void |
setStyle(Style style,
boolean resetStyle)
Sets the style of this item without assuming defaults for non-set style elements. |
void |
showNotify()
Notifies this effect that the corresponding item is to be shown. |
int |
stringWidth(String str)
Calculates the width of the given text. |
void |
wrap(FakeStringCustomItem parent,
String text,
int textColor,
Font font,
int firstLineWidth,
int lineWidth,
int maxLines,
String maxLinesAppendix,
int maxLinesAppendixPosition,
WrappedText wrappedText)
Wraps the text into several lines and adds the result to the specified wrappedText. |
void |
wrap(StringItem parent,
String text,
int textColor,
Font font,
int firstLineWidth,
int lineWidth,
int maxLines,
String maxLinesAppendix,
int maxLinesAppendixPosition,
WrappedText wrappedText)
Wraps the text into several lines and adds the result to the specified wrappedText. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected transient Style style
protected boolean isTextSensitive
| Constructor Detail |
|---|
public TextEffect()
| Method Detail |
|---|
public void setStyle(Style style)
style - the new style for this item.
NullPointerException - when style is nullsetStyle(Style, boolean)public void onAttach(Item parent)
parent - the parent itempublic void onDetach(Item parent)
parent - the parent item
public void setStyle(Style style,
boolean resetStyle)
style - the new style for this item.resetStyle - true when all style elements should be reset to their default when no CSS attributes are defined.
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(FakeCustomItem parent,
WrappedText textLines,
int textColor,
int x,
int y,
int leftBorder,
int rightBorder,
int lineHeight,
int maxWidth,
int layout,
Graphics g)
parent - the parent itemtextLines - 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 void drawStrings(Item parent,
WrappedText textLines,
int textColor,
int x,
int y,
int leftBorder,
int rightBorder,
int lineHeight,
int maxWidth,
int layout,
Graphics g)
parent - the parent itemtextLines - 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 contextdrawStrings(WrappedText, int, int, int, int, int, int, int, int, Graphics)
public void drawStrings(WrappedText textLines,
int textColor,
int x,
int y,
int leftBorder,
int rightBorder,
int lineHeight,
int maxWidth,
int layout,
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(String text,
int textColor,
int x,
int y,
int anchor,
Graphics g)
text - the texttextColor - the color of the textx - x coordinatey - y coordinateanchor - the orientation, e.g. Graphics.TOP | Graphics.LEFT or Graphics.TOP | Graphics.HCENTERg - the graphics context
public int getLeftX(int x,
int anchor,
int textWidth)
x - the x position given in drawString()anchor - the orientation given in drawString()textWidth - the width of the text given in drawString()
public int getTopY(int y,
int anchor,
Font font)
y - the y position given in drawString()anchor - the orientation given in drawString()font - the used font, usually g.getFont()
public int getTopY(int y,
int anchor,
int height,
int baseLine)
y - the y position given in drawString()anchor - the orientation given in drawString()height - the height of the used fontbaseLine - the base line of the used font
public static int[] getRgbData(String text,
int textColor,
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(String text,
int textColor,
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(String text,
int textColor,
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(String str)
str - the text of which the width should be determined
public int charWidth(char c)
c - the char
public int getFontHeight()
protected Font getFont()
public void wrap(StringItem parent,
String text,
int textColor,
Font font,
int firstLineWidth,
int lineWidth,
int maxLines,
String maxLinesAppendix,
int maxLinesAppendixPosition,
WrappedText wrappedText)
parent - the parent of this effecttext - the texttextColor - color of the textfont - used fontfirstLineWidth - width of the first linelineWidth - width of following linesmaxLines - the maximum number of linesmaxLinesAppendix - the appendix that should be added to the last line when the line number is greater than maxLinesmaxLinesAppendixPosition - either TextUtil.MAXLINES_APPENDIX_POSITION_AFTER or TextUtil.MAXLINES_APPENDIX_POSITION_BEFOREwrappedText - the wrapped text object to which the single text lines should be addedTextUtil.wrap(String, Font, int, int, int, String, int)
public void wrap(FakeStringCustomItem parent,
String text,
int textColor,
Font font,
int firstLineWidth,
int lineWidth,
int maxLines,
String maxLinesAppendix,
int maxLinesAppendixPosition,
WrappedText wrappedText)
parent - the parent of this effecttext - the texttextColor - color of the textfont - used fontfirstLineWidth - width of the first linelineWidth - width of following linesmaxLines - the maximum number of linesmaxLinesAppendix - the appendix that should be added to the last line when the line number is greater than maxLinesmaxLinesAppendixPosition - either TextUtil.MAXLINES_APPENDIX_POSITION_AFTER or TextUtil.MAXLINES_APPENDIX_POSITION_BEFOREwrappedText - the wrapped text object to which the single text lines should be addedTextUtil.wrap(String, Font, int, int, int, String, int)
public void drawChar(char c,
int x,
int y,
int anchor,
Graphics g)
c - the characterx - horizontal positiony - vertical positionanchor - anchor, e.g. Graphics.TOP | Graphics.LEFTg - the graphics context
public int calculateLinesHeight(WrappedText lines,
int lineHeight,
int paddingVertical)
lines - the lineslineHeight - the lineheightpaddingVertical - the vertical padding
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||