Docs updated
example updated misplaced files removed
This commit is contained in:
parent
72e38cccb0
commit
e91be9b53a
100 changed files with 6387 additions and 12207 deletions
|
@ -49,6 +49,8 @@
|
|||
|
||||
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasGraphics.html">CanvasGraphics</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/CustomRenderable.html">CustomRenderable</a></li>
|
||||
|
@ -57,6 +59,8 @@
|
|||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/Graphics.html">Graphics</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionData.html">InteractionData</a></li>
|
||||
|
@ -144,18 +148,22 @@
|
|||
|
||||
|
||||
/**
|
||||
* A DisplayObjectContainer represents a collection of display objects. It is the base class of all display objects that act as a container for other objects.
|
||||
* @class DisplayObjectContainer
|
||||
* @extends DisplayObject
|
||||
* @constructor
|
||||
* A set of functions used by the canvas renderer to draw the primitive graphics data
|
||||
* @class CanvasGraphics
|
||||
*/
|
||||
PIXI.CanvasGraphics = function()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// constructor
|
||||
|
||||
/*
|
||||
* @private
|
||||
* @static
|
||||
* @method renderGraphics
|
||||
* @param graphics {Graphics}
|
||||
* @param context {Context2D}
|
||||
*/
|
||||
PIXI.CanvasGraphics.renderGraphics = function(graphics, context)
|
||||
{
|
||||
|
||||
|
@ -167,11 +175,11 @@ PIXI.CanvasGraphics.renderGraphics = function(graphics, context)
|
|||
context.strokeStyle = color = '#' + ('00000' + ( data.lineColor | 0).toString(16)).substr(-6);
|
||||
|
||||
context.lineWidth = data.lineWidth;
|
||||
context.globalAlpha = data.lineAlpha;
|
||||
|
||||
if(data.type == PIXI.Graphics.POLY)
|
||||
{
|
||||
if(data.lineWidth <= 0)continue;
|
||||
|
||||
//if(data.lineWidth <= 0)continue;
|
||||
|
||||
context.beginPath();
|
||||
|
||||
|
@ -188,20 +196,31 @@ PIXI.CanvasGraphics.renderGraphics = function(graphics, context)
|
|||
context.closePath();
|
||||
}
|
||||
|
||||
context.stroke();
|
||||
if(data.fill)
|
||||
{
|
||||
context.globalAlpha = data.fillAlpha;
|
||||
context.fillStyle = color = '#' + ('00000' + ( data.fillColor | 0).toString(16)).substr(-6);
|
||||
context.fill();
|
||||
}
|
||||
if(data.lineWidth)
|
||||
{
|
||||
context.globalAlpha = data.lineAlpha;
|
||||
context.stroke();
|
||||
}
|
||||
}
|
||||
else if(data.type == PIXI.Graphics.RECT)
|
||||
{
|
||||
// TODO - need to be Undefined!
|
||||
if(data.fillColor)
|
||||
{
|
||||
context.globalAlpha = data.fillAlpha;
|
||||
context.fillStyle = color = '#' + ('00000' + ( data.fillColor | 0).toString(16)).substr(-6);
|
||||
|
||||
context.fillRect(points[0], points[1], points[2], points[3]);
|
||||
|
||||
}
|
||||
if(data.lineWidth)
|
||||
{
|
||||
context.globalAlpha = data.lineAlpha;
|
||||
context.strokeRect(points[0], points[1], points[2], points[3]);
|
||||
}
|
||||
}
|
||||
|
@ -214,11 +233,56 @@ PIXI.CanvasGraphics.renderGraphics = function(graphics, context)
|
|||
|
||||
if(data.fill)
|
||||
{
|
||||
context.globalAlpha = data.fillAlpha;
|
||||
context.fillStyle = color = '#' + ('00000' + ( data.fillColor | 0).toString(16)).substr(-6);
|
||||
context.fill();
|
||||
}
|
||||
if(data.lineWidth)
|
||||
{
|
||||
context.globalAlpha = data.lineAlpha;
|
||||
context.stroke();
|
||||
}
|
||||
}
|
||||
else if(data.type == PIXI.Graphics.ELIP)
|
||||
{
|
||||
|
||||
// elipse code taken from: http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas
|
||||
|
||||
var elipseData = data.points;
|
||||
|
||||
var w = elipseData[2] * 2;
|
||||
var h = elipseData[3] * 2;
|
||||
|
||||
var x = elipseData[0] - w/2;
|
||||
var y = elipseData[1] - h/2;
|
||||
|
||||
context.beginPath();
|
||||
|
||||
var kappa = .5522848,
|
||||
ox = (w / 2) * kappa, // control point offset horizontal
|
||||
oy = (h / 2) * kappa, // control point offset vertical
|
||||
xe = x + w, // x-end
|
||||
ye = y + h, // y-end
|
||||
xm = x + w / 2, // x-middle
|
||||
ym = y + h / 2; // y-middle
|
||||
|
||||
context.moveTo(x, ym);
|
||||
context.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y);
|
||||
context.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym);
|
||||
context.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye);
|
||||
context.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym);
|
||||
|
||||
context.closePath();
|
||||
|
||||
if(data.fill)
|
||||
{
|
||||
context.globalAlpha = data.fillAlpha;
|
||||
context.fillStyle = color = '#' + ('00000' + ( data.fillColor | 0).toString(16)).substr(-6);
|
||||
context.fill();
|
||||
}
|
||||
if(data.lineWidth)
|
||||
{
|
||||
context.globalAlpha = data.lineAlpha;
|
||||
context.stroke();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue