rita
Class RiText

java.lang.Object
  extended by rita.RiObject
      extended by rita.RiText
All Implemented Interfaces:
java.lang.CharSequence, processing.core.PConstants, FeaturedIF, RiCharSequence, RiConstants

public class RiText
extends RiObject
implements RiCharSequence

RiTa's text display object. Wraps an instance of RiString to provide utility methods for typography, display, animation, text-to-speech, and audio playback.

Note: by default, RiText objects, once created, will draw themselves to the screen at each frame until they are either a) deleted (via RiText.delete(myRiText);) or b) hidden (via myRiText.setVisible(false);). To disable this behavior (and draw the objects manually), one can call disableAutoDraw().

An example usage:

     import rita.*;
     
     void setup() {
       // start in the upper left corner
       RiText rt = new RiText(this, "hello", 0, 10);
       
       // measure the width of the text
       float tw = rt.textWidth();
 
       // move to the lower right over 2 sec
       rt.moveTo(width-tw, height, 2);    
     }
     
     void draw() {
       // draw the bg every frame
       background(255);
     }
 


Field Summary
static boolean DBUG_INFO
           
static java.lang.String DEFAULT_FONT
           
static int DEFAULT_MOTION_TYPE
           
 int motionType
           
 float rotateX
           
 float rotateY
           
 float rotateZ
           
 RiSample sample
          Current Sample object for this text
 float scaleX
           
 float scaleY
           
 float scaleZ
           
 float x
          Current x-position of this text
 float y
          Current y-position of this text
 float z
          Current z-position of this text
 
Fields inherited from interface rita.support.RiConstants
BEHAVIOR_COMPLETED, BOUNDING_BOX_ALPHA, BRILL_POS_TAGGER, EASE_IN, EASE_IN_CUBIC, EASE_IN_EXPO, EASE_IN_OUT, EASE_IN_OUT_CUBIC, EASE_IN_OUT_EXPO, EASE_IN_OUT_QUARTIC, EASE_IN_OUT_SINE, EASE_IN_QUARTIC, EASE_IN_SINE, EASE_OUT, EASE_OUT_CUBIC, EASE_OUT_EXPO, EASE_OUT_QUARTIC, EASE_OUT_SINE, ESS, FADE_COLOR, FADE_IN, FADE_OUT, FADE_TO_TEXT, FIRST_PERSON, FUTURE_TENSE, ID, LERP, LINEAR, MAXENT_POS_TAGGER, MINIM, MOVE, MUTABLE, PAST_TENSE, PHONEME_BOUNDARY, PHONEMES, PLING_STEMMER, PLURAL, PORTER_STEMMER, POS, PRESENT_TENSE, SCALE_TO, SECOND_PERSON, SENTENCE_BOUNDARY, SINGULAR, SONIA, SPEECH_COMPLETED, STRESSES, SYLLABLE_BOUNDARY, SYLLABLES, TEXT, TEXT_ENTERED, THIRD_PERSON, TIMER, TIMER_COMPLETED, TIMER_TICK, TOKENS, UNKNOWN, WORD_BOUNDARY
 
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
 
Constructor Summary
RiText(processing.core.PApplet pApplet)
           
RiText(processing.core.PApplet pApplet, char character)
           
RiText(processing.core.PApplet pApplet, char character, float startXPos, float startYPos)
           
RiText(processing.core.PApplet pApplet, float startXPos, float startYPos)
           
RiText(processing.core.PApplet pApplet, java.lang.String text)
           
RiText(processing.core.PApplet pApplet, java.lang.String text, float startXPos, float startYPos)
           
RiText(processing.core.PApplet pApplet, java.lang.String text, float xPos, float yPos, int alignment)
           
RiText(processing.core.PApplet pApplet, java.lang.String text, float xPos, float yPos, int alignment, processing.core.PFont theFont)
          Creates a new RiText object base-aligned at x='xPos', y='yPos', with 'alignment' from one of (LEFT, CENTER, RIGHT), using font specified by 'theFont'.
RiText(processing.core.PApplet pApplet, java.lang.String text, float startXPos, float startYPos, processing.core.PFont font)
           
 
Method Summary
 RiTextBehavior addBehavior(RiTextBehavior behavior)
          Add a new behavior to this RiText's run queue
 void addFeature(java.lang.CharSequence name, java.lang.CharSequence value)
          Adds a feature (a key-value pair) to the RiText.
 void appendFeature(java.lang.String name, java.lang.String value)
          See rita.support.feature.Featured#appendFeature(java.lang.String, java.lang.String)
 void boundingBoxFill(float gray)
           
 void boundingBoxFill(float[] color)
          Set the current boundingBoxFill color for this object, applicable only when showBoundingBox(true) has been called.
 void boundingBoxFill(float gray, float alpha)
           
 void boundingBoxFill(float r, float g, float b)
           
 void boundingBoxFill(float r, float g, float b, float alpha)
          Set the bounding-box (or background) color for this object
 float boundingBoxPadding()
          Returns the bounding box padding
 void boundingBoxPadding(float padding)
          Sets min padding (in pixels) around all sides of text in bounding box (default=1)
 void boundingBoxStroke(float gray)
           
 void boundingBoxStroke(float[] color)
          Set the current boundingBoxStroke color for this object, applicable only when showBoundingBox(true) has been called.
 void boundingBoxStroke(float gray, float alpha)
           
 void boundingBoxStroke(float r, float g, float b)
           
 void boundingBoxStroke(float r, float g, float b, float alpha)
          Set the stroke color for the bounding-box of this object, assuming it has been set to visible.
 float boundingBoxStrokeWeight()
          Returns the bounding box stroke weight
 void boundingBoxStrokeWeight(float r)
          Set the current bgstroke weight for this object
 char charAt(int index)
          Returns the character at the specified index
 void clearFeatures()
          Clears all the features (key-value pairs) for the RiText
 int compareTo(java.lang.Object arg0)
           
 int compareTo(java.lang.String anotherString)
           
 int compareToIgnoreCase(java.lang.String str)
           
 void completeBehaviors()
          Immediately marks all Behaviors in the RiText's run queue as complete and causes them to fire theirbehaviorCompleted() methods.
 java.lang.String concat(java.lang.String str)
           
 boolean contains(java.lang.CharSequence s)
           
 boolean contains(float mx, float my)
          Checks if the input point is inside the bounding box
 boolean contains3D(float mx, float my)
          Checks if the input point is inside the object's bounding box after converting its x,y,z coordinates to screen x & y.
 RiText copy()
          Returns a field for field copy of this object
static RiText copy(RiText toCopy)
          Returns a field for field copy of toCopy
static processing.core.PFont createDefaultFont(processing.core.PApplet p, java.lang.String fontName, float fontSize)
          Sets the default font for all RiTexts to be created (via PApplet.createFont(String)).
static void createDefaultFont(java.lang.String fontName, float fontSize)
          Deprecated.  
 void createFont(java.lang.String fontName, float sz)
          Creates (and caches) the font for this object from a System font (via PApplet.createFont()).
 RiLerpBehavior createLerp(processing.core.PApplet pApplet)
           
 RiLerpBehavior createLerp(processing.core.PApplet pApplet, float start, float target, float durationSec)
           
 RiLerpBehavior createLerp(processing.core.PApplet pApplet, float start, float target, float startOffsetSec, float durationSec)
          Creates and returns a new behavior that interpolates between 2 values, 'start' and 'target', and generates a callback to pApplet.onRiTaEvent(RiTaEvent) when finished.
static RiText[] createLetters(processing.core.PApplet pApplet, processing.core.PFont theFont, java.lang.String theText, int startX, int startY)
          Creates an array of RiTexts, one per letter, with appropriate x and y positions for each (using the 'font' specified), starting at 'xStart' and 'yStart'.
static RiText[] createLetters(processing.core.PApplet pApplet, java.lang.String theText, int startX, int startY)
          Creates an array of RiTexts, one per letter, with appropriate x and y positions for each (using the default 'font'), starting at 'xStart' and 'yStart'.
static RiText[] createLines(processing.core.PApplet pApplet, processing.core.PFont font, java.lang.String text, float startX, float startY, int maxCharsPerLine, float leading)
          Creates an array of RiText, one per line of input 'text', constrained to the 'maxChars' specified, starting with upper left corner at 'startX' and 'startY'.
static RiText[] createLines(processing.core.PApplet pApplet, processing.core.PFont pf, java.lang.String text, java.awt.Rectangle rectangle)
          Creates an array of RiText, one per line from the input String, and lays it out according to the rectangle (and font) specified.
static RiText[] createLines(processing.core.PApplet pApplet, processing.core.PFont pf, java.lang.String text, java.awt.Rectangle rectangle, float leading)
          Creates an array of RiText, one per line from the input String, and lays it out according to the rectangle (and font/leading) specified.
static RiText[] createLines(processing.core.PApplet pApplet, java.lang.String[] text, float startX, float startY)
           
static RiText[] createLines(processing.core.PApplet pApplet, java.lang.String[] text, float startX, float startY, int maxCharsPerLine)
           
static RiText[] createLines(processing.core.PApplet pApplet, java.lang.String[] lines, float startX, float startY, int maxCharsPerLine, float leading)
          Creates a RiText[] from the lines, re-formatting lines according to maxCharsPerLine (using the specified 'font').
static RiText[] createLines(processing.core.PApplet p, java.lang.String text, float startX, float startY)
           
static RiText[] createLines(processing.core.PApplet p, java.lang.String text, float startX, float startY, int maxCharsPerLine)
           
static RiText[] createLines(processing.core.PApplet pApplet, java.lang.String text, float startX, float startY, int maxCharsPerLine, float leading)
          Creates an array of RiText, one per line of input 'text', constrained to the 'maxChars' specified, starting with upper left corner at 'startX' and 'startY'.
static RiText[] createLines(processing.core.PApplet pApplet, java.lang.String text, java.awt.Rectangle rectangle)
          Creates an array of RiText, one per line from the input String, and lays it out according to the rectangle specified.
static RiText[] createLinesFromFile(processing.core.PApplet pApplet, processing.core.PFont font, java.lang.String fileName, float startX, float startY, int maxCharsPerLine, float leading)
          Creates an array of RiText from the file specified by 'fileName', one per line of input text, constrained to the 'maxChars' specified, starting with upper left corner at 'startX' and 'startY'.
static RiText[] createLinesFromFile(processing.core.PApplet pApplet, processing.core.PFont pf, java.lang.String fileName, java.awt.Rectangle rectangle)
          Creates an array of RiTexts, one per line from the input file, and lays it out according to the rectangle specified.
static RiText[] createLinesFromFile(processing.core.PApplet pApplet, processing.core.PFont pf, java.lang.String fileName, java.awt.Rectangle rectangle, float leading)
          Creates an array of RiTexts, one per line from the input file, and lays it out according to the rectangle specified.
static RiText[] createLinesFromFile(processing.core.PApplet pApplet, java.lang.String fileName, float startX, float startY, int maxCharsPerLine)
          Creates an array of RiText from the file specified by 'fileName', one per line of input text, constrained to the 'maxChars' specified, starting with upper left corner at 'startX' and 'startY'.
static RiText[] createLinesFromFile(processing.core.PApplet pApplet, java.lang.String fileName, float startX, float startY, int maxCharsPerLine, float leading)
          Creates an array of RiText from the file specified by 'fileName', one per line of input text, constrained to the 'maxChars' specified, starting with upper left corner at 'startX' and 'startY', using the 'leading' specified.
static RiText[] createLinesFromFile(processing.core.PApplet pApplet, java.lang.String fileName, int x, int y)
          Creates an array of RiText from the file specified by 'fileName', one per line of input text, starting with upper left corner at 'startX' and 'startY'.
static RiText[] createLinesFromFile(processing.core.PApplet pApplet, java.lang.String fileName, java.awt.Rectangle rectangle)
          Creates an array of RiTexts, one per line from the input file, and lays it out according to the rectangle specified.
static RiText[] createWords(processing.core.PApplet pApplet, processing.core.PFont pfont, java.lang.String[] lines, float startX, float startY)
          Creates an array of RiTexts laid out in lines, with one RiText for each word of input, with x-spacing determined by the specified 'font'.
static RiText[] createWords(processing.core.PApplet pApplet, processing.core.PFont pfont, java.lang.String[] lines, float startX, float startY, int maxCharsPerLine)
          Creates an array of RiTexts laid out in lines, with one RiText for each word of input, with x-spacing determined by the specified 'font'.
static RiText[] createWords(processing.core.PApplet pApplet, processing.core.PFont font, java.lang.String[] words, float startX, float startY, int maxCharsPerLine, float leading)
          Creates an array of RiTexts laid out in lines, one per array element, with one RiText for each of 'words', with x-spacing determined by the specified 'font'.
static RiText[] createWords(processing.core.PApplet pApplet, processing.core.PFont pfont, java.lang.String input, float startX, float startY)
          Creates an array of RiTexts laid out in lines, with one RiText for each word of input, with x-spacing determined by the specified 'font'.
static RiText[] createWords(processing.core.PApplet pApplet, processing.core.PFont pfont, java.lang.String lines, float startX, float startY, int maxCharsPerLine, float leading)
          Creates an array of RiTexts laid out in lines, with one RiText for each word of input, with x-spacing determined by the specified 'font'.
static RiText[] createWords(processing.core.PApplet pApplet, processing.core.PFont font, java.lang.String input, java.awt.Rectangle rectangle)
           
static RiText[] createWords(processing.core.PApplet pApplet, processing.core.PFont font, java.lang.String input, java.awt.Rectangle rectangle, float leading)
           
static RiText[] createWords(processing.core.PApplet pApplet, java.lang.String[] lines, float startX, float startY)
          Creates an array of RiTexts laid out in lines, with one RiText for each word of input, with x-spacing determined by the default 'font'.
static RiText[] createWords(processing.core.PApplet pApplet, java.lang.String[] lines, float startX, float startY, int maxCharsPerLine)
          Creates an array of RiTexts laid out in lines, with one RiText for each word of input, with x-spacing determined by the default 'font'.
static RiText[] createWords(processing.core.PApplet pApplet, java.lang.String[] lines, float startX, float startY, int maxCharsPerLine, float leading)
          Creates an array of RiTexts laid out in lines, with one RiText for each word of input, with x-spacing determined by the default 'font'.
static RiText[] createWords(processing.core.PApplet pApplet, java.lang.String input, float startX, float startY)
          Creates an array of RiTexts laid out in lines, with one RiText for each word of input, with x-spacing determined by the default 'font'.
static RiText[] createWords(processing.core.PApplet pApplet, java.lang.String lines, float startX, float startY, int maxCharsPerLine)
          Creates an array of RiTexts laid out in lines, with one RiText for each word of input, with x-spacing determined by the default 'font'.
static RiText[] createWords(processing.core.PApplet pApplet, java.lang.String lines, float startX, float startY, int maxCharsPerLine, float leading)
          Creates an array of RiTexts laid out in lines, with one RiText for each word of input, with x-spacing determined by the default 'font'.
static RiText[] createWords(processing.core.PApplet pApplet, java.lang.String input, java.awt.Rectangle rectangle)
           
static RiText[] createWords(processing.core.PApplet pApplet, java.lang.String input, java.awt.Rectangle rectangle, float leading)
           
static void delete(java.util.List l)
          Deletes all objects in the List.
static void delete(RiText rt)
          Call to remove a RiText from the current sketch (and from existence), cleaning up whatever resources it may have held
static void delete(RiText[] c)
          Deletes all objects in the array (and the array itself)
static void deleteAll()
          Deletes all current instances.
static void disableAutoDraw()
          Disables auto-drawing of subsequently created RiTexts.
Note: draw() must be explicitly called on these objects.
static void disableBehaviorWarnings()
          Turns off warnings about conflicting or non-terminating behaviors.
 void dispose()
          To be called only by AppletContainer on destroy, not by users!
 float distanceTo(RiText riText)
          Returns the distance between the center points of the two RiTexts.
 void draw()
          Draw the RiText object at current x,y,color,font,alignment, etc.
 void draw(processing.core.PGraphics p)
          Draw the RiText object at current x,y,color,font,alignment, etc.
static void drawAll()
          Draws all (visible) RiText objects
static void drawAll(processing.core.PGraphics p)
          Draws all (visible) RiText objects
 boolean endsWith(java.lang.String suffix)
           
 boolean equalsIgnoreCase(java.lang.String anotherString)
           
static void fadeAllIn(float seconds)
          Fades in all RiText objects over the specified duration
static void fadeAllOut(float seconds)
          Fades all visible RiText objects.
 int fadeColor(float[] color, float seconds)
           
 int fadeColor(float[] color, float startTime, float seconds)
          Transitions to 'color' (rgba) over 'seconds' starting at 'startTime' seconds in the future
 int fadeColor(float gray, float seconds)
           
 int fadeColor(float r, float g, float b, float a, float seconds)
          Transitions to 'color' (rgba) over 'seconds' starting at 'startTime' seconds in the future
 int fadeIn(float seconds)
           
 int fadeIn(float startTime, float seconds)
          Fades in current text over seconds starting at startTime.
 int fadeOut(float seconds)
           
 int fadeOut(float seconds, boolean removeOnComplete)
           
 int fadeOut(float startTime, float seconds)
           
 int fadeOut(float startTime, float seconds, boolean removeOnComplete)
          Fades out current text over seconds starting at startTime.
 int fadeToText(java.lang.String newText, float seconds)
          Fades out the current text and fades in the newText over seconds starting immediately
 int fadeToText(java.lang.String newText, float startTime, float seconds)
          Fades out the current text and fades in the newText over seconds starting at 'startTime' seconds in the future
 void fill(float gray)
           
 void fill(float[] color)
           
 void fill(float gray, float alpha)
           
 void fill(float r, float g, float b)
           
 void fill(float r, float g, float b, float alpha)
          Set the text fill for this object (same as setColor())
 void fillHex(int hexColor)
          Sets the text fill color according to a single hex number.
 int firstIndexOf(java.lang.String word)
           
 float getAlpha()
          Returns the fill alpha value (transparency)
 java.util.Set getAvailableFeatures()
          Returns a Set of all the available feature keys for the RiText
static RiTextBehavior getBehaviorById(int id)
          Returns the behavior corresponding to the specified 'id'.
 java.util.List getBehaviors()
          Returns a list of behaviors for the object.
 RiTextBehavior[] getBehaviorsByType(int type)
          Returns a list of behaviors of the specified type for this object, where type is generally one of (MOVE, FADE_IN, FADE_OUT, FADE_TO_TEXT, SCALE_TO, etc.)
 java.awt.geom.Rectangle2D getBoundingBox()
          Returns a rectangle representing the current screen position of the bounding box
 float[] getBoundingBoxFill()
          Returns the current bounding box fill color for this object
 float[] getBoundingBoxStroke()
          Returns the current bounding box stroke color for this object
 java.awt.geom.Point2D getCenter()
          Returns the point representing the center of the RiText
 float[] getColor()
          Returns the current text color for this object
static processing.core.PFont getDefaultFont(processing.core.PApplet pApplet)
          Returns the current default font.
 java.lang.String getFeature(java.lang.CharSequence name)
          Returns the String value for the given feature
 java.util.Map getFeatures()
          Returns a Map of all the features (key-value pairs) exists for this RiText
 processing.core.PFont getFont()
          Return the current font for this object
 float getImageHeight()
          Returns the height of the image associated with this RiText
 float getImageWidth()
          Returns the width of the image associated with this RiText
static RiText[] getInstances()
          Returns all existing instances of RiText objects in an array
 int getMotionType()
          Returns the motionType for this object,
static int getNumInstances()
          Returns the number of existing RiTexts
 processing.core.PApplet getPApplet()
           
static RiText[] getPicked(float x, float y)
          Returns all RiTexts that contain the point x,y or null if none do.
 java.lang.String getPos()
          Returns the part-of-speech tags, one per word, separated by WORD_BOUNDARY, using the default Tokenizer & Poart-of-speech tagger.
 java.lang.String getPos(boolean useWordNetTags)
          See rita.RiString#getPos(java.lang.String)
 java.lang.String[] getPosArr()
          See rita.RiString#getPos()
 java.lang.String[] getPosArr(boolean useWordNetTags)
          See rita.RiString#getPos()
 java.lang.String getPosAt(int wordIdx)
          See rita.RiString#getPosAt(int)
 java.lang.String getPosAt(int wordIdx, boolean useWordNetTags)
          See rita.RiString#getPosAt(int)
 float[] getPosition()
          Returns a 2 or 3-dimensional array with the objects x,y, or x,y,z position (depending on the renderer)
 RiSample getSample()
          Returns the RiSample object associated with this RiText
 float[] getScale()
          Returns a 3-dimensional array with the objects x,y,z scale (1=100% or unscaled)
 java.lang.String getText()
          Returns the current text
 int getTextAlignment()
          Returns the current alignment (default=LEFT)
 int getWordCount()
          See rita.RiString#getWordCount()
 java.lang.String[] getWords()
          See rita.RiString#getWords()
 float getX()
          Gets the current x-position of the RiText
 float getY()
          Gets the current y-position of the RiText
 float getZ()
          Returns the z position for this object
 boolean hasFeature(java.lang.CharSequence name)
          Checks whether the named feature (key-value pair) exists for this RiText
 int indexOf(int ch)
           
 int indexOf(int ch, int fromIndex)
           
 int indexOf(java.lang.String str)
          See rita.RiString#indexOf(java.lang.String)
 int indexOf(java.lang.String str, int fromIndex)
           
 boolean insertAt(int idx, java.lang.String toInsert)
          Inserts the 'toInsert' String at the desired character index ('idx').
 boolean insertCharAt(int idx, char toInsert)
          Inserts the character at the specified character index ('idx').
 boolean insertWordAt(java.lang.String newWord, int wordIdx)
           
 boolean isBoundingBoxVisible()
          Returns the visibility of the objects bounding box (default=false)
 boolean isMouseDraggable()
          Returns true if the object has been set to be draggable by the mouse
 boolean isOffscreen()
          Returns true if the object is offscreen
 boolean isOffscreen(processing.core.PGraphics p)
          Returns true if the object is offscreen
 boolean isShowingBoundingBox()
           
 boolean isVisible()
          Returns true if the objects is not hidden
 int lastIndexOf(int ch)
           
 int lastIndexOf(int ch, int fromIndex)
           
 int lastIndexOf(java.lang.String str)
           
 int lastIndexOf(java.lang.String str, int fromIndex)
           
 int length()
          Returns number of characters in the contained String
 processing.core.PFont loadFont(java.lang.String fontFileName)
          Returns the font specified after loading it and setting it as the the current font.
 processing.core.PFont loadFont(java.lang.String fontFileName, float size)
          Returns the font specified after loading it and setting the current font size.
 RiSample loadSample(java.lang.String sampleFileName)
           
 RiSample loadSample(java.lang.String sampleFileName, boolean setLooping)
           
 RiSample loadSample(java.lang.String sampleFileName, int playerType)
           
 RiSample loadSample(java.lang.String sampleFileName, int playerType, boolean setLooping)
          Loads a sample file and returns the appropriate type of RiSample object according to the library specified in playerType (defaults to Minim).
static RiText[] loadStrings(processing.core.PApplet p, java.lang.String fileName)
          Creates an array of RiText from a file, by delegating to PApplet.loadStrings(), then creating one array element per line (including blanks).
static void main(java.lang.String[] args)
           
 boolean matches(java.lang.String regex)
          See rita.RiString#matches(java.lang.String)
 void mouseEvent(java.awt.event.MouseEvent e)
           
 int moveBy(float[] posOffset, float startTime, float seconds)
          Move to new position by x,y offset over the duration specified by 'seconds'.
 int moveBy(float xOffset, float yOffset, float seconds)
          Move to new position by x,y offset over the duration specified by 'seconds'.
 int moveBy(float xOffset, float yOffset, float startTime, float seconds)
          Move to new position by x,y offset over the duration specified by 'seconds', starting at 'startTime' seconds in the future
 int moveBy3D(float xOffset, float yOffset, float zOffset, float seconds)
          Move to new position by x,y,z offset over the duration specified by 'seconds'.
 int moveBy3D(float xOffset, float yOffset, float zOffset, float startTime, float seconds)
          Move to new position by x,y,z offset over the duration specified by 'seconds'.
 int moveTo(float[] newPosition, float startTime, float seconds)
          Move to new absolute x,y (or x,y,z) position over 'time' seconds
 int moveTo(float newX, float newY, float seconds)
          Move to new absolute x,y (or x,y,z) position over 'time' seconds
 int moveTo(float newX, float newY, float startTime, float seconds)
          Move to new absolute x,y (or x,y,z) position over 'time' seconds
 int moveTo3D(float newX, float newY, float newZ, float seconds)
          Move to new position by x,y,z over the duration specified by 'seconds'.
 int moveTo3D(float newX, float newY, float newZ, float startTime, float seconds)
          Move to new position by x,y,z over the duration specified by 'seconds'.
static void pauseAllBehaviors(boolean paused)
          Immediately pauses all Behaviors in the RiText's run queue
 void pauseBehaviors(boolean paused)
          Pauses (or unpauses) all Behaviors in the RiText's run queue
static RiText[] popArray(RiText[] rts)
          Pops the last value off the array, deletes it, and returns the new array (shortened by one element).
 float positionForChar(int charIdx)
          Returns the x-position (in pixels) for the character at 'charIdx'.
 float positionForChar(processing.core.PFont pf, int charIdx)
          Returns the x-position (in pixels) for the character at 'charIdx'.
static boolean regexMatch(java.lang.String patternStr, java.lang.String fullStr)
          Utility method to test whether a String partially matches a regex pattern.
static java.lang.String regexReplace(java.lang.String patternStr, java.lang.String fullStr, java.lang.String replaceStr)
          Utility method to do regex replacement on a String
 boolean regionMatches(boolean ignoreCase, int toffset, java.lang.String other, int ooffset, int len)
           
static void removeAll()
          Deprecated.  
static void removeAll(java.util.List c)
          Deprecated.  
static void removeAll(RiText[] c)
          Deprecated.  
 void removeBehavior(RiTextBehavior behavior)
          Remove a Behavior from the RiText's run queue
 void removeBehaviors()
          Remove all Behaviors from the RiText's run queue
 boolean removeCharAt(int idx)
          Deletes the character at at the specified character index ('idx').
 void removeFeature(java.lang.CharSequence name)
          Clears the entry for the named feature (a key-value pair)
 void render()
          Override in subclasses to do custom rendering
 void render(processing.core.PGraphics p)
          Override in subclasses to do custom rendering
 java.lang.String replace(char oldChar, char newChar)
           
 java.lang.String replace(java.lang.CharSequence target, java.lang.CharSequence replacement)
          See rita.RiString#replace(java.lang.CharSequence, java.lang.CharSequence)
 void replace(java.lang.String oldText, java.lang.String newText)
          See rita.RiString#replace(java.lang.String, java.lang.String)
 java.lang.String replaceAll(java.lang.String regex, java.lang.String replacement)
          See rita.RiString#replaceAll(java.lang.String, java.lang.String)
 java.lang.String replaceByPos(java.lang.String newWord, java.lang.String pos)
           
 boolean replaceCharAt(int idx, char replaceWith)
          Replaces the character at the specified character index ('idx') with the 'replaceWith' character.
 boolean replaceCharAt(int idx, java.lang.String replaceWith)
          Replaces the character at 'idx' with 'replaceWith'.
 java.lang.String replaceFirst(java.lang.String regex, java.lang.String replacement)
           
 boolean replaceWordAt(java.lang.String newWord, int wordIdx)
          See rita.RiString#replaceWordAt(java.lang.String, int)
 void rotate(float rotate)
          Rotate the object via affine transform.
 void rotateX(float rotate)
          Sets the x-rotation for the object
 void rotateY(float rotate)
          Sets the y-rotation for the object
 void rotateZ(float rotate)
          Sets the z-rotation for the object
 void scale(float scale)
          Uniformly scales the object on all dimensions (x,y,z)
 void scale(float[] scales)
          Scales the object on either 2 or 3 dimensions (x,y,[z])
 void scale(float sX, float sY, float sZ)
          Scales the object on all dimensions (x,y,z)
 int scaleTo(float newScale, float seconds)
          Scales object to 'newScale' over 'time' seconds, starting immediately.
 int scaleTo(float newScale, float startTime, float seconds)
          Scales object to 'newScale' over 'time' seconds, starting at 'startTime' seconds in the future
 int scaleTo(float scaleX, float scaleY, float scaleZ, float seconds)
          Scales object to {scaleX, scaleY, scaleZ} over 'time' seconds.
 int scaleTo(float newScaleX, float newScaleY, float newScaleZ, float startTime, float seconds)
          Scales object to {scaleX, scaleY, scaleZ} over 'time' seconds, starting at 'startTime' seconds in the future.
 void scaleX(float scale)
          Sets the x-scale for the object
 void scaleY(float scale)
          Sets the y-scale for the object
 void scaleZ(float scale)
          Sets the z-scale for the object
 void setAlpha(float alpha)
          Set the current alpha trasnparency for this object (0-255))
 void setAutoDraw(boolean b)
          Enables/disables auto-drawing for this object
static void setBoundingBoxesVisible(boolean visible)
          Deprecated.  
static void setBoundingBoxStrokeWeights(float strokeWeight)
          Deprecated. see setDefaultBBoxStrokeWeight(float)
 RiTextBehavior setCallbackTimer(float seconds)
          Deprecated.  
 RiTextBehavior setCallbackTimer(float seconds, boolean repeat)
          Deprecated.  
 void setColor(float[] color)
          Set the text color for this object
static void setDefaultAlignment(int defaultAlignment)
          Sets the default alignment for all RiTexts to be created.
static void setDefaultBBoxFill(float[] fillColor)
          Set the bounding box fill color for all RiTexts to be created;
static void setDefaultBBoxFill(float r, float g, float b, float a)
          Set the bounding box fill color for all RiTexts to be created;
static void setDefaultBBoxStroke(float[] strokeColor)
          Set the bounding box stroke color for all RiTexts to be created;
static void setDefaultBBoxStroke(float r, float g, float b, float a)
          Set the bounding box fill color for all RiTexts to be created;
static void setDefaultBBoxStrokeWeight(float strokeWeight)
          Set the default bounding box strokeweight for all RiTexts to be created.
static void setDefaultBBoxVisibility(boolean show)
          Sets the default behavior regarding whether newly created RiTexts are to display their bounding boxes
Note: this does not affect already created RiText objects
static void setDefaultColor(float gray)
           
static void setDefaultColor(float[] color)
          Sets the default color for all (subsequently) created RiTexts.
static void setDefaultColor(float gray, float alpha)
           
static void setDefaultColor(float r, float g, float b)
           
static void setDefaultColor(float r, float g, float b, float alpha)
          Sets the default color for all RiTexts to be created.
static void setDefaultFont(java.lang.String defaultFontName)
          Sets the default font for all RiTexts to be created (via PApplet.loadFont(String)).
static void setDefaultMotionType(int defaultMotionType)
          Sets the default motion type for all (subsequently) created RiTexts.
static void setDefaultMouseDraggable(boolean draggable)
          Sets the default behavior regarding whether newly created RiTexts are to be mouse-draggable
Note: this does not affect already created RiText objects
 void setFeatures(java.util.Map features)
          Replaces all the features (key-value pairs) for the RiText with those in features
static void setFont(processing.core.PFont pfont)
          Deprecated.  
static void setFont(java.lang.String fontName)
          Deprecated.  
static void setFontSize(float fontSize)
          Deprecated.  
 void setMotionType(int motionType)
          Sets the animation motionType for this for moveTo() or moveBy() methods on this object, set via one of the following constants:
RiText.LINEAR RiText.EASE_IN RiText.EASE_OUT RiText.EASE_IN_OUT RiText.EASE_IN_OUT_CUBIC RiText.EASE_IN_CUBIC RiText.EASE_OUT_CUBIC; RiText.EASE_IN_OUT_QUARTIC RiText.EASE_IN_QUARTIC RiText.EASE_OUT_QUARTIC; RiText.EASE_IN_OUT_SINE RiText.EASE_IN_SINE RiText.EASE_OUT_SINE
 void setMouseDraggable(boolean mouseDraggable)
          Sets the object's draggable state (default=false)
 void setPosition(float x, float y)
          Sets the position for the current RiText
 void setPosition(float x, float y, float z)
          Sets the 3d position for the current RiText
 void setString(java.lang.CharSequence[] words)
           
 void setString(java.lang.String newWord)
           
 void setText(char ch)
          Sets the current text to the character
 void setText(java.lang.String _text)
          Sets the current text to this String
static void setTextAlignment(int alignment)
          Deprecated.  
 void setVisible(boolean visible)
          Sets boolean flag to show or hide the object
 void setX(float x)
          Sets the x-position of the current RiText
 void setY(float y)
          Sets the y-position of the current RiText
 void setZ(float z)
          Sets the z position for this object
static RiText[] shiftArray(RiText[] rts)
          Shifts the first value off the array, deletes it, and returns the new array (shortened by one element).
 void showBoundingBox(boolean showBoundingBox)
          Sets the visibility of the objects bounding box (default=false)
static void showBoundingBoxes(boolean visible)
          Deprecated.  
 RiText[] splitLetters()
          Splits the current object into an array of RiTexts, one per letter, maintaining the x and y position of each.
 RiText[] splitLetters(processing.core.PFont pf)
          Splits the current object into an array of RiTexts, one per letter, maintaining the x and y position of each.
 RiText[] splitWords()
          Splits this object into an array of RiTexts, one per word, with correct x and y-positions.
 boolean startsWith(java.lang.String prefix)
           
 boolean startsWith(java.lang.String prefix, int toffset)
           
 java.lang.CharSequence subSequence(int start, int end)
          Returns a new character sequence that is a subsequence of this sequence.
 java.lang.String substring(int beginIndex)
           
 java.lang.String substring(int beginIndex, int endIndex)
           
 void textAlign(int alignment)
          Sets text mode for RiText object.
 void textFont(processing.core.PFont pf)
           
 void textFont(processing.core.PFont pf, float size)
          Sets the font and size for this object's text
 float textHeight()
          Returns the height for the current font in pixels (including ascendors and descendors)
 void textMode(int alignment)
          Sets text mode for RiText object.
 float textSize()
          Gets the current text size
 void textSize(float textSize)
          Sets the object to this size
 float textWidth()
          Returns the current text width in pixels
static RiText[] toArray(java.util.List result)
          Converts and returns a list of RiTexts as a RiText[]
 char[] toCharArray()
           
 java.lang.String toLowerCase()
           
 java.lang.String toLowerCase(java.util.Locale locale)
           
 java.lang.String toString()
           
 java.lang.String toUpperCase()
           
 java.lang.String toUpperCase(java.util.Locale locale)
           
 java.lang.String trim()
           
 void updateBehaviors()
           
 
Methods inherited from class rita.RiObject
getId, nextId
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_FONT

public static java.lang.String DEFAULT_FONT
Invisible:

DEFAULT_MOTION_TYPE

public static int DEFAULT_MOTION_TYPE
Invisible:

DBUG_INFO

public static boolean DBUG_INFO
Invisible:

sample

public RiSample sample
Current Sample object for this text


motionType

public int motionType
Invisible:

scaleX

public float scaleX
Invisible:

scaleY

public float scaleY
Invisible:

scaleZ

public float scaleZ
Invisible:

rotateX

public float rotateX
Invisible:

rotateY

public float rotateY
Invisible:

rotateZ

public float rotateZ
Invisible:

x

public float x
Current x-position of this text


y

public float y
Current y-position of this text


z

public float z
Current z-position of this text

Invisible:
Constructor Detail

RiText

public RiText(processing.core.PApplet pApplet)

RiText

public RiText(processing.core.PApplet pApplet,
              java.lang.String text)

RiText

public RiText(processing.core.PApplet pApplet,
              char character)

RiText

public RiText(processing.core.PApplet pApplet,
              float startXPos,
              float startYPos)

RiText

public RiText(processing.core.PApplet pApplet,
              char character,
              float startXPos,
              float startYPos)

RiText

public RiText(processing.core.PApplet pApplet,
              java.lang.String text,
              float startXPos,
              float startYPos)

RiText

public RiText(processing.core.PApplet pApplet,
              java.lang.String text,
              float startXPos,
              float startYPos,
              processing.core.PFont font)

RiText

public RiText(processing.core.PApplet pApplet,
              java.lang.String text,
              float xPos,
              float yPos,
              int alignment)

RiText

public RiText(processing.core.PApplet pApplet,
              java.lang.String text,
              float xPos,
              float yPos,
              int alignment,
              processing.core.PFont theFont)
Creates a new RiText object base-aligned at x='xPos', y='yPos', with 'alignment' from one of (LEFT, CENTER, RIGHT), using font specified by 'theFont'.

Method Detail

createLerp

public RiLerpBehavior createLerp(processing.core.PApplet pApplet,
                                 float start,
                                 float target,
                                 float startOffsetSec,
                                 float durationSec)
Creates and returns a new behavior that interpolates between 2 values, 'start' and 'target', and generates a callback to pApplet.onRiTaEvent(RiTaEvent) when finished.

Parameters:
pApplet - The parent applet to call back to
start - the start value
target - the target value
startOffsetSec - Time before the timer starts (in seconds)
durationSec - The timer's period (in seconds)
See Also:
RiLerpBehavior.getValue()
Invisible:

createLerp

public RiLerpBehavior createLerp(processing.core.PApplet pApplet,
                                 float start,
                                 float target,
                                 float durationSec)
Invisible:

createLerp

public RiLerpBehavior createLerp(processing.core.PApplet pApplet)
Invisible:

getCenter

public java.awt.geom.Point2D getCenter()
Returns the point representing the center of the RiText

Invisible:

getDefaultFont

public static processing.core.PFont getDefaultFont(processing.core.PApplet pApplet)
Returns the current default font.

Note: This method may create one or more objects so should be used sparingly.

Invisible:

boundingBoxStrokeWeight

public float boundingBoxStrokeWeight()
Returns the bounding box stroke weight

Invisible:

boundingBoxPadding

public float boundingBoxPadding()
Returns the bounding box padding

Invisible:

fill

public void fill(float r,
                 float g,
                 float b,
                 float alpha)
Set the text fill for this object (same as setColor())

Parameters:
r - red component (0-255)
g - green component (0-255)
b - blue component (0-255)
alpha - transparency (0-255)

fill

public void fill(float gray)

fill

public void fill(float gray,
                 float alpha)

fill

public void fill(float r,
                 float g,
                 float b)

fill

public void fill(float[] color)

fillHex

public void fillHex(int hexColor)
Sets the text fill color according to a single hex number.

Invisible:

setColor

public void setColor(float[] color)
Set the text color for this object

Parameters:
r - red component (0-255)
g - green component (0-255)
b - blue component (0-255)
alpha - transparency (0-255)
Invisible:

boundingBoxFill

public void boundingBoxFill(float r,
                            float g,
                            float b,
                            float alpha)
Set the bounding-box (or background) color for this object

Parameters:
r - red component (0-255)
g - green component (0-255)
b - blue component (0-255)
alpha - transparency (0-255)
Invisible:

boundingBoxFill

public void boundingBoxFill(float[] color)
Set the current boundingBoxFill color for this object, applicable only when showBoundingBox(true) has been called.

Invisible:

boundingBoxFill

public void boundingBoxFill(float gray)

boundingBoxFill

public void boundingBoxFill(float gray,
                            float alpha)

boundingBoxFill

public void boundingBoxFill(float r,
                            float g,
                            float b)

boundingBoxStroke

public void boundingBoxStroke(float r,
                              float g,
                              float b,
                              float alpha)
Set the stroke color for the bounding-box of this object, assuming it has been set to visible.

Parameters:
r - red component (0-255)
g - green component (0-255)
b - blue component (0-255)
alpha - transparency (0-255)
See Also:
showBoundingBox(boolean), showBoundingBoxes(boolean)
Invisible:

boundingBoxStroke

public void boundingBoxStroke(float gray)

boundingBoxStroke

public void boundingBoxStroke(float gray,
                              float alpha)

boundingBoxStroke

public void boundingBoxStroke(float r,
                              float g,
                              float b)

getColor

public float[] getColor()
Returns the current text color for this object

Invisible:

getBoundingBoxFill

public float[] getBoundingBoxFill()
Returns the current bounding box fill color for this object

Invisible:

getBoundingBoxStroke

public float[] getBoundingBoxStroke()
Returns the current bounding box stroke color for this object

Invisible:

boundingBoxStroke

public void boundingBoxStroke(float[] color)
Set the current boundingBoxStroke color for this object, applicable only when showBoundingBox(true) has been called.

Invisible:

setAlpha

public void setAlpha(float alpha)
Set the current alpha trasnparency for this object (0-255))

Parameters:
alpha -

getAlpha

public float getAlpha()
Returns the fill alpha value (transparency)

Invisible:

contains

public boolean contains(float mx,
                        float my)
Checks if the input point is inside the bounding box


contains3D

public boolean contains3D(float mx,
                          float my)
Checks if the input point is inside the object's bounding box after converting its x,y,z coordinates to screen x & y.

See Also:
PApplet.screenX(float, float, float), PApplet.screenY(float, float, float)
Invisible:

draw

public void draw()
Draw the RiText object at current x,y,color,font,alignment, etc.

NOTE: called automatically unless disabled

See Also:
disableAutoDraw()
Invisible:

draw

public void draw(processing.core.PGraphics p)
Draw the RiText object at current x,y,color,font,alignment, etc. on the specified PGraphics object

See Also:
draw()
Invisible:

render

public void render()
Override in subclasses to do custom rendering

Note: It is preferable to override this method rather than the draw() method in subclasses to ensure proper maintenance of contained objects.

Invisible:

render

public void render(processing.core.PGraphics p)
Override in subclasses to do custom rendering

Note: It is preferable to override this method rather than the draw() method in subclasses to ensure proper maintenance of contained objects.

Invisible:

dispose

public void dispose()
To be called only by AppletContainer on destroy, not by users!

Overrides:
dispose in class RiObject
Invisible:

copy

public RiText copy()
Returns a field for field copy of this object


delete

public static void delete(RiText rt)
Call to remove a RiText from the current sketch (and from existence), cleaning up whatever resources it may have held


mouseEvent

public void mouseEvent(java.awt.event.MouseEvent e)
Invisible:

textWidth

public float textWidth()
Returns the current text width in pixels


textHeight

public float textHeight()
Returns the height for the current font in pixels (including ascendors and descendors)


setMotionType

public void setMotionType(int motionType)
Sets the animation motionType for this for moveTo() or moveBy() methods on this object, set via one of the following constants:

Parameters:
motionType -

getMotionType

public int getMotionType()
Returns the motionType for this object,


setCallbackTimer

public RiTextBehavior setCallbackTimer(float seconds)
Deprecated. 

See RiTa#setCallbackTimer(PApplet, float):

Generates a single callback to onRiTaEvent() after the amount of time specifed in seconds.

Invisible:

setCallbackTimer

public RiTextBehavior setCallbackTimer(float seconds,
                                       boolean repeat)
Deprecated. 

See RiTa#setCallbackTimer(PApplet, float, boolean):

Generates a callback to onRiTaEvent() after the amount of time specifed in seconds. Will repeat indefinitely if repeat is set to true (default=true).

Invisible:

moveTo

public int moveTo(float newX,
                  float newY,
                  float seconds)
Move to new absolute x,y (or x,y,z) position over 'time' seconds

Note: uses the current motionType for this object.

Returns:
the unique id for this behavior

moveTo

public int moveTo(float newX,
                  float newY,
                  float startTime,
                  float seconds)
Move to new absolute x,y (or x,y,z) position over 'time' seconds

Note: uses the current motionType for this object, starting at 'startTime' seconds in the future

Returns:
the unique id for this behavior

moveTo

public int moveTo(float[] newPosition,
                  float startTime,
                  float seconds)
Move to new absolute x,y (or x,y,z) position over 'time' seconds

Note: uses the current motionType for this object, starting at 'startTime' seconds in the future

Returns:
the unique id for this behavior
See Also:
setMotionType(int)

moveTo3D

public int moveTo3D(float newX,
                    float newY,
                    float newZ,
                    float startTime,
                    float seconds)
Move to new position by x,y,z over the duration specified by 'seconds'.

Note: uses the current motionType for this object.

Returns:
the unique id for this behavior
See Also:
setMotionType(int)
Invisible:

moveTo3D

public int moveTo3D(float newX,
                    float newY,
                    float newZ,
                    float seconds)
Move to new position by x,y,z over the duration specified by 'seconds'.

Note: uses the current motionType for this object.

Returns:
the unique id for this behavior
See Also:
setMotionType(int)
Invisible:

moveBy

public int moveBy(float xOffset,
                  float yOffset,
                  float startTime,
                  float seconds)
Move to new position by x,y offset over the duration specified by 'seconds', starting at 'startTime' seconds in the future

Returns:
the unique id for this behavior

moveBy

public int moveBy(float xOffset,
                  float yOffset,
                  float seconds)
Move to new position by x,y offset over the duration specified by 'seconds'.

Returns:
the unique id for this behavior

moveBy

public int moveBy(float[] posOffset,
                  float startTime,
                  float seconds)
Move to new position by x,y offset over the duration specified by 'seconds'.

Note: uses the current motionType for this object.

Returns:
the unique id for this behavior
See Also:
setMotionType(int)

moveBy3D

public int moveBy3D(float xOffset,
                    float yOffset,
                    float zOffset,
                    float seconds)
Move to new position by x,y,z offset over the duration specified by 'seconds'.

Note: uses the current motionType for this object.

See Also:
setMotionType(int)
Invisible:

moveBy3D

public int moveBy3D(float xOffset,
                    float yOffset,
                    float zOffset,
                    float startTime,
                    float seconds)
Move to new position by x,y,z offset over the duration specified by 'seconds'.

Note: uses the current motionType for this object.

See Also:
setMotionType(int)
Invisible:

isOffscreen

public boolean isOffscreen()
Returns true if the object is offscreen


isOffscreen

public boolean isOffscreen(processing.core.PGraphics p)
Returns true if the object is offscreen

Invisible:

scaleTo

public int scaleTo(float newScale,
                   float startTime,
                   float seconds)
Scales object to 'newScale' over 'time' seconds, starting at 'startTime' seconds in the future

Note: uses linear interpolation unless otherwise specified. Returns the Id of the RiTextBehavior object used for the scale.


scaleTo

public int scaleTo(float newScale,
                   float seconds)
Scales object to 'newScale' over 'time' seconds, starting immediately.

Note: uses linear interpolation unless otherwise specified. Returns the Id of the RiTextBehavior object used for the scale.


scaleTo

public int scaleTo(float scaleX,
                   float scaleY,
                   float scaleZ,
                   float seconds)
Scales object to {scaleX, scaleY, scaleZ} over 'time' seconds. Note: uses linear interpolation unless otherwise specified. Returns the Id of the RiTextBehavior object used for the scale.


scaleTo

public int scaleTo(float newScaleX,
                   float newScaleY,
                   float newScaleZ,
                   float startTime,
                   float seconds)
Scales object to {scaleX, scaleY, scaleZ} over 'time' seconds, starting at 'startTime' seconds in the future.

Returns the Id of the RiTextBehavior object used for the scale. Note: uses linear interpolation unless otherwise specified.


fadeIn

public int fadeIn(float startTime,
                  float seconds)
Fades in current text over seconds starting at startTime. Interpolates from the current color {r,g,b,a} to {r,g,b,255}.

Parameters:
startTime - time in future to start
seconds - time for fade
Returns:
a unique id for this behavior

fadeIn

public int fadeIn(float seconds)

fadeOut

public int fadeOut(float startTime,
                   float seconds,
                   boolean removeOnComplete)
Fades out current text over seconds starting at startTime. Interpolates from the current color {r,g,b,a} to {r,g,b,0}.

Parameters:
startTime - time in future to start
seconds - time for fade
removeOnComplete - destroys the object when the behavior completes
Returns:
the unique id for this behavior

fadeOut

public int fadeOut(float startTime,
                   float seconds)

fadeOut

public int fadeOut(float seconds,
                   boolean removeOnComplete)

fadeOut

public int fadeOut(float seconds)

fadeColor

public int fadeColor(float r,
                     float g,
                     float b,
                     float a,
                     float seconds)
Transitions to 'color' (rgba) over 'seconds' starting at 'startTime' seconds in the future

Parameters:
seconds - time for fade
Returns:
a unique id for this behavior

fadeColor

public int fadeColor(float[] color,
                     float seconds)

fadeColor

public int fadeColor(float gray,
                     float seconds)

fadeColor

public int fadeColor(float[] color,
                     float startTime,
                     float seconds)
Transitions to 'color' (rgba) over 'seconds' starting at 'startTime' seconds in the future

Parameters:
startTime - time in future to start
seconds - time for fade
Returns:
a unique id for this behavior

fadeToText

public int fadeToText(java.lang.String newText,
                      float seconds)
Fades out the current text and fades in the newText over seconds starting immediately

Returns:
the unique id for this behavior

fadeToText

public int fadeToText(java.lang.String newText,
                      float startTime,
                      float seconds)
Fades out the current text and fades in the newText over seconds starting at 'startTime' seconds in the future

Parameters:
newText - to be faded in
startTime - # of seconds in the future that the fade will start
seconds - time for fade
Returns:
the unique id for this behavior

setBoundingBoxStrokeWeights

public static void setBoundingBoxStrokeWeights(float strokeWeight)
Deprecated. see setDefaultBBoxStrokeWeight(float)

Set the bounding box strokeweight for all existing RiTexts; set to 0 if you wish to assign a background color with no stroke.

Invisible:

setDefaultBBoxStrokeWeight

public static void setDefaultBBoxStrokeWeight(float strokeWeight)
Set the default bounding box strokeweight for all RiTexts to be created. Set to 0 if you wish to assign a background color with no stroke.


setDefaultBBoxStroke

public static void setDefaultBBoxStroke(float[] strokeColor)
Set the bounding box stroke color for all RiTexts to be created;


setDefaultBBoxStroke

public static void setDefaultBBoxStroke(float r,
                                        float g,
                                        float b,
                                        float a)
Set the bounding box fill color for all RiTexts to be created;


setDefaultBBoxFill

public static void setDefaultBBoxFill(float[] fillColor)
Set the bounding box fill color for all RiTexts to be created;


setDefaultBBoxFill

public static void setDefaultBBoxFill(float r,
                                      float g,
                                      float b,
                                      float a)
Set the bounding box fill color for all RiTexts to be created;


deleteAll

public static void deleteAll()
Deletes all current instances.


removeAll

public static void removeAll(RiText[] c)
Deprecated. 

Deletes all objects in the array (and the array itself)

See Also:
delete(RiText[])
Invisible:

removeAll

public static void removeAll(java.util.List c)
Deprecated. 

Deletes all objects in the array (and the array itself)

See Also:
delete(List)
Invisible:

removeAll

public static void removeAll()
Deprecated. 

Deletes all current instances.

See Also:
deleteAll()
Invisible:

delete

public static void delete(RiText[] c)
Deletes all objects in the array (and the array itself)


delete

public static void delete(java.util.List l)
Deletes all objects in the List.


setFont

public static void setFont(processing.core.PFont pfont)
Deprecated. 

Sets font for all existing objects.

Parameters:
pfont -
See Also:
textFont(PFont), setDefaultFont(String)
Invisible:

setFontSize

public static void setFontSize(float fontSize)
Deprecated. 

Sets default text size for all existing objects.

Parameters:
fontSize -
See Also:
loadFont(String, float)
Invisible:

setBoundingBoxesVisible

public static void setBoundingBoxesVisible(boolean visible)
Deprecated. 

Sets boundingBoxes (in)visible for all existing objects

Invisible:

showBoundingBoxes

public static void showBoundingBoxes(boolean visible)
Deprecated. 

Sets visibility of boundingBoxes for all existing objects

See Also:
setDefaultBBoxVisibility(boolean)
Invisible:

setTextAlignment

public static void setTextAlignment(int alignment)
Deprecated. 

Sets alignment for all existing objects

Parameters:
alignment -
See Also:
textAlign(int)
Invisible:

setFont

public static void setFont(java.lang.String fontName)
Deprecated. 

Sets font for all existing RiText objects.

See Also:
setDefaultFont(String)
Invisible:

getInstances

public static RiText[] getInstances()
Returns all existing instances of RiText objects in an array


getPicked

public static RiText[] getPicked(float x,
                                 float y)
Returns all RiTexts that contain the point x,y or null if none do.

Note: this will return an array even if only one item is picked, therefore, you should generally use it as follows:

   RiText picked = null;
   RiText[] rts = RiText.getPicked(mx, my);
   if (rts != null)
 picked = rts[0];
 
 

Returns:
RiText[] 1 or more RiTexts containing the point, or null if none do.

fadeAllOut

public static void fadeAllOut(float seconds)
Fades all visible RiText objects.


fadeAllIn

public static void fadeAllIn(float seconds)
Fades in all RiText objects over the specified duration


loadSample

public RiSample loadSample(java.lang.String sampleFileName,
                           int playerType,
                           boolean setLooping)
Loads a sample file and returns the appropriate type of RiSample object according to the library specified in playerType (defaults to Minim). Starts the sample looping if setLooping is true

See Also:
RiConstants.MINIM, RiConstants.ESS, RiConstants.SONIA

loadSample

public RiSample loadSample(java.lang.String sampleFileName,
                           boolean setLooping)

loadSample

public RiSample loadSample(java.lang.String sampleFileName,
                           int playerType)

loadSample

public RiSample loadSample(java.lang.String sampleFileName)

getFont

public processing.core.PFont getFont()
Return the current font for this object


textFont

public void textFont(processing.core.PFont pf,
                     float size)
Sets the font and size for this object's text


textFont

public void textFont(processing.core.PFont pf)

loadFont

public processing.core.PFont loadFont(java.lang.String fontFileName)
Returns the font specified after loading it and setting it as the the current font.


loadFont

public processing.core.PFont loadFont(java.lang.String fontFileName,
                                      float size)
Returns the font specified after loading it and setting the current font size.


createFont

public void createFont(java.lang.String fontName,
                       float sz)
Creates (and caches) the font for this object from a System font (via PApplet.createFont()). Note: this is not a good idea for web-applets as the user's machine must have the specified font.

See Also:
PApplet.createFont(String, float)

boundingBoxStrokeWeight

public void boundingBoxStrokeWeight(float r)
Set the current bgstroke weight for this object


boundingBoxPadding

public void boundingBoxPadding(float padding)
Sets min padding (in pixels) around all sides of text in bounding box (default=1)

Invisible:

textSize

public float textSize()
Gets the current text size

Invisible:

textSize

public void textSize(float textSize)
Sets the object to this size


getText

public java.lang.String getText()
Returns the current text

Specified by:
getText in interface FeaturedIF

setText

public void setText(java.lang.String _text)
Sets the current text to this String


setVisible

public void setVisible(boolean visible)
Sets boolean flag to show or hide the object


setText

public void setText(char ch)
Sets the current text to the character

Invisible:

toString

public java.lang.String toString()
Specified by:
toString in interface java.lang.CharSequence
Overrides:
toString in class java.lang.Object
Invisible:

getX

public float getX()
Gets the current x-position of the RiText


setX

public void setX(float x)
Sets the x-position of the current RiText


getY

public float getY()
Gets the current y-position of the RiText


setY

public void setY(float y)
Sets the y-position of the current RiText


isVisible

public boolean isVisible()
Returns true if the objects is not hidden


getSample

public RiSample getSample()
Returns the RiSample object associated with this RiText


getImageHeight

public float getImageHeight()
Returns the height of the image associated with this RiText


getImageWidth

public float getImageWidth()
Returns the width of the image associated with this RiText


updateBehaviors

public void updateBehaviors()
Invisible:

addBehavior

public RiTextBehavior addBehavior(RiTextBehavior behavior)
Add a new behavior to this RiText's run queue


removeBehavior

public void removeBehavior(RiTextBehavior behavior)
Remove a Behavior from the RiText's run queue

Invisible:

completeBehaviors

public void completeBehaviors()
Immediately marks all Behaviors in the RiText's run queue as complete and causes them to fire theirbehaviorCompleted() methods.

Invisible:

pauseBehaviors

public void pauseBehaviors(boolean paused)
Pauses (or unpauses) all Behaviors in the RiText's run queue

Invisible:

removeBehaviors

public void removeBehaviors()
Remove all Behaviors from the RiText's run queue

Invisible:

setPosition

public void setPosition(float x,
                        float y)
Sets the position for the current RiText


setPosition

public void setPosition(float x,
                        float y,
                        float z)
Sets the 3d position for the current RiText

Invisible:

isBoundingBoxVisible

public boolean isBoundingBoxVisible()
Returns the visibility of the objects bounding box (default=false)

Invisible:

showBoundingBox

public void showBoundingBox(boolean showBoundingBox)
Sets the visibility of the objects bounding box (default=false)


getBehaviors

public java.util.List getBehaviors()
Returns a list of behaviors for the object.

Invisible:

getBehaviorsByType

public RiTextBehavior[] getBehaviorsByType(int type)
Returns a list of behaviors of the specified type for this object, where type is generally one of (MOVE, FADE_IN, FADE_OUT, FADE_TO_TEXT, SCALE_TO, etc.)

Invisible:

getBehaviorById

public static RiTextBehavior getBehaviorById(int id)
Returns the behavior corresponding to the specified 'id'.

Invisible:

isMouseDraggable

public boolean isMouseDraggable()
Returns true if the object has been set to be draggable by the mouse

Invisible:

setMouseDraggable

public void setMouseDraggable(boolean mouseDraggable)
Sets the object's draggable state (default=false)


getTextAlignment

public int getTextAlignment()
Returns the current alignment (default=LEFT)

Invisible:

textAlign

public void textAlign(int alignment)
Sets text mode for RiText object.

Parameters:
alignment - (CENTER, RIGHT, LEFT[default])
See Also:
textAlign(int)

textMode

public void textMode(int alignment)
Sets text mode for RiText object.

Parameters:
alignment - (CENTER, RIGHT, LEFT[default])
See Also:
textAlign(int)

getBoundingBox

public java.awt.geom.Rectangle2D getBoundingBox()
Returns a rectangle representing the current screen position of the bounding box


toArray

public static RiText[] toArray(java.util.List result)
Converts and returns a list of RiTexts as a RiText[]

Invisible:

splitWords

public RiText[] splitWords()
Splits this object into an array of RiTexts, one per word, with correct x and y-positions.

To split into words, according to the default tokenizer, use RiTa.tokenize(String).

Note: If desired, the original RiText should be deleted explicitly (via RiText.delete(originalRiText)).

Invisible:

length

public int length()
Returns number of characters in the contained String

Specified by:
length in interface java.lang.CharSequence

positionForChar

public float positionForChar(int charIdx)
Returns the x-position (in pixels) for the character at 'charIdx'.

Parameters:
pf -
Invisible:

positionForChar

public float positionForChar(processing.core.PFont pf,
                             int charIdx)
Returns the x-position (in pixels) for the character at 'charIdx'.

Parameters:
pf -
Invisible:

getPApplet

public processing.core.PApplet getPApplet()
Overrides:
getPApplet in class RiObject
Invisible:

pauseAllBehaviors

public static void pauseAllBehaviors(boolean paused)
Immediately pauses all Behaviors in the RiText's run queue

Invisible:

loadStrings

public static RiText[] loadStrings(processing.core.PApplet p,
                                   java.lang.String fileName)
Creates an array of RiText from a file, by delegating to PApplet.loadStrings(), then creating one array element per line (including blanks).

Parameters:
fileName - located in data directory

createLinesFromFile

public static RiText[] createLinesFromFile(processing.core.PApplet pApplet,
                                           java.lang.String fileName,
                                           float startX,
                                           float startY,
                                           int maxCharsPerLine)
Creates an array of RiText from the file specified by 'fileName', one per line of input text, constrained to the 'maxChars' specified, starting with upper left corner at 'startX' and 'startY'.


createLinesFromFile

public static RiText[] createLinesFromFile(processing.core.PApplet pApplet,
                                           java.lang.String fileName,
                                           int x,
                                           int y)
Creates an array of RiText from the file specified by 'fileName', one per line of input text, starting with upper left corner at 'startX' and 'startY'.


createLinesFromFile

public static RiText[] createLinesFromFile(processing.core.PApplet pApplet,
                                           processing.core.PFont font,
                                           java.lang.String fileName,
                                           float startX,
                                           float startY,
                                           int maxCharsPerLine,
                                           float leading)
Creates an array of RiText from the file specified by 'fileName', one per line of input text, constrained to the 'maxChars' specified, starting with upper left corner at 'startX' and 'startY'.

Parameters:
leading - pixels to add between lines (defaults to 1/2 the font-height)
Returns:
RiText[] or null for empty input

createLinesFromFile

public static RiText[] createLinesFromFile(processing.core.PApplet pApplet,
                                           java.lang.String fileName,
                                           float startX,
                                           float startY,
                                           int maxCharsPerLine,
                                           float leading)
Creates an array of RiText from the file specified by 'fileName', one per line of input text, constrained to the 'maxChars' specified, starting with upper left corner at 'startX' and 'startY', using the 'leading' specified.


createLines

public static RiText[] createLines(processing.core.PApplet pApplet,
                                   java.lang.String text,
                                   float startX,
                                   float startY,
                                   int maxCharsPerLine,
                                   float leading)
Creates an array of RiText, one per line of input 'text', constrained to the 'maxChars' specified, starting with upper left corner at 'startX' and 'startY'.


createLines

public static RiText[] createLines(processing.core.PApplet p,
                                   java.lang.String text,
                                   float startX,
                                   float startY)

createLines

public static RiText[] createLines(processing.core.PApplet p,
                                   java.lang.String text,
                                   float startX,
                                   float startY,
                                   int maxCharsPerLine)

createLines

public static RiText[] createLines(processing.core.PApplet pApplet,
                                   processing.core.PFont font,
                                   java.lang.String text,
                                   float startX,
                                   float startY,
                                   int maxCharsPerLine,
                                   float leading)
Creates an array of RiText, one per line of input 'text', constrained to the 'maxChars' specified, starting with upper left corner at 'startX' and 'startY'.

Parameters:
startX - x-position for 1st line of text
startY - x-position for 1st line of text
leading - # of pixels to add between lines in addition to the textAscent (defaults to ~2x the textAscent of the current font)
Returns:
RiText[] or null on empty input

createLines

public static RiText[] createLines(processing.core.PApplet pApplet,
                                   java.lang.String[] lines,
                                   float startX,
                                   float startY,
                                   int maxCharsPerLine,
                                   float leading)
Creates a RiText[] from the lines, re-formatting lines according to maxCharsPerLine (using the specified 'font').


createLines

public static RiText[] createLines(processing.core.PApplet pApplet,
                                   java.lang.String[] text,
                                   float startX,
                                   float startY)

createLines

public static RiText[] createLines(processing.core.PApplet pApplet,
                                   java.lang.String[] text,
                                   float startX,
                                   float startY,
                                   int maxCharsPerLine)

createLetters

public static RiText[] createLetters(processing.core.PApplet pApplet,
                                     java.lang.String theText,
                                     int startX,
                                     int startY)
Creates an array of RiTexts, one per letter, with appropriate x and y positions for each (using the default 'font'), starting at 'xStart' and 'yStart'.


createLetters

public static RiText[] createLetters(processing.core.PApplet pApplet,
                                     processing.core.PFont theFont,
                                     java.lang.String theText,
                                     int startX,
                                     int startY)
Creates an array of RiTexts, one per letter, with appropriate x and y positions for each (using the 'font' specified), starting at 'xStart' and 'yStart'.


createLines

public static RiText[] createLines(processing.core.PApplet pApplet,
                                   java.lang.String text,
                                   java.awt.Rectangle rectangle)
Creates an array of RiText, one per line from the input String, and lays it out according to the rectangle specified.


createLines

public static RiText[] createLines(processing.core.PApplet pApplet,
                                   processing.core.PFont pf,
                                   java.lang.String text,
                                   java.awt.Rectangle rectangle)
Creates an array of RiText, one per line from the input String, and lays it out according to the rectangle (and font) specified.


createLines

public static RiText[] createLines(processing.core.PApplet pApplet,
                                   processing.core.PFont pf,
                                   java.lang.String text,
                                   java.awt.Rectangle rectangle,
                                   float leading)
Creates an array of RiText, one per line from the input String, and lays it out according to the rectangle (and font/leading) specified.


createLinesFromFile

public static RiText[] createLinesFromFile(processing.core.PApplet pApplet,
                                           java.lang.String fileName,
                                           java.awt.Rectangle rectangle)
Creates an array of RiTexts, one per line from the input file, and lays it out according to the rectangle specified.


createLinesFromFile

public static RiText[] createLinesFromFile(processing.core.PApplet pApplet,
                                           processing.core.PFont pf,
                                           java.lang.String fileName,
                                           java.awt.Rectangle rectangle)
Creates an array of RiTexts, one per line from the input file, and lays it out according to the rectangle specified.


createLinesFromFile

public static RiText[] createLinesFromFile(processing.core.PApplet pApplet,
                                           processing.core.PFont pf,
                                           java.lang.String fileName,
                                           java.awt.Rectangle rectangle,
                                           float leading)
Creates an array of RiTexts, one per line from the input file, and lays it out according to the rectangle specified.


popArray

public static RiText[] popArray(RiText[] rts)
Pops the last value off the array, deletes it, and returns the new array (shortened by one element).

If there are no elements in the array, the original array is returned unchanged.

Invisible:

shiftArray

public static RiText[] shiftArray(RiText[] rts)
Shifts the first value off the array, deletes it, and returns the new array (shortened by one element).

If there are no elements in the array, the original array is returned unchanged.

Invisible:

splitLetters

public RiText[] splitLetters()
Splits the current object into an array of RiTexts, one per letter, maintaining the x and y position of each. Note: In most cases the original RiText should be deleted manually to avoid a doubling effect (via RiText.delete(originalRiText)).

Invisible:

splitLetters

public RiText[] splitLetters(processing.core.PFont pf)
Splits the current object into an array of RiTexts, one per letter, maintaining the x and y position of each. Note: In most cases the original RiText should be deleted manually to avoid a doubling effect (via RiText.delete(originalRiText)).

Invisible:

createWords

public static RiText[] createWords(processing.core.PApplet pApplet,
                                   processing.core.PFont pfont,
                                   java.lang.String lines,
                                   float startX,
                                   float startY,
                                   int maxCharsPerLine,
                                   float leading)
Creates an array of RiTexts laid out in lines, with one RiText for each word of input, with x-spacing determined by the specified 'font'.


createWords

public static RiText[] createWords(processing.core.PApplet pApplet,
                                   java.lang.String lines,
                                   float startX,
                                   float startY,
                                   int maxCharsPerLine)
Creates an array of RiTexts laid out in lines, with one RiText for each word of input, with x-spacing determined by the default 'font'.


createWords

public static RiText[] createWords(processing.core.PApplet pApplet,
                                   java.lang.String lines,
                                   float startX,
                                   float startY,
                                   int maxCharsPerLine,
                                   float leading)
Creates an array of RiTexts laid out in lines, with one RiText for each word of input, with x-spacing determined by the default 'font'.


createWords

public static RiText[] createWords(processing.core.PApplet pApplet,
                                   java.lang.String[] lines,
                                   float startX,
                                   float startY,
                                   int maxCharsPerLine,
                                   float leading)
Creates an array of RiTexts laid out in lines, with one RiText for each word of input, with x-spacing determined by the default 'font'.


createWords

public static RiText[] createWords(processing.core.PApplet pApplet,
                                   java.lang.String[] lines,
                                   float startX,
                                   float startY,
                                   int maxCharsPerLine)
Creates an array of RiTexts laid out in lines, with one RiText for each word of input, with x-spacing determined by the default 'font'.


createWords

public static RiText[] createWords(processing.core.PApplet pApplet,
                                   processing.core.PFont pfont,
                                   java.lang.String[] lines,
                                   float startX,
                                   float startY)
Creates an array of RiTexts laid out in lines, with one RiText for each word of input, with x-spacing determined by the specified 'font'.


createWords

public static RiText[] createWords(processing.core.PApplet pApplet,
                                   processing.core.PFont pfont,
                                   java.lang.String[] lines,
                                   float startX,
                                   float startY,
                                   int maxCharsPerLine)
Creates an array of RiTexts laid out in lines, with one RiText for each word of input, with x-spacing determined by the specified 'font'.


createWords

public static RiText[] createWords(processing.core.PApplet pApplet,
                                   java.lang.String[] lines,
                                   float startX,
                                   float startY)
Creates an array of RiTexts laid out in lines, with one RiText for each word of input, with x-spacing determined by the default 'font'.


createWords

public static RiText[] createWords(processing.core.PApplet pApplet,
                                   java.lang.String input,
                                   float startX,
                                   float startY)
Creates an array of RiTexts laid out in lines, with one RiText for each word of input, with x-spacing determined by the default 'font'.


createWords

public static RiText[] createWords(processing.core.PApplet pApplet,
                                   java.lang.String input,
                                   java.awt.Rectangle rectangle)

createWords

public static RiText[] createWords(processing.core.PApplet pApplet,
                                   java.lang.String input,
                                   java.awt.Rectangle rectangle,
                                   float leading)

createWords

public static RiText[] createWords(processing.core.PApplet pApplet,
                                   processing.core.PFont font,
                                   java.lang.String input,
                                   java.awt.Rectangle rectangle)

createWords

public static RiText[] createWords(processing.core.PApplet pApplet,
                                   processing.core.PFont font,
                                   java.lang.String input,
                                   java.awt.Rectangle rectangle,
                                   float leading)

createWords

public static RiText[] createWords(processing.core.PApplet pApplet,
                                   processing.core.PFont pfont,
                                   java.lang.String input,
                                   float startX,
                                   float startY)
Creates an array of RiTexts laid out in lines, with one RiText for each word of input, with x-spacing determined by the specified 'font'.


createWords

public static RiText[] createWords(processing.core.PApplet pApplet,
                                   processing.core.PFont font,
                                   java.lang.String[] words,
                                   float startX,
                                   float startY,
                                   int maxCharsPerLine,
                                   float leading)
Creates an array of RiTexts laid out in lines, one per array element, with one RiText for each of 'words', with x-spacing determined by the specified 'font'.

Parameters:
maxCharsPerLine - set to -1 to use line breaks specified in linesarray
leading - # of pixels to add between lines in addition to the textAscent (defaults to ~2x the textAscent of the current font)
Returns:
RiText[] or null if null or empty input

setAutoDraw

public void setAutoDraw(boolean b)
Enables/disables auto-drawing for this object

See Also:
disableAutoDraw()
Invisible:

disableAutoDraw

public static void disableAutoDraw()
Disables auto-drawing of subsequently created RiTexts.
Note: draw() must be explicitly called on these objects.


regexReplace

public static java.lang.String regexReplace(java.lang.String patternStr,
                                            java.lang.String fullStr,
                                            java.lang.String replaceStr)
Utility method to do regex replacement on a String

Parameters:
patternStr - regex
fullStr - String to check
replaceStr - String to insert
See Also:
Pattern
Invisible:

regexMatch

public static boolean regexMatch(java.lang.String patternStr,
                                 java.lang.String fullStr)
Utility method to test whether a String partially matches a regex pattern.

Parameters:
patternStr - regex String
fullStr - String to check
See Also:
Pattern
Invisible:

setDefaultFont

public static void setDefaultFont(java.lang.String defaultFontName)
Sets the default font for all RiTexts to be created (via PApplet.loadFont(String)).

Returns the PFont in case it is needed.

See Also:
PApplet.loadFont(String)

createDefaultFont

public static void createDefaultFont(java.lang.String fontName,
                                     float fontSize)
Deprecated. 

Sets the default font for all RiTexts to be created (via PApplet.createFont(String)).

Note: this is generally a bad idea for web applets as the user's machine must have the specified font for the sketch to function.

See Also:
createDefaultFont(PApplet, String, float)
Invisible:

createDefaultFont

public static processing.core.PFont createDefaultFont(processing.core.PApplet p,
                                                      java.lang.String fontName,
                                                      float fontSize)
Sets the default font for all RiTexts to be created (via PApplet.createFont(String)).

Note: this is not a good idea for web-applets as the user's machine must have the specified font.

Note: same PApplet#createDefaultFont(String, float) but also returns the created font.

See Also:
PApplet.createFont(String, float)

setDefaultBBoxVisibility

public static void setDefaultBBoxVisibility(boolean show)
Sets the default behavior regarding whether newly created RiTexts are to display their bounding boxes
Note: this does not affect already created RiText objects

Invisible:

setDefaultMouseDraggable

public static void setDefaultMouseDraggable(boolean draggable)
Sets the default behavior regarding whether newly created RiTexts are to be mouse-draggable
Note: this does not affect already created RiText objects

Parameters:
draggable -
Invisible:

setDefaultColor

public static void setDefaultColor(float r,
                                   float g,
                                   float b,
                                   float alpha)
Sets the default color for all RiTexts to be created. This does not affect already created RiText objects.


setDefaultColor

public static void setDefaultColor(float gray)

setDefaultColor

public static void setDefaultColor(float gray,
                                   float alpha)

setDefaultColor

public static void setDefaultColor(float r,
                                   float g,
                                   float b)

setDefaultAlignment

public static void setDefaultAlignment(int defaultAlignment)
Sets the default alignment for all RiTexts to be created. This does not affect already created RiText objects - for this, use textMode().

Parameters:
defaultAlignment -
See Also:
*

setDefaultMotionType

public static void setDefaultMotionType(int defaultMotionType)
Sets the default motion type for all (subsequently) created RiTexts. This does not affect already created RiText objects - for this, use setMotionType().

See Also:
setMotionType(int)
Invisible:

getPosition

public float[] getPosition()
Returns a 2 or 3-dimensional array with the objects x,y, or x,y,z position (depending on the renderer)

Invisible:

getScale

public float[] getScale()
Returns a 3-dimensional array with the objects x,y,z scale (1=100% or unscaled)

Invisible:

drawAll

public static void drawAll(processing.core.PGraphics p)
Draws all (visible) RiText objects

Invisible:

drawAll

public static void drawAll()
Draws all (visible) RiText objects

Invisible:

addFeature

public void addFeature(java.lang.CharSequence name,
                       java.lang.CharSequence value)
Adds a feature (a key-value pair) to the RiText.

Specified by:
addFeature in interface FeaturedIF
Invisible:

setFeatures

public void setFeatures(java.util.Map features)
Replaces all the features (key-value pairs) for the RiText with those in features

Specified by:
setFeatures in interface FeaturedIF
Invisible:

hasFeature

public boolean hasFeature(java.lang.CharSequence name)
Checks whether the named feature (key-value pair) exists for this RiText

Specified by:
hasFeature in interface FeaturedIF
Invisible:

clearFeatures

public void clearFeatures()
Clears all the features (key-value pairs) for the RiText

Specified by:
clearFeatures in interface FeaturedIF
Invisible:

getAvailableFeatures

public java.util.Set getAvailableFeatures()
Returns a Set of all the available feature keys for the RiText

Specified by:
getAvailableFeatures in interface FeaturedIF
Invisible:

getFeature

public java.lang.String getFeature(java.lang.CharSequence name)
Returns the String value for the given feature

Specified by:
getFeature in interface FeaturedIF
Invisible:

getFeatures

public java.util.Map getFeatures()
Returns a Map of all the features (key-value pairs) exists for this RiText

Specified by:
getFeatures in interface FeaturedIF
Invisible:

removeFeature

public void removeFeature(java.lang.CharSequence name)
Clears the entry for the named feature (a key-value pair)

Specified by:
removeFeature in interface FeaturedIF
Invisible:

charAt

public char charAt(int index)
Returns the character at the specified index

Specified by:
charAt in interface java.lang.CharSequence
Invisible:

subSequence

public java.lang.CharSequence subSequence(int start,
                                          int end)
Returns a new character sequence that is a subsequence of this sequence.

An invocation of this method of the form

 str.subSequence(begin, end)
 
behaves in exactly the same way as the invocation
 str.substring(begin, end)
 

Specified by:
subSequence in interface java.lang.CharSequence
Invisible:

setDefaultColor

public static void setDefaultColor(float[] color)
Sets the default color for all (subsequently) created RiTexts.


getNumInstances

public static int getNumInstances()
Returns the number of existing RiTexts

Invisible:

getZ

public float getZ()
Returns the z position for this object

Invisible:

setZ

public void setZ(float z)
Sets the z position for this object

Invisible:

appendFeature

public void appendFeature(java.lang.String name,
                          java.lang.String value)
See rita.support.feature.Featured#appendFeature(java.lang.String, java.lang.String)

Invisible:

compareTo

public int compareTo(java.lang.Object arg0)
Invisible:
See rita.RiString#compareTo(java.lang.Object)

compareTo

public int compareTo(java.lang.String anotherString)
Invisible:
See rita.RiString#compareTo(java.lang.String)

compareToIgnoreCase

public int compareToIgnoreCase(java.lang.String str)
Invisible:
See rita.RiString#compareToIgnoreCase(java.lang.String)

concat

public java.lang.String concat(java.lang.String str)
Invisible:
See rita.RiString#concat(java.lang.String)

contains

public boolean contains(java.lang.CharSequence s)
Invisible:
See rita.RiString#contains(java.lang.CharSequence)

endsWith

public boolean endsWith(java.lang.String suffix)
Invisible:
See rita.RiString#endsWith(java.lang.String)

equalsIgnoreCase

public boolean equalsIgnoreCase(java.lang.String anotherString)
Invisible:
See rita.RiString#equalsIgnoreCase(java.lang.String)

firstIndexOf

public int firstIndexOf(java.lang.String word)
Invisible:
See rita.RiString#firstIndexOf(java.lang.String)

getPosArr

public java.lang.String[] getPosArr(boolean useWordNetTags)
See rita.RiString#getPos()

Invisible:

getPosArr

public java.lang.String[] getPosArr()
See rita.RiString#getPos()

Invisible:

getPos

public java.lang.String getPos()
Returns the part-of-speech tags, one per word, separated by WORD_BOUNDARY, using the default Tokenizer & Poart-of-speech tagger. See rita.RiString#getPos(java.lang.String)


getPos

public java.lang.String getPos(boolean useWordNetTags)
See rita.RiString#getPos(java.lang.String)

Invisible:

getPosAt

public java.lang.String getPosAt(int wordIdx,
                                 boolean useWordNetTags)
See rita.RiString#getPosAt(int)

Invisible:

getPosAt

public java.lang.String getPosAt(int wordIdx)
See rita.RiString#getPosAt(int)

Invisible:

getWordCount

public int getWordCount()
See rita.RiString#getWordCount()

Invisible:

getWords

public java.lang.String[] getWords()
See rita.RiString#getWords()

Invisible:

indexOf

public int indexOf(int ch,
                   int fromIndex)
Invisible:
See rita.RiString#indexOf(int, int)

indexOf

public int indexOf(int ch)
Invisible:
See rita.RiString#indexOf(int)

indexOf

public int indexOf(java.lang.String str,
                   int fromIndex)
Invisible:
See rita.RiString#indexOf(java.lang.String, int)

indexOf

public int indexOf(java.lang.String str)
See rita.RiString#indexOf(java.lang.String)

Invisible:

insertWordAt

public boolean insertWordAt(java.lang.String newWord,
                            int wordIdx)
Invisible:
See rita.RiString#insertWordAt(java.lang.String, int)

lastIndexOf

public int lastIndexOf(int ch,
                       int fromIndex)
Invisible:
See rita.RiString#lastIndexOf(int, int)

lastIndexOf

public int lastIndexOf(int ch)
Invisible:
See rita.RiString#lastIndexOf(int)

lastIndexOf

public int lastIndexOf(java.lang.String str,
                       int fromIndex)
Invisible:
See rita.RiString#lastIndexOf(java.lang.String, int)

lastIndexOf

public int lastIndexOf(java.lang.String str)
Invisible:
See rita.RiString#lastIndexOf(java.lang.String)

matches

public boolean matches(java.lang.String regex)
See rita.RiString#matches(java.lang.String)


regionMatches

public boolean regionMatches(boolean ignoreCase,
                             int toffset,
                             java.lang.String other,
                             int ooffset,
                             int len)
Invisible:
See rita.RiString#regionMatches(boolean, int, java.lang.String, int, int)

replace

public java.lang.String replace(char oldChar,
                                char newChar)
Invisible:
See rita.RiString#replace(char, char)

replace

public java.lang.String replace(java.lang.CharSequence target,
                                java.lang.CharSequence replacement)
See rita.RiString#replace(java.lang.CharSequence, java.lang.CharSequence)


replace

public void replace(java.lang.String oldText,
                    java.lang.String newText)
See rita.RiString#replace(java.lang.String, java.lang.String)


replaceAll

public java.lang.String replaceAll(java.lang.String regex,
                                   java.lang.String replacement)
See rita.RiString#replaceAll(java.lang.String, java.lang.String)

Invisible:

replaceByPos

public java.lang.String replaceByPos(java.lang.String newWord,
                                     java.lang.String pos)
Invisible:
Randomly chooses from all words matching pos and replaces a random one with newWord. Returns the replaced word, or null if if no substitution could be made.

replaceFirst

public java.lang.String replaceFirst(java.lang.String regex,
                                     java.lang.String replacement)
Invisible:
See rita.RiString#replaceFirst(java.lang.String, java.lang.String)

replaceWordAt

public boolean replaceWordAt(java.lang.String newWord,
                             int wordIdx)
See rita.RiString#replaceWordAt(java.lang.String, int)

Invisible:

setString

public void setString(java.lang.CharSequence[] words)
Invisible:
See rita.RiString#setString(java.lang.CharSequence[])

setString

public void setString(java.lang.String newWord)
Invisible:
See rita.RiString#setString(java.lang.String)

startsWith

public boolean startsWith(java.lang.String prefix,
                          int toffset)
Invisible:
See rita.RiString#startsWith(java.lang.String, int)

startsWith

public boolean startsWith(java.lang.String prefix)
Invisible:
See rita.RiString#startsWith(java.lang.String)

substring

public java.lang.String substring(int beginIndex,
                                  int endIndex)
Invisible:
See rita.RiString#substring(int, int)

substring

public java.lang.String substring(int beginIndex)
Invisible:
See rita.RiString#substring(int)

toCharArray

public char[] toCharArray()
Invisible:
See rita.RiString#toCharArray()

toLowerCase

public java.lang.String toLowerCase()
Invisible:
See rita.RiString#toLowerCase()

toLowerCase

public java.lang.String toLowerCase(java.util.Locale locale)
Invisible:
See rita.RiString#toLowerCase(java.util.Locale)

toUpperCase

public java.lang.String toUpperCase()
Invisible:
See rita.RiString#toUpperCase()

toUpperCase

public java.lang.String toUpperCase(java.util.Locale locale)
Invisible:
See rita.RiString#toUpperCase(java.util.Locale)

trim

public java.lang.String trim()
Invisible:
See rita.RiString#trim()

rotateZ

public void rotateZ(float rotate)
Sets the z-rotation for the object

Invisible:

rotate

public void rotate(float rotate)
Rotate the object via affine transform. This is same as rotateZ, but for 2D


rotateX

public void rotateX(float rotate)
Sets the x-rotation for the object

Invisible:

rotateY

public void rotateY(float rotate)
Sets the y-rotation for the object

Invisible:

scaleX

public void scaleX(float scale)
Sets the x-scale for the object

Invisible:

scaleY

public void scaleY(float scale)
Sets the y-scale for the object

Invisible:

scaleZ

public void scaleZ(float scale)
Sets the z-scale for the object

Invisible:

scale

public void scale(float scale)
Uniformly scales the object on all dimensions (x,y,z)


scale

public void scale(float sX,
                  float sY,
                  float sZ)
Scales the object on all dimensions (x,y,z)

Invisible:

scale

public void scale(float[] scales)
Scales the object on either 2 or 3 dimensions (x,y,[z])

Invisible:

distanceTo

public float distanceTo(RiText riText)
Returns the distance between the center points of the two RiTexts.


removeCharAt

public boolean removeCharAt(int idx)
Deletes the character at at the specified character index ('idx'). If the specified 'idx' is less than xero, or beyond the length of the current text, there will be no effect. Returns true if the deletion was successful, else false

Invisible:

replaceCharAt

public boolean replaceCharAt(int idx,
                             char replaceWith)
Replaces the character at the specified character index ('idx') with the 'replaceWith' character.

If the specified 'idx' is less than zero, or beyond the length of the current text, there will be no effect. Returns true if the replacement was made

Invisible:

insertCharAt

public boolean insertCharAt(int idx,
                            char toInsert)
Inserts the character at the specified character index ('idx'). If the specified 'idx' is less than zero, or beyond the length of the current text, there will be no effect. Returns true if the insertion was made.

Invisible:

insertAt

public boolean insertAt(int idx,
                        java.lang.String toInsert)
Inserts the 'toInsert' String at the desired character index ('idx'). If the specified 'idx' is less than zero, or beyond the length of the current text, there will be no effect. Returns true if the insertion was made.

Invisible:

replaceCharAt

public boolean replaceCharAt(int idx,
                             java.lang.String replaceWith)
Replaces the character at 'idx' with 'replaceWith'. If the specified 'idx' is less than xero, or beyond the length of the current text, there will be no effect. Returns true if the replacement was made.

Invisible:

disableBehaviorWarnings

public static void disableBehaviorWarnings()
Turns off warnings about conflicting or non-terminating behaviors.

Invisible:

isShowingBoundingBox

public boolean isShowingBoundingBox()
Invisible:
Returns whether the bounding box is currently showing

copy

public static RiText copy(RiText toCopy)
Returns a field for field copy of toCopy

Invisible:

main

public static void main(java.lang.String[] args)