edu.stanford.hci.r3.pen.ink
Class Ink

java.lang.Object
  extended by edu.stanford.hci.r3.pen.ink.Ink

public class Ink
extends java.lang.Object

On its surface, this is just a List<InkStroke>... However, this class will provide nice functions for clustering strokes, selecting strokes, etc.

This software is distributed under the BSD License.


Nested Class Summary
static class Ink.InkSource
           Helps us determine where we got this ink from.
 
Constructor Summary
Ink()
          New ink object w/ an empty array of strokes.
Ink(java.io.File xmlFile)
          Create an ink object from a serialized XML file.
Ink(java.util.List<InkStroke> theStrokes)
           
 
Method Summary
 void addStroke(InkStroke s)
           
 java.lang.String getAsXML()
           
 java.lang.String getAsXML(boolean useSeparatorLines)
          Represents this Ink object as an XML string.
 java.awt.Color getColor()
           
 java.lang.String getInnerXML()
           
 java.lang.String getInnerXML(boolean useSeparatorLines)
           
 double getMaxX()
           
 double getMaxY()
           
 double getMinX()
           
 double getMinY()
           
 java.lang.String getName()
           
 int getNumStrokes()
           
 InkRenderer getRenderer()
           
 PageAddress getSourcePageAddress()
           
 Ink.InkSource getSourceType()
           
 java.util.List<InkStroke> getStrokes()
           
 void loadFromXMLFile(java.io.File xmlFileSource)
          Load strokes and other information from an xml file.
 void removeStroke(InkStroke s)
           
 java.io.File renderToJPEGFile()
           
 void resetColor()
          Start over...
 void saveToXMLFile(java.io.File xmlFileDest)
          Save this object out as an XML file.
 void setColor(java.awt.Color c)
           
 void setName(java.lang.String theName)
          Use this for anything you like.
 void setSourcePageAddress(PageAddress address)
          Set the Anoto page address that we got this Ink object from.
 void setSourcePageAddress(java.lang.String pageAddrString)
           
 void setSourceType(Ink.InkSource src)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Ink

public Ink()
New ink object w/ an empty array of strokes.


Ink

public Ink(java.io.File xmlFile)
Create an ink object from a serialized XML file.

Parameters:
xmlFile -

Ink

public Ink(java.util.List<InkStroke> theStrokes)
Parameters:
theStrokes -
Method Detail

addStroke

public void addStroke(InkStroke s)
Parameters:
s - the stroke to be added to the internal list.

getAsXML

public java.lang.String getAsXML()
Returns:
return an XML representation of this Ink object.

getAsXML

public java.lang.String getAsXML(boolean useSeparatorLines)
Represents this Ink object as an XML string.

Parameters:
useSeparatorLines -
Returns:

getColor

public java.awt.Color getColor()
Returns:

getInnerXML

public java.lang.String getInnerXML()

getInnerXML

public java.lang.String getInnerXML(boolean useSeparatorLines)
Returns:
the xml without the outer tags.

getMaxX

public double getMaxX()

getMaxY

public double getMaxY()

getMinX

public double getMinX()

getMinY

public double getMinY()

getName

public java.lang.String getName()
Returns:

getNumStrokes

public int getNumStrokes()
Returns:
the number of strokes in this ink object.

getRenderer

public InkRenderer getRenderer()
Returns:
a new Renderer for this Ink object.

getSourcePageAddress

public PageAddress getSourcePageAddress()
Returns:
the page address that generated this ink.

getSourceType

public Ink.InkSource getSourceType()
Returns:

getStrokes

public java.util.List<InkStroke> getStrokes()
Returns:
the strokes that this Ink object comprises.

loadFromXMLFile

public void loadFromXMLFile(java.io.File xmlFileSource)
Load strokes and other information from an xml file. It will clear this object before the load occurs, effectively replacing this Ink object with the one represented by the XML file.

Parameters:
xmlFileSource -

removeStroke

public void removeStroke(InkStroke s)
Parameters:
s -

renderToJPEGFile

public java.io.File renderToJPEGFile()
Parameters:
w -
h -

resetColor

public void resetColor()
Start over...


saveToXMLFile

public void saveToXMLFile(java.io.File xmlFileDest)
Save this object out as an XML file.

Parameters:
xmlFileDest -

setColor

public void setColor(java.awt.Color c)
Parameters:
c -

setName

public void setName(java.lang.String theName)
Use this for anything you like. It may help in debugging, or uniquely identifying ink clusters.

Parameters:
theName -

setSourcePageAddress

public void setSourcePageAddress(PageAddress address)
Set the Anoto page address that we got this Ink object from. When we do this, it is implied that our sourceType is BATCHED.

Parameters:
address -

setSourcePageAddress

public void setSourcePageAddress(java.lang.String pageAddrString)
Parameters:
pageAddrString -

setSourceType

public void setSourceType(Ink.InkSource src)
Parameters:
src -

Copyright 2006 Stanford University