English | Site Directory

Android - An Open Handset Alliance Project

android.graphics
public class

android.graphics.PathMeasure

java.lang.Object
android.graphics.PathMeasure

Summary

Constants

      Value  
int  POSITION_MATRIX_FLAG    0x00000001 
int  TANGENT_MATRIX_FLAG    0x00000002 

Public Constructors

          PathMeasure()
          PathMeasure(Path path, boolean forceClosed)

Public Methods

        float  getLength()
Return the total length of the current contour, or 0 if no path is associated.
        boolean  getMatrix(float distance, Matrix matrix, int flags)
Pins distance to 0 <= distance <= getLength(), and then computes the corresponding matrix.
        boolean  getPosTan(float distance, float[] pos, float[] tan)
Pins distance to 0 <= distance <= getLength(), and then computes the corresponding position and tangent.
        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.

Protected Methods

        void  finalize()
Called by the virtual machine when there are no longer any (non-weak) references to the receiver.
Methods inherited from class java.lang.Object

Details

Constants

public static final int POSITION_MATRIX_FLAG

Constant Value: 1 (0x00000001)

public static final int TANGENT_MATRIX_FLAG

Constant Value: 2 (0x00000002)

Public Constructors

public PathMeasure()

public PathMeasure(Path path, boolean forceClosed)

Public Methods

public float getLength()

Return the total length of the current contour, or 0 if no path is associated.

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.

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

  • true if there is no path to sample

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

public boolean isClosed()

Return true if the current contour is closed()

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.

public void setPath(Path path, boolean forceClosed)

Assign a new path, or null to have none.

Protected Methods

protected void finalize()

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.

Throws

Throwable
Build m5-rc15g - 14 May 2008 12:50