CanvasDrawing.js revision 828c58761d90445b8b9d20a82d85dc1479317f71
526c8bf9bb41b582dc49f54ac192705de9e2edf2mental * Creates dom element used for converting color string to rgb
526c8bf9bb41b582dc49f54ac192705de9e2edf2mental * @method _createDummy
526c8bf9bb41b582dc49f54ac192705de9e2edf2mental * Set of drawing apis for canvas based classes.
526c8bf9bb41b582dc49f54ac192705de9e2edf2mental * @class CanvasDrawing
526c8bf9bb41b582dc49f54ac192705de9e2edf2mental * @constructor
526c8bf9bb41b582dc49f54ac192705de9e2edf2mental * Regex expression used for converting hex strings to rgb
526c8bf9bb41b582dc49f54ac192705de9e2edf2mental * @property _reHex
17eb9e57e1550f744916bf486947162aa523bddamental _reHex: /^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i,
526c8bf9bb41b582dc49f54ac192705de9e2edf2mental * Parses hex color string and alpha value to rgba
526c8bf9bb41b582dc49f54ac192705de9e2edf2mental * @method _2RGBA
526c8bf9bb41b582dc49f54ac192705de9e2edf2mental * Converts color to rgb format
526c8bf9bb41b582dc49f54ac192705de9e2edf2mental * @method _2RGB
526c8bf9bb41b582dc49f54ac192705de9e2edf2mental * Sets the size of the graphics object.
setSize: function(w, h) {
_updatePosition: function(x, y)
this._updateCoords(x, y);
if(x <= this._left)
this._left = x;
else if(x >= this._right)
this._right = x;
if(y <= this._top)
this._top = y;
else if(y >= this._bottom)
this._bottom = y;
_updateCoords: function(x, y)
_clearAndUpdateCoords: function()
this._updateCoords(x, y);
_updateNodePosition: function()
_methods: null,
_properties: null,
if(!this._methods)
this._methods = [];
* Draws a line segment using the current line style from the current drawing position to the specified x and y coordinates.
i, len;
if(!this._lineToMethods)
this._lineToMethods = [];
this._drawingComplete = false;
moveTo: function(x, y) {
this._updateShapeProps(x, y);
this._updatePosition(x, y);
this._drawingComplete = false;
var hiX,
hiY,
loX,
loY;
this._drawingComplete = false;
this._updateShapeProps(x, y);
var hiX,
hiY,
loX,
loY;
this._drawingComplete = false;
this._updateShapeProps(x, y);
this._shape = {
w:circum,
h:circum
this._drawingComplete = false;
drawEllipse: function(x, y, w, h) {
this._shape = {
x += this._strokeWeight;
y += this._strokeWeight;
this._trackPos(x, y);
this._trackSize(x + w, y + h);
drawRect: function(x, y, w, h) {
this._shape = {
this._drawingComplete = false;
this.moveTo(x, y);
this.lineTo(x + w, y);
this.lineTo(x + w, y + h);
this.lineTo(x, y + h);
this.lineTo(x, y);
this._shape = {
this._drawingComplete = false;
this._trackPos(x, y);
this._trackSize(w, h);
this._paint();
var x = cfg.x,
y = cfg.y,
segs,
ax,
ay,
bx,
by,
cx,
cy,
this._drawingComplete = false;
for(; i < segs; ++i)
this._trackPos(x, y);
this._paint();
end: function() {
this._paint();
_getLinearGradient: function() {
stop,
y1 = y;
y2 = y + h;
y1 = y + h;
y2 = y;
x1 = x + w;
x2 = x;
x1 = x;
x2 = x + w;
for(; i < len; ++i)
return gradient;
_getRadialGradient: function() {
r = fill.r,
stop,
r2 = w * r;
if(d >= r2)
//If the gradient radius is greater than the circle's, adjusting the radius stretches the gradient properly.
//If the gradient radius is less than the circle's, adjusting the radius of the gradient will not work.
for(; i < len; ++i)
return gradient;
_initProps: function() {
this._methods = [];
this._lineToMethods = [];
_drawingComplete: false,
return graphic;
_trackSize: function(w, h) {
if (w > this._width) {
this._width = w;
if (h > this._height) {
this._height = h;
_trackPos: function(x, y) {
if (x > this._x) {
this._x = x;
if (y > this._y) {
this._y = y;
_updateShapeProps: function(x, y)
if(!this._shape)
this._shape = {};
if(!this._shape.x)
this._shape.x = x;
if(!this._shape.y)
this._shape.y = y;
if(!this._shape.w)
this._shape.w = w;
if(!this._shape.h)
this._shape.h = h;