SVGDrawing Class
yui3/src/graphics/js/SVGDrawing.js:19
<a href="http://www.w3.org/TR/SVG/">SVG</a> implementation of the <a href="Drawing.html">Drawing
</a> class.
SVGDrawing
is not intended to be used directly. Instead, use the <a href="Drawing.html">Drawing
</a> class.
If the browser has <a href="http://www.w3.org/TR/SVG/">SVG</a> capabilities, the <a href="Drawing.html">Drawing
</a>
class will point to the SVGDrawing
class.
Index
Methods
- _closePath
- _curveTo
- _getCurrentArray
- _lineTo
- _moveTo
- _quadraticCurveTo
- _round
- _setCurveBoundingBox
- _trackSize
- clear
- closePath
- curveTo
- drawCircle
- drawDiamond
- drawEllipse
- drawRect
- drawRoundRect
- drawWedge
- end
- getBezierData
- lineTo
- moveTo
- quadraticCurveTo
- quadraticCurveTo
- relativeCurveTo
- relativeLineTo
- relativeMoveTo
Properties
Methods
_closePath
()
private
Draws the path.
_curveTo
-
args
-
relative
Implements curveTo methods.
Parameters:
-
args
ArrayThe arguments to be used.
-
relative
BooleanIndicates whether or not to use relative coordinates.
_getCurrentArray
()
private
Returns the current array of drawing commands.
Returns:
Array
_lineTo
-
args
-
relative
Implements lineTo methods.
Parameters:
-
args
ArrayThe arguments to be used.
-
relative
BooleanIndicates whether or not to use relative coordinates.
_moveTo
-
args
-
relative
Implements moveTo methods.
Parameters:
-
args
ArrayThe arguments to be used.
-
relative
BooleanIndicates whether or not to use relative coordinates.
_quadraticCurveTo
-
args
-
relative
Implements quadraticCurveTo methods.
Parameters:
-
args
ArrayThe arguments to be used.
-
relative
BooleanIndicates whether or not to use relative coordinates.
_round
-
val
Rounds a value to the nearest hundredth.
Parameters:
-
val
NumberValue to be rounded.
Returns:
Number
_setCurveBoundingBox
-
Array
-
Number
-
Number
Calculates the bounding box for a curve
Parameters:
-
Array
Objectpts Array containing points for start, end and control points of a curve.
-
Number
Objectw Width used to calculate the number of points to describe the curve.
-
Number
Objecth Height used to calculate the number of points to describe the curve.
_trackSize
-
w
-
h
Updates the size of the graphics object
clear
()
chainable
Clears the path.
closePath
()
chainable
Ends a fill and stroke
curveTo
-
cp1x
-
cp1y
-
cp2x
-
cp2y
-
x
-
y
Draws a bezier curve.
Parameters:
drawCircle
-
x
-
y
-
r
Draws a circle.
drawDiamond
-
x
-
y
-
width
-
height
Draws a diamond.
drawEllipse
-
x
-
y
-
w
-
h
Draws an ellipse.
drawRect
-
x
-
y
-
w
-
h
Draws a rectangle.
drawRoundRect
-
x
-
y
-
w
-
h
-
ew
-
eh
Draws a rectangle with rounded corners.
drawWedge
-
x
-
y
-
startAngle
-
arc
-
radius
-
yRadius
Draws a wedge.
Parameters:
-
x
Numberx-coordinate of the wedge's center point
-
y
Numbery-coordinate of the wedge's center point
-
startAngle
Numberstarting angle in degrees
-
arc
Numbersweep of the wedge. Negative values draw clockwise.
-
radius
Numberradius of wedge. If [optional] yRadius is defined, then radius is the x radius.
-
yRadius
Number[optional] y radius for wedge.
end
()
chainable
Completes a drawing operation.
getBezierData
-
Array
-
Number
Returns the points on a curve
Parameters:
-
Array
Objectpoints Array containing the begin, end and control points of a curve.
-
Number
Objectt The value for incrementing the next set of points.
Returns:
Array
lineTo
-
point1
-
point2
Draws a line segment using the current line style from the current drawing position to the specified x and y coordinates.
moveTo
-
x
-
y
Moves the current drawing position to specified x and y coordinates.
quadraticCurveTo
-
cpx
-
cpy
-
x
-
y
Draws a quadratic bezier curve.
quadraticCurveTo
-
cpx
-
cpy
-
x
-
y
Draws a quadratic bezier curve relative to the current position.
relativeCurveTo
-
cp1x
-
cp1y
-
cp2x
-
cp2y
-
x
-
y
Draws a bezier curve relative to the current coordinates.
Parameters:
relativeLineTo
-
point1
-
point2
Draws a line segment using the current line style from the current drawing position to the relative x and y coordinates.