kinetic
Class KineticString

java.lang.Object
  |
  +--kinetic.KineticObject
        |
        +--kinetic.KineticString
All Implemented Interfaces:
java.io.Serializable

public class KineticString
extends KineticObject

string object that contain text and font information for rendering strings on the screen with the engine

See Also:
Serialized Form

Field Summary
 double absoluteX
          global coordinate X
 double absoluteY
          global coordinate Y
protected  java.awt.Font font
          font object
 kinetic.KineticDiscreteProperty font_face
          font face
protected  java.lang.String font_name
          font name
 kinetic.KineticProperty font_size
          font size
protected  int font_style
          font style
protected  java.awt.font.GlyphVector glyphVector
          glyphvector for text
protected  java.awt.geom.Rectangle2D original_bounds
          local coordinate bbox
 java.lang.String s
          text string
 kinetic.KineticProperty tracking
          tracking
protected  java.awt.geom.GeneralPath transformed_bounds
          global coordinate bbox
 
Fields inherited from class kinetic.KineticObject
alpha, blue, BOTTOM_CENTER, BOTTOM_LEFT, BOTTOM_RIGHT, delay, duration, green, lastUpdateTime, MIDDLE_CENTER, MIDDLE_LEFT, MIDDLE_RIGHT, mode, name, orientation, parent, properties, red, rotation, selected, timeFilters, TOP_CENTER, TOP_LEFT, TOP_RIGHT, visible, x, xScale, xShear, y, yScale, yShear
 
Constructor Summary
KineticString()
          creates a new instance of a KineticString
 
Method Summary
 kinetic.Sequence breakIntoCharacters(double delay, double duration, java.awt.Graphics2D g2)
          breaks this KineticString into individual characters in KineticString wrapped into the returned sequence
 kinetic.Sequence breakIntoWords(double delay, double duration, java.awt.Graphics2D g2)
          Breaks the KineticString into space delimited words while preserving the spatial layout of the text
 boolean contains(java.awt.Point p)
          hit test
 kinetic.KineticString copy()
          produces a new instance that is an exact copy
 kinetic.KineticString copy(double time)
          produces a new instance that captures the state of the kinetic string at a specified time
 void draw(java.awt.Graphics2D g2)
          main drawing routine with an affine transform - adds a unitiy transforms and calls main routine
 void draw(java.awt.Graphics2D g2, java.awt.geom.AffineTransform ax)
          main drawing routing
 double getAbsoluteX()
          get global coordinate X
 double getAbsoluteY()
          get global coordinate Y
 double getAdvance(char c, java.awt.Graphics2D g2)
          get the advance of a character using the world of this string
 double getAdvance(java.awt.Graphics2D g2, boolean space)
          get the advance of the entire word plus a space
 java.awt.geom.Rectangle2D getBounds()
          get global coordinate bbox
 double getDescent()
          get decent of this object
 double getHeight()
          get height
 double getWidth()
          get global coordinate width
 void handleMouseEvent(java.awt.event.MouseEvent e, boolean button_event, double time, java.awt.Graphics2D g2)
          support interactivity
 void initBounds(java.awt.Graphics2D g2)
          initialize bounds, create glyphs, fonts, etc.
 void setFont(java.awt.Font f)
          set font using font object
 void setFont(java.lang.String name, int style, double size)
          set font using paramters
 void setFontChoice(int i)
          select from from discrete property list
 void setFontFace(java.lang.String name)
          set font face
 void setFontSize(double size)
          set font size
 void setString(java.lang.String new_string)
          set text string
 
Methods inherited from class kinetic.KineticObject
addProperty, addTimeFilter, clear, getDelay, getDuration, getMaxDuration, getName, getPropertyList, getTimeFilterList, initialize, onUpdate, PrepareVariables, reset, setColor, setColor, setColor, setDelay, setDuration, setMode, setName, setOrientation, setPosition, setRotation, setScale, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

s

public java.lang.String s
text string


font_name

protected java.lang.String font_name
font name


font_style

protected int font_style
font style


font_size

public kinetic.KineticProperty font_size
font size


tracking

public kinetic.KineticProperty tracking
tracking


font_face

public kinetic.KineticDiscreteProperty font_face
font face


original_bounds

protected java.awt.geom.Rectangle2D original_bounds
local coordinate bbox


transformed_bounds

protected java.awt.geom.GeneralPath transformed_bounds
global coordinate bbox


glyphVector

protected java.awt.font.GlyphVector glyphVector
glyphvector for text


font

protected java.awt.Font font
font object


absoluteX

public double absoluteX
global coordinate X


absoluteY

public double absoluteY
global coordinate Y

Constructor Detail

KineticString

public KineticString()
creates a new instance of a KineticString

Method Detail

draw

public void draw(java.awt.Graphics2D g2)
main drawing routine with an affine transform - adds a unitiy transforms and calls main routine

Overrides:
draw in class KineticObject
Parameters:
g2 - graphics handle

draw

public void draw(java.awt.Graphics2D g2,
                 java.awt.geom.AffineTransform ax)
main drawing routing

Specified by:
draw in class KineticObject
Parameters:
g2 - graphics handle
ax - current affine transform

setFontFace

public void setFontFace(java.lang.String name)
set font face

Parameters:
name - name of the font family

setFont

public void setFont(java.lang.String name,
                    int style,
                    double size)
set font using paramters

Parameters:
name - name of the font family
style - type style
size - font size

setFont

public void setFont(java.awt.Font f)
set font using font object

Parameters:
f - instance of font object

setFontChoice

public void setFontChoice(int i)
select from from discrete property list

Parameters:
i - index of font from font list

setFontSize

public void setFontSize(double size)
set font size

Parameters:
size - font size

setString

public void setString(java.lang.String new_string)
set text string

Parameters:
new_string - new text string

getBounds

public java.awt.geom.Rectangle2D getBounds()
get global coordinate bbox

Returns:
global coordinate bbox

contains

public boolean contains(java.awt.Point p)
hit test

Specified by:
contains in class KineticObject
Parameters:
p - hit location
Returns:
true if contains point

initBounds

public void initBounds(java.awt.Graphics2D g2)
initialize bounds, create glyphs, fonts, etc.

Parameters:
g2 - graphics handle

getWidth

public double getWidth()
get global coordinate width

Returns:
width

getAdvance

public double getAdvance(java.awt.Graphics2D g2,
                         boolean space)
get the advance of the entire word plus a space

Parameters:
g2 - graphics handle
space - add the advance of a space
Returns:
advance of word and a space in local scale

getAdvance

public double getAdvance(char c,
                         java.awt.Graphics2D g2)
get the advance of a character using the world of this string

Parameters:
c - character
g2 - graphics handle
Returns:
advance of the character in local world space

getDescent

public double getDescent()
get decent of this object

Returns:
decent

getHeight

public double getHeight()
get height

Returns:
height

getAbsoluteX

public double getAbsoluteX()
get global coordinate X

Returns:
global coordinate X

getAbsoluteY

public double getAbsoluteY()
get global coordinate Y

Returns:
global coordinate y

copy

public kinetic.KineticString copy()
produces a new instance that is an exact copy

Returns:
new instanct of a KineticString

copy

public kinetic.KineticString copy(double time)
produces a new instance that captures the state of the kinetic string at a specified time

Parameters:
time - time when to capture the state - ms
Returns:
new instance of the Kinetic String

breakIntoCharacters

public kinetic.Sequence breakIntoCharacters(double delay,
                                            double duration,
                                            java.awt.Graphics2D g2)
breaks this KineticString into individual characters in KineticString wrapped into the returned sequence

Parameters:
delay - time delay for the produced sequence
duration - time duration of the produced sequence
g2 - graphics handle
Returns:
resulting sequence containing the list of KineticStrings containing each character and positioned in space according to glyph metrics

breakIntoWords

public kinetic.Sequence breakIntoWords(double delay,
                                       double duration,
                                       java.awt.Graphics2D g2)
Breaks the KineticString into space delimited words while preserving the spatial layout of the text

Parameters:
delay - the start time - ms
duration - duration of the sequence - ms
g2 - graphic context for accessing font metrics
Returns:
new instance of a Sequence object containing a list of each KineticString resulting from the split

handleMouseEvent

public void handleMouseEvent(java.awt.event.MouseEvent e,
                             boolean button_event,
                             double time,
                             java.awt.Graphics2D g2)
support interactivity

Overrides:
handleMouseEvent in class KineticObject
Parameters:
e - mouse event
button_event - true if generated by a button
time - timestamp
g2 - graphics handle