Yahoo! UI Library

charts  3.3.0

Yahoo! UI Library > charts > CanvasDrawingUtil
Search:
 
Filters

Class CanvasDrawingUtil

Set of drawing apis for canvas based classes.

Constructor

CanvasDrawingUtil ( )

Properties

_drawingComplete - private object


_reHex - private object

Regex expression used for converting hex strings to rgb

Methods

_2RGB

private void _2RGB ( )
Converts color to rgb format

_2RGBA

private void _2RGBA ( )
Parses hex color string and alpha value to rgba

_createDummy

private void _createDummy ( )
Creates dom element used for converting color string to rgb

_createGraphic

private void _createGraphic ( )
Creates canvas element

_draw

private void _draw ( )
Completes a shape or drawing

_getFill

private void _getFill ( )
Returns ths actual fill object to be used in a drawing or shape

_getLinearGradient

private void _getLinearGradient ( )
Returns a linear gradient fill

_getRadialGradient

private void _getRadialGradient ( )
Returns a radial gradient fill

_initProps

private void _initProps ( )
Clears all values

_trackPos

private void _trackPos ( x , y )
Updates the position of the current drawing
Parameters:
x <Number> x-coordinate
y <Number> y-coordinate

_trackSize

private void _trackSize ( w , h )
Updates the size of the graphics object
Parameters:
w <Number> width
h <Number> height

_updateShapeProps

private void _updateShapeProps ( x , y )
Updates the position and size of the current drawing
Parameters:
x <Number> x-coordinate
y <Number> y-coordinate

beginBitmapFill

void beginBitmapFill ( config )
Specifies a bitmap fill used by subsequent calls to other drawing methods.
Parameters:
config <Object>

beginFill

void beginFill ( color , alpha )
Specifes a solid fill used by subsequent calls to other drawing methods.
Parameters:
color <String> Hex color value for the fill.
alpha <Number> Value between 0 and 1 used to specify the opacity of the fill.

beginGradientFill

void beginGradientFill ( config )
Specifies a gradient fill used by subsequent calls to other drawing methods.
Parameters:
config <Object>

clear

void clear ( )
Clears the graphics object.

curveTo

void curveTo ( cp1x , cp1y , cp2x , cp2y , x , y )
Draws a bezier curve.
Parameters:
cp1x <Number> x-coordinate for the first control point.
cp1y <Number> y-coordinate for the first control point.
cp2x <Number> x-coordinate for the second control point.
cp2y <Number> y-coordinate for the second control point.
x <Number> x-coordinate for the end point.
y <Number> y-coordinate for the end point.

drawCircle

void drawCircle ( x , y , r )
Draws a circle.
Parameters:
x <Number> y-coordinate
y <Number> x-coordinate
r <Number> radius

drawEllipse

void drawEllipse ( x , y , w , h )
Draws an ellipse.
Parameters:
x <Number> x-coordinate
y <Number> y-coordinate
w <Number> width
h <Number> height

drawRect

void drawRect ( x , y , w , h )
Draws a rectangle.
Parameters:
x <Number> x-coordinate
y <Number> y-coordinate
w <Number> width
h <Number> height

drawWedge

private void drawWedge ( x , y , startAngle , arc , radius , yRadius )
Draws a wedge.
Parameters:
x <object> x component of the wedge's center point
y <object> y component of the wedge's center point
startAngle <object> starting angle in degrees
arc <object> sweep of the wedge. Negative values draw clockwise.
radius <object> radius of wedge. If [optional] yRadius is defined, then radius is the x radius.
yRadius <object> [optional] y radius for wedge.

end

void end ( )
Completes a drawing operation.

getShape

getShape ( config )
Creates a Shape instance and adds it to the graphics object.
Parameters:
config <Object> Object literal of properties used to construct a Shape.
Returns:
Shape

initializer

private void initializer ( )
Initializes the class.

lineGradientStyle

private void lineGradientStyle ( )
Not implemented Specifies a gradient to use for the stroke when drawing lines.

lineStyle

void lineStyle ( thickness , color , alpha )
Specifies a line style used for subsequent calls to drawing methods.
Parameters:
thickness <Number> indicates the thickness of the line
color <String> hex color value for the line
alpha <Number> Value between 0 and 1 used to specify the opacity of the fill.

lineTo

void lineTo ( point1 , point2 )
Draws a line segment using the current line style from the current drawing position to the specified x and y coordinates.
Parameters:
point1 <Number> x-coordinate for the end point.
point2 <Number> y-coordinate for the end point.

moveTo

void moveTo ( x , y )
Moves the current drawing position to specified x and y coordinates.
Parameters:
x <Number> x-coordinate for the end point.
y <Number> y-coordinate for the end point.

quadraticCurveTo

void quadraticCurveTo ( cpx , cpy , x , y )
Draws a quadratic bezier curve.
Parameters:
cpx <Number> x-coordinate for the control point.
cpy <Number> y-coordinate for the control point.
x <Number> x-coordinate for the end point.
y <Number> y-coordinate for the end point.

setSize

void setSize ( w , h )
Sets the size of the graphics object.
Parameters:
w <Number> width to set for the instance.
h <Number> height to set for the instance.


Copyright © 2011 Yahoo! Inc. All rights reserved.