Build 1.0_r1(from source)

android.graphics
Class PathMeasure

java.lang.Object
  extended by android.graphics.PathMeasure

public class PathMeasure
extends Object


Field Summary
static int POSITION_MATRIX_FLAG
           
static int TANGENT_MATRIX_FLAG
           
 
Constructor Summary
PathMeasure()
          Create an empty PathMeasure object.
PathMeasure(Path path, boolean forceClosed)
          Create a PathMeasure object associated with the specified path object (already created and specified).
 
Method Summary
protected  void finalize()
          Called by the virtual machine when there are no longer any (non-weak) references to the receiver.
 float getLength()
          Return the total length of the current contour, or 0 if no path is associated with this measure object.
 boolean getMatrix(float distance, Matrix matrix, int flags)
          Pins distance to 0 <= distance=""><= getlength(),="" and="" then="" computes="" the="" corresponding="">
 boolean getPosTan(float distance, float[] pos, float[] tan)
          Pins distance to 0 <= distance=""><= getlength(),="" and="" then="" computes="" the="" corresponding="" position="" and="">
 boolean getSegment(float startD, float stopD, Path dst, boolean startWithMoveTo)
          Given a start and stop distance, return in dst the intervening segment(s).
 boolean isClosed()
          Return true if the current contour is closed()
 boolean nextContour()
          Move to the next contour in the path.
 void setPath(Path path, boolean forceClosed)
          Assign a new path, or null to have none.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POSITION_MATRIX_FLAG

public static final int POSITION_MATRIX_FLAG
See Also:
Constant Field Values

TANGENT_MATRIX_FLAG

public static final int TANGENT_MATRIX_FLAG
See Also:
Constant Field Values
Constructor Detail

PathMeasure

public PathMeasure()
Create an empty PathMeasure object. To uses this to measure the length of a path, and/or to find the position and tangent along it, call setPath. Note that once a path is associated with the measure object, it is undefined if the path is subsequently modified and the the measure object is used. If the path is modified, you must call setPath with the path.


PathMeasure

public PathMeasure(Path path,
                   boolean forceClosed)
Create a PathMeasure object associated with the specified path object (already created and specified). The meansure object can now return the path's length, and the position and tangent of any position along the path. Note that once a path is associated with the measure object, it is undefined if the path is subsequently modified and the the measure object is used. If the path is modified, you must call setPath with the path.

Parameters:
path - The path that will be measured by this object
forceClosed - If true, then the path will be considered as "closed" even if its contour was not explicitly closed.
Method Detail

setPath

public void setPath(Path path,
                    boolean forceClosed)
Assign a new path, or null to have none.


getLength

public float getLength()
Return the total length of the current contour, or 0 if no path is associated with this measure object.


getPosTan

public boolean getPosTan(float distance,
                         float[] pos,
                         float[] tan)
Pins distance to 0 <= distance=""><= getlength(),="" and="" then="" computes="" the="" corresponding="" position="" and="" tangent.="" returns="" false="" if="" there="" is="" no="" path,="" or="" a="" zero-length="" path="" was="" specified,="" in="" which="" case="" position="" and="" tangent="" are="" unchanged.="">

Parameters:
distance - The distance along the current contour to sample
pos - If not null, eturns the sampled position (x==[0], y==[1])
tan - If not null, returns the sampled tangent (x==[0], y==[1])
Returns:
false if there was no path associated with this measure object

getMatrix

public boolean getMatrix(float distance,
                         Matrix matrix,
                         int flags)
Pins distance to 0 <= distance=""><= getlength(),="" and="" then="" computes="" the="" corresponding="" matrix.="" returns="" false="" if="" there="" is="" no="" path,="" or="" a="" zero-length="" path="" was="" specified,="" in="" which="" case="" matrix="" is="" unchanged.="">

Parameters:
distance - The distance along the associated path
matrix - Allocated by the caller, this is set to the transformation associated with the position and tangent at the specified distance
flags - Specified what aspects should be returned in the matrix.

getSegment

public boolean getSegment(float startD,
                          float stopD,
                          Path dst,
                          boolean startWithMoveTo)
Given a start and stop distance, return in dst the intervening segment(s). If the segment is zero-length, return false, else return true. startD and stopD are pinned to legal values (0..getLength()). If startD <= stopd="" then="" return="" false="" (and="" leave="" dst="" untouched).="" begin="" the="" segment="" with="" a="" moveto="" if="" startwithmoveto="" is="" true="">


isClosed

public boolean isClosed()
Return true if the current contour is closed()


nextContour

public boolean nextContour()
Move to the next contour in the path. Return true if one exists, or false if we're done with the path.


finalize

protected void finalize()
                 throws Throwable
Description copied from class: Object
Called by the virtual machine when there are no longer any (non-weak) references to the receiver. Subclasses can use this facility to guarantee that any associated resources are cleaned up before the receiver is garbage collected. Uncaught exceptions which are thrown during the running of the method cause it to terminate immediately, but are otherwise ignored.

Note: The virtual machine assumes that the implementation in class Object is empty.

Overrides:
finalize in class Object
Throws:
Throwable - The virtual machine ignores any exceptions which are thrown during finalization.

Build 1.0_r1(from source)

Please submit a feedback, bug or feature