de.ilu.movingletters
Class Letter

java.lang.Object
  extended by de.ilu.movingletters.Letter

 class Letter
extends java.lang.Object

a letter in the typeset. Letters consist of 15 possible locations (letter coordinates) numbered from top left (1) to bootom right (15).
e.g. the letter A consists of the 4 lines:
1-3, 7-9, 1-13, 3-15

01 02 03
04 05 06
07 08 09
10 11 12
13 14 15

Version:
20071119
Author:
iluvatar

Field Summary
private  Line[] mLines
          the lines for this letter
private  int mLineWidth
          the width of the letter in letter coordinates
private  int mPixelWidth
          the width of the letter in pixel
private  char mValue
          the char represented by this letter
 
Constructor Summary
Letter(MovingLetters pMovingLetters, char pChar, int[][] pLineDef)
          create a letter from it's line description.
 
Method Summary
(package private)  void calculatePixelWidth(int pHeight)
          calculate the width of the letter in pixel. must be called prior to all drawing operations.
(package private)  int getPixelWidth()
          get width of the letter in pixel.
(package private)  char getValue()
          get the char represented by this letter.
(package private)  void paint(int pBaseX, int pBaseY, int pDotSize, int pLineWidth)
          draw the letter.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mLines

private Line[] mLines
the lines for this letter


mLineWidth

private int mLineWidth
the width of the letter in letter coordinates


mPixelWidth

private int mPixelWidth
the width of the letter in pixel


mValue

private char mValue
the char represented by this letter

Constructor Detail

Letter

public Letter(MovingLetters pMovingLetters,
              char pChar,
              int[][] pLineDef)
create a letter from it's line description.

Parameters:
pMovingLetters - reference to the typeset containing this letter.
pChar - the char represented by this letter
pLineDef - the line definition as list of start/end letter coordinates.
Method Detail

calculatePixelWidth

void calculatePixelWidth(int pHeight)
calculate the width of the letter in pixel. must be called prior to all drawing operations.

Parameters:
pHeight - the wanted height of the letter.

getPixelWidth

int getPixelWidth()
get width of the letter in pixel.

Returns:
width of the letter in pixel.

getValue

char getValue()
get the char represented by this letter.

Returns:
the char represented by this letter.

paint

void paint(int pBaseX,
           int pBaseY,
           int pDotSize,
           int pLineWidth)
draw the letter.

Parameters:
pBaseX - x-base coordinate for the letter coordinate 1.
pBaseY - y-base coordinate for the letter coordinate 1.
pDotSize - size of dots at start and end. 0 for no dot.
pLineWidth - line width.

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()