irc.style
Class CharactersDrawer

java.lang.Object
  |
  +--irc.style.CharactersDrawer
All Implemented Interfaces:
java.awt.image.ImageObserver

public class CharactersDrawer
extends java.lang.Object
implements java.awt.image.ImageObserver

Atomic characters drawer. The CharactersDrawer handles graphical and/or vectorial smileys.


Field Summary
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
CharactersDrawer(IRCConfiguration config)
          Create a new CharactersDrawer.
 
Method Summary
 java.lang.String decodeLine(java.lang.String line)
          Prepare and decode the given line for smileys.
 void draw(java.lang.String str, java.awt.Graphics g, java.awt.FontMetrics fm, int x, int y)
          Draw the given prepared line.
 int getHeight(java.lang.String str, java.awt.FontMetrics fm)
          Get the given string height, in pixel.
 int getWidth(java.lang.String str, java.awt.FontMetrics fm)
          Get the given string width, in pixel.
 void getWidthHeight(java.lang.String str, java.awt.FontMetrics fm, java.awt.Dimension res)
          Get the given string width and height, in pixel.
 boolean imageUpdate(java.awt.Image img, int infoflags, int x, int y, int width, int height)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CharactersDrawer

public CharactersDrawer(IRCConfiguration config)
Create a new CharactersDrawer.

Parameters:
config - the irc configuration.
Method Detail

decodeLine

public java.lang.String decodeLine(java.lang.String line)
Prepare and decode the given line for smileys.

Parameters:
line - source line, before smileys replacement.
Returns:
prepared line with special characters.

getWidth

public int getWidth(java.lang.String str,
                    java.awt.FontMetrics fm)
Get the given string width, in pixel.

Parameters:
str - the prepared line.
fm - the FontMetrics that will be used on display.
Returns:
the string width, in pixel.

getHeight

public int getHeight(java.lang.String str,
                     java.awt.FontMetrics fm)
Get the given string height, in pixel.

Parameters:
str - the prepared line.
fm - the FontMetrics that will be used on display.
Returns:
the string height, in pixel.

getWidthHeight

public void getWidthHeight(java.lang.String str,
                           java.awt.FontMetrics fm,
                           java.awt.Dimension res)
Get the given string width and height, in pixel.

Parameters:
str - the prepared line.
fm - the FontMetrics that will be used on display.

draw

public void draw(java.lang.String str,
                 java.awt.Graphics g,
                 java.awt.FontMetrics fm,
                 int x,
                 int y)
Draw the given prepared line.

Parameters:
str - prepared line to draw.
g - graphics to draw onto.
fm - fontmetrics to use.
x - x position.
y - y position.

imageUpdate

public boolean imageUpdate(java.awt.Image img,
                           int infoflags,
                           int x,
                           int y,
                           int width,
                           int height)
Specified by:
imageUpdate in interface java.awt.image.ImageObserver