org.w3c.dom.svg
Interface SVGPath


public interface SVGPath

This interface represents an "SVGPath" datatype used to define the path geometry. Corresponds to SVG path specification or the "d" attribute.

The native implementations must support the following simplifications or canonicalization of path segments. Any simplifications should be lossless.


Field Summary
static short CLOSE
          Numeric value is ASCII code of the letter 'Z'.
static short CURVE_TO
          Numeric value is ASCII code of the letter 'C'.
static short LINE_TO
          Numeric value is ASCII code of the letter 'L'.
static short MOVE_TO
          Numeric value is ASCII code of the letter 'M'.
static short QUAD_TO
          Numeric value is ASCII code of the letter 'Q'.
 
Method Summary
 void close()
          Appends 'Z' (close path) segment to the path
 void curveTo(float x1, float y1, float x2, float y2, float x3, float y3)
          Appends 'C' (absolute cubic curve) segment to the path.
 int getNumberOfSegments()
          Return number of segments in this path.
 short getSegment(int cmdIndex)
          Returns segment command by zero-based command index.
 float getSegmentParam(int cmdIndex, int paramIndex)
          Returns segment parameter by zero-based command index and zero-based parametr index.
 void lineTo(float x, float y)
          Appends 'L' (absolute line) segment to the path with the specified coordinates.
 void moveTo(float x, float y)
          Appends 'M' (absolute move) segment to the path with the specified coordinates.
 void quadTo(float x1, float y1, float x2, float y2)
          Appends 'Q' (absolute quadratic curve) segment to the path.
 

Field Detail

MOVE_TO

static final short MOVE_TO
Numeric value is ASCII code of the letter 'M'.

See Also:
Constant Field Values

LINE_TO

static final short LINE_TO
Numeric value is ASCII code of the letter 'L'.

See Also:
Constant Field Values

CURVE_TO

static final short CURVE_TO
Numeric value is ASCII code of the letter 'C'.

See Also:
Constant Field Values

QUAD_TO

static final short QUAD_TO
Numeric value is ASCII code of the letter 'Q'.

See Also:
Constant Field Values

CLOSE

static final short CLOSE
Numeric value is ASCII code of the letter 'Z'.

See Also:
Constant Field Values
Method Detail

getNumberOfSegments

int getNumberOfSegments()
Return number of segments in this path.

Returns:
the number of segments in this path.

getSegment

short getSegment(int cmdIndex)
                 throws DOMException
Returns segment command by zero-based command index. Returns one of MOVE_TO, LINE_TO, CURVE_TO, QUAD_TO or CLOSE.

Parameters:
cmdIndex - the command index for the segment command to retrieve.
Returns:
the segment command for the specified cmdIndex.
Throws:
DOMException - with error code INDEX_SIZE_ERR if segment index out of bounds.

getSegmentParam

float getSegmentParam(int cmdIndex,
                      int paramIndex)
                      throws DOMException
Returns segment parameter by zero-based command index and zero-based parametr index.

Parameters:
cmdIndex - the command index for the segment parameter to retrieve.
paramIndex - the parameter index for the segment parameter to retrieve.
Returns:
the segment parameter for the specified cmdIndex and paramIndex.
Throws:
DOMException - with error code INDEX_SIZE_ERR if segment index out of bounds or param index out of bounds for this segment's type.

moveTo

void moveTo(float x,
            float y)
Appends 'M' (absolute move) segment to the path with the specified coordinates.

Parameters:
x - the x-axis coordinate for the specified point.
y - the y-axis coordinate for the specified point.

lineTo

void lineTo(float x,
            float y)
Appends 'L' (absolute line) segment to the path with the specified coordinates.

Parameters:
x - the x-axis coordinate of the specified point.
y - the y-axis coordinate of the specified point.

quadTo

void quadTo(float x1,
            float y1,
            float x2,
            float y2)
Appends 'Q' (absolute quadratic curve) segment to the path.

Parameters:
x1 - the x-axis coordinate of the first control point.
y1 - the y-axis coordinate of the first control point.
x2 - the x-axis coordinate of the final end point.
y2 - the y-axis coordinate of the final end point.

curveTo

void curveTo(float x1,
             float y1,
             float x2,
             float y2,
             float x3,
             float y3)
Appends 'C' (absolute cubic curve) segment to the path.

Parameters:
x1 - the x-axis coordinate of the first control point.
y1 - the y-axis coordinate of the first control point.
x2 - the x-axis coordinate of the second end point.
y2 - the y-axis coordinate of the second end point.
x3 - the x-axis coordinate of the final end point.
y3 - the y-axis coordinate of the final end point.

close

void close()
Appends 'Z' (close path) segment to the path



Copyright © 2003-2006 Nokia Corporation. See the Copyright Notice for details.