Inheritance Graphics
View
Module hilo/view/Graphics
Requires
hilo/core/Hilo, hilo/core/Class, hilo/view/View, hilo/view/CacheMixin
Source
Graphics.js
Graphics class contains a group of functions for creating vector graphics.
Property | Defined | |
---|---|---|
fillAlpha:Number
The transparency of color or style inside shapes, default value is 0, readonly!
|
Graphics | |
fillStyle:String
The color or style to use inside shapes, default value is 0 (the black color), readonly!
|
Graphics | |
lineAlpha:Number
The alpha value (transparency) of line, default value is 1, readonly!
|
Graphics | |
lineCap:String
The style of how every end point of line are drawn, value options: butt, round, square.
|
Graphics | |
lineJoin:String
The joint style of two lines.
|
Graphics | |
lineWidth:Number
The thickness of lines in space units, default value is 1, readonly!
|
Graphics | |
miterLimit:Number
The miter limit ratio in space units, works only when lineJoin value is miter.
|
Graphics | |
strokeStyle:String
The color or style to use for lines around shapes, default value is 0 (the black color), readonly!
|
Graphics |
Method | Defined | |
---|---|---|
Graphics(properties:Object)
Constructor
|
Graphics | |
beginBitmapFill(image:HTMLImageElement, repetition:String):Graphics
Begin an image filling pattern.
|
Graphics | |
beginFill(fill:String, alpha:Number):Graphics
Set how to fill shapes and the transparency.
|
Graphics | |
beginLinearGradientFill(x0:Number, y0:Number, x1:Number, y1:Number, colors:Array, ratios:Array):Graphics
Set linear gradient filling style to draw shapes.
|
Graphics | |
beginPath():Graphics
Begin a new path.
|
Graphics | |
beginRadialGradientFill(x0:Number, y0:Number, r0:Number, x1:Number, y1:Number, r1:Number, colors:Array, ratios:Array):Graphics
Set radial gradient filling style to draw shapes.
|
Graphics | |
bezierCurveTo(cp1x:Number, cp1y:Number, cp2x:Number, cp2y:Number, x:Number, y:Number):Graphics
Draw a Bézier curve from current point to the point on coordinate (x, y).
|
Graphics | |
cache(forceUpdate:Boolean)
Cache the view.
|
Graphics | |
clear():Graphics
Clear all draw actions and reset to the initial state.
|
Graphics | |
closePath():Graphics
Close current path.
|
Graphics | |
drawCircle(x:Number, y:Number, radius:Number):Graphics
Draw a circle.
|
Graphics | |
drawEllipse(x:Number, y:Number, width:Number, height:Number):Graphics
Draw an ellipse.
|
Graphics | |
drawRect(x:Number, y:Number, width:Number, height:Number):Graphics
Draw a rectangle.
|
Graphics | |
drawRoundRect(x:Number, y:Number, width:Number, height:Number, cornerSize:Number):Graphics
Draw a rounded rectangle.
|
Graphics | |
drawRoundRectComplex(x:Number, y:Number, width:Number, height:Number, cornerTL:Number, cornerTR:Number, cornerBR:Number, cornerBL:Number):Graphics
Draw a complex rounded rectangle.
|
Graphics | |
drawSVGPath(pathData:String):Graphics
Draw a path from the SVG data given by parameters.
|
Graphics | |
endFill():Graphics
Apply and end lines-drawing and shapes-filling.
|
Graphics | |
lineStyle(thickness:Number, lineColor:String, lineAlpha:Number, lineCap:String, lineJoin:String, miterLimit:Number):Graphics
Set the lines style for drawing shapes.
|
Graphics | |
lineTo(x:Number, y:Number):Graphics
Draw a line from current point to the point on the coordinate value (x, y).
|
Graphics | |
moveTo(x:Number, y:Number):Graphics
Move current drawing point to a new point on coordinate values (x, y).
|
Graphics | |
quadraticCurveTo(cpx:Number, cpy:Number, x:Number, y:Number):Graphics
Draw a quadratic Bézier curve from current point to the point on coordinate (x, y).
|
Graphics | |
setCacheDirty(dirty:Boolean)
set the cache state diry.
|
Graphics | |
setLineDash(segments:Number[])
设置虚线样式
|
Graphics | |
Update the cache.
|
Graphics |
var path = 'M250 150 L150 350 L350 350 Z';
var shape = new Hilo.Graphics({width:500, height:500});
shape.drawSVGPath(path).beginFill('#0ff').endFill();