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.

Since:
JDE 4.6.0

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 parameter 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

CLOSE

public static final short CLOSE
Numeric value is ASCII code of the letter 'Z'.
Since:
JDE 4.6.0

CURVE_TO

public static final short CURVE_TO
Numeric value is ASCII code of the letter 'C'.
Since:
JDE 4.6.0

LINE_TO

public static final short LINE_TO
Numeric value is ASCII code of the letter 'L'.
Since:
JDE 4.6.0

MOVE_TO

public static final short MOVE_TO
Numeric value is ASCII code of the letter 'M'.
Since:
JDE 4.6.0

QUAD_TO

public static final short QUAD_TO
Numeric value is ASCII code of the letter 'Q'.
Since:
JDE 4.6.0
Method Detail

close

public void close()

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

Since:
JDE 4.6.0

curveTo

public 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.
Since:
JDE 4.6.0

getNumberOfSegments

public int getNumberOfSegments()

Return number of segments in this path.

Returns:
the number of segments in this path.
Since:
JDE 4.6.0

getSegment

public 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.
Since:
JDE 4.6.0

getSegmentParam

public float getSegmentParam(int cmdIndex,
                             int paramIndex)
                      throws DOMException

Returns segment parameter by zero-based command index and zero-based parameter 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.
Since:
JDE 4.6.0

lineTo

public 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.
Since:
JDE 4.6.0

moveTo

public 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.
Since:
JDE 4.6.0

quadTo

public 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.
Since:
JDE 4.6.0



Copyright 1999-2009 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.