de.enough.polish.ui.texteffects
Class RotateTextEffect

java.lang.Object
  extended by de.enough.polish.ui.TextEffect
      extended by de.enough.polish.ui.texteffects.RotateTextEffect
All Implemented Interfaces:
Serializable

public class RotateTextEffect
extends TextEffect

Rotates the given text. Please note that this MIDP 2.0 only effect assumes that only one line is rendered - rendering several lines decreases performance drastically.

Activate this text effect by specifying text-effect: rotate; in your polish.css file. You can finetune the effect with following attributes:

Copyright Enough Software 2006 - 2008

 history
        Nov 29, 2006 - rob creation
 

Author:
Robert Virkus, j2mepolish@enough.de

Field Summary
 
Fields inherited from class de.enough.polish.ui.TextEffect
style
 
Constructor Summary
RotateTextEffect()
           
 
Method Summary
 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 releaseResources()
          Releases any resources this effect might contain.
static RgbImage rotate(java.lang.String text, int textColor, javax.microedition.lcdui.Font font, int angle)
          Rotates the given text.
 void setAngle(int angle)
          Sets the angle for this effect.
 void setStyle(Style style)
          Sets the style of this item.
 
Methods inherited from class de.enough.polish.ui.TextEffect
animate, animate, drawStrings, getFont, getFontHeight, getLeftX, getRgbData, getRgbData, getRgbData, getTopY, getTopY, hideNotify, showNotify, stringWidth, wrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RotateTextEffect

public RotateTextEffect()
Method Detail

drawString

public void drawString(java.lang.String text,
                       int textColor,
                       int x,
                       int y,
                       int orientation,
                       javax.microedition.lcdui.Graphics g)
Description copied from class: TextEffect
Paints the text and applies the text effect.

Specified by:
drawString in class TextEffect
Parameters:
text - the text
textColor - the color of the text
x - x coordinate
y - y coordinate
orientation - the orientation, e.g. Graphics.TOP | Graphics.LEFT or Graphics.TOP | Graphics.HCENTER
g - the graphics context

rotate

public static RgbImage rotate(java.lang.String text,
                              int textColor,
                              javax.microedition.lcdui.Font font,
                              int angle)
Rotates the given text. Note that this method is only available on MIDP 2.0 devices with floating point support (either using Floater or by supporting CLDC 1.1) You can use this preprocessing directive:
 //#if polish.midp2 && polish.hasFloatingPoint
 

Parameters:
text - the text
textColor - the color of the text
font - the font
angle - the angle in degrees between 0 and 360
Returns:
the rotated RgbImage

releaseResources

public void releaseResources()
Description copied from class: TextEffect
Releases any resources this effect might contain. For staying future proof subclasses should call super.releaseResources() first, when overriding this method.

Overrides:
releaseResources in class TextEffect

setAngle

public void setAngle(int angle)
Sets the angle for this effect.

Parameters:
angle - the angle between 0 and 360 degrees

setStyle

public void setStyle(Style style)
Description copied from class: TextEffect
Sets the style of this item. Subclasses can override this method for getting specific settings.

Overrides:
setStyle in class TextEffect
Parameters:
style - the new style for this item.