diff --git a/src/pixi/core/Circle.js b/src/pixi/core/Circle.js index ebf9d05..47d2e73 100644 --- a/src/pixi/core/Circle.js +++ b/src/pixi/core/Circle.js @@ -69,6 +69,17 @@ return (dx + dy <= r2); }; +/** +* Returns the framing rectangle of the circle as a PIXI.Rectangle object +* +* @method getBounds +* @return {Rectangle} the framing rectangle +*/ +PIXI.Circle.prototype.getBounds = function() +{ + return new PIXI.Rectangle(this.x - this.radius, this.y - this.radius, this.width, this.height); +}; + // constructor PIXI.Circle.prototype.constructor = PIXI.Circle; diff --git a/src/pixi/core/Circle.js b/src/pixi/core/Circle.js index ebf9d05..47d2e73 100644 --- a/src/pixi/core/Circle.js +++ b/src/pixi/core/Circle.js @@ -69,6 +69,17 @@ return (dx + dy <= r2); }; +/** +* Returns the framing rectangle of the circle as a PIXI.Rectangle object +* +* @method getBounds +* @return {Rectangle} the framing rectangle +*/ +PIXI.Circle.prototype.getBounds = function() +{ + return new PIXI.Rectangle(this.x - this.radius, this.y - this.radius, this.width, this.height); +}; + // constructor PIXI.Circle.prototype.constructor = PIXI.Circle; diff --git a/src/pixi/core/Ellipse.js b/src/pixi/core/Ellipse.js index 9dc69ee..b376333 100644 --- a/src/pixi/core/Ellipse.js +++ b/src/pixi/core/Ellipse.js @@ -7,10 +7,10 @@ * * @class Ellipse * @constructor - * @param x {Number} The X coordinate of the upper-left corner of the framing rectangle of this ellipse - * @param y {Number} The Y coordinate of the upper-left corner of the framing rectangle of this ellipse - * @param width {Number} The overall width of this ellipse - * @param height {Number} The overall height of this ellipse + * @param x {Number} The X coordinate of the center of the ellipse + * @param y {Number} The Y coordinate of the center of the ellipse + * @param width {Number} The half width of this ellipse + * @param height {Number} The half height of this ellipse */ PIXI.Ellipse = function(x, y, width, height) { @@ -85,7 +85,7 @@ */ PIXI.Ellipse.prototype.getBounds = function() { - return new PIXI.Rectangle(this.x, this.y, this.width, this.height); + return new PIXI.Rectangle(this.x - this.width, this.y - this.height, this.width, this.height); }; // constructor diff --git a/src/pixi/core/Circle.js b/src/pixi/core/Circle.js index ebf9d05..47d2e73 100644 --- a/src/pixi/core/Circle.js +++ b/src/pixi/core/Circle.js @@ -69,6 +69,17 @@ return (dx + dy <= r2); }; +/** +* Returns the framing rectangle of the circle as a PIXI.Rectangle object +* +* @method getBounds +* @return {Rectangle} the framing rectangle +*/ +PIXI.Circle.prototype.getBounds = function() +{ + return new PIXI.Rectangle(this.x - this.radius, this.y - this.radius, this.width, this.height); +}; + // constructor PIXI.Circle.prototype.constructor = PIXI.Circle; diff --git a/src/pixi/core/Ellipse.js b/src/pixi/core/Ellipse.js index 9dc69ee..b376333 100644 --- a/src/pixi/core/Ellipse.js +++ b/src/pixi/core/Ellipse.js @@ -7,10 +7,10 @@ * * @class Ellipse * @constructor - * @param x {Number} The X coordinate of the upper-left corner of the framing rectangle of this ellipse - * @param y {Number} The Y coordinate of the upper-left corner of the framing rectangle of this ellipse - * @param width {Number} The overall width of this ellipse - * @param height {Number} The overall height of this ellipse + * @param x {Number} The X coordinate of the center of the ellipse + * @param y {Number} The Y coordinate of the center of the ellipse + * @param width {Number} The half width of this ellipse + * @param height {Number} The half height of this ellipse */ PIXI.Ellipse = function(x, y, width, height) { @@ -85,7 +85,7 @@ */ PIXI.Ellipse.prototype.getBounds = function() { - return new PIXI.Rectangle(this.x, this.y, this.width, this.height); + return new PIXI.Rectangle(this.x - this.width, this.y - this.height, this.width, this.height); }; // constructor diff --git a/src/pixi/primitives/Graphics.js b/src/pixi/primitives/Graphics.js index f232ae4..2a085cb 100644 --- a/src/pixi/primitives/Graphics.js +++ b/src/pixi/primitives/Graphics.js @@ -527,7 +527,7 @@ * @param y {Number} The Y coordinate of the center of the circle * @param radius {Number} The radius of the circle */ -PIXI.Graphics.prototype.drawCircle = function( x, y, radius) +PIXI.Graphics.prototype.drawCircle = function(x, y, radius) { if (!this.currentPath.points.length) this.graphicsData.pop(); @@ -546,12 +546,12 @@ * Draws an ellipse. * * @method drawEllipse - * @param x {Number} The X coordinate of the upper-left corner of the framing rectangle of this ellipse - * @param y {Number} The Y coordinate of the upper-left corner of the framing rectangle of this ellipse - * @param width {Number} The width of the ellipse - * @param height {Number} The height of the ellipse + * @param x {Number} The X coordinate of the center of the ellipse + * @param y {Number} The Y coordinate of the center of the ellipse + * @param width {Number} The half width of the ellipse + * @param height {Number} The half height of the ellipse */ -PIXI.Graphics.prototype.drawEllipse = function( x, y, width, height) +PIXI.Graphics.prototype.drawEllipse = function(x, y, width, height) { if (!this.currentPath.points.length) this.graphicsData.pop(); diff --git a/src/pixi/core/Circle.js b/src/pixi/core/Circle.js index ebf9d05..47d2e73 100644 --- a/src/pixi/core/Circle.js +++ b/src/pixi/core/Circle.js @@ -69,6 +69,17 @@ return (dx + dy <= r2); }; +/** +* Returns the framing rectangle of the circle as a PIXI.Rectangle object +* +* @method getBounds +* @return {Rectangle} the framing rectangle +*/ +PIXI.Circle.prototype.getBounds = function() +{ + return new PIXI.Rectangle(this.x - this.radius, this.y - this.radius, this.width, this.height); +}; + // constructor PIXI.Circle.prototype.constructor = PIXI.Circle; diff --git a/src/pixi/core/Ellipse.js b/src/pixi/core/Ellipse.js index 9dc69ee..b376333 100644 --- a/src/pixi/core/Ellipse.js +++ b/src/pixi/core/Ellipse.js @@ -7,10 +7,10 @@ * * @class Ellipse * @constructor - * @param x {Number} The X coordinate of the upper-left corner of the framing rectangle of this ellipse - * @param y {Number} The Y coordinate of the upper-left corner of the framing rectangle of this ellipse - * @param width {Number} The overall width of this ellipse - * @param height {Number} The overall height of this ellipse + * @param x {Number} The X coordinate of the center of the ellipse + * @param y {Number} The Y coordinate of the center of the ellipse + * @param width {Number} The half width of this ellipse + * @param height {Number} The half height of this ellipse */ PIXI.Ellipse = function(x, y, width, height) { @@ -85,7 +85,7 @@ */ PIXI.Ellipse.prototype.getBounds = function() { - return new PIXI.Rectangle(this.x, this.y, this.width, this.height); + return new PIXI.Rectangle(this.x - this.width, this.y - this.height, this.width, this.height); }; // constructor diff --git a/src/pixi/primitives/Graphics.js b/src/pixi/primitives/Graphics.js index f232ae4..2a085cb 100644 --- a/src/pixi/primitives/Graphics.js +++ b/src/pixi/primitives/Graphics.js @@ -527,7 +527,7 @@ * @param y {Number} The Y coordinate of the center of the circle * @param radius {Number} The radius of the circle */ -PIXI.Graphics.prototype.drawCircle = function( x, y, radius) +PIXI.Graphics.prototype.drawCircle = function(x, y, radius) { if (!this.currentPath.points.length) this.graphicsData.pop(); @@ -546,12 +546,12 @@ * Draws an ellipse. * * @method drawEllipse - * @param x {Number} The X coordinate of the upper-left corner of the framing rectangle of this ellipse - * @param y {Number} The Y coordinate of the upper-left corner of the framing rectangle of this ellipse - * @param width {Number} The width of the ellipse - * @param height {Number} The height of the ellipse + * @param x {Number} The X coordinate of the center of the ellipse + * @param y {Number} The Y coordinate of the center of the ellipse + * @param width {Number} The half width of the ellipse + * @param height {Number} The half height of the ellipse */ -PIXI.Graphics.prototype.drawEllipse = function( x, y, width, height) +PIXI.Graphics.prototype.drawEllipse = function(x, y, width, height) { if (!this.currentPath.points.length) this.graphicsData.pop(); diff --git a/src/pixi/renderers/canvas/CanvasRenderer.js b/src/pixi/renderers/canvas/CanvasRenderer.js index f4c0ea7..f966118 100644 --- a/src/pixi/renderers/canvas/CanvasRenderer.js +++ b/src/pixi/renderers/canvas/CanvasRenderer.js @@ -36,16 +36,6 @@ this.clearBeforeRender = true; /** - * If true Pixi will Math.floor() x/y values when rendering, stopping pixel interpolation. - * Handy for crisp pixel art and speed on legacy devices. - * - * @property roundPixels - * @type Boolean - * @default - */ - this.roundPixels = false; - - /** * Whether the render view is transparent * * @property transparent @@ -157,7 +147,14 @@ context: this.context, maskManager: this.maskManager, scaleMode: null, - smoothProperty: null + smoothProperty: null, + + /** + * If true Pixi will Math.floor() x/y values when rendering, stopping pixel interpolation. + * Handy for crisp pixel art and speed on legacy devices. + * + */ + roundPixels: false }; if("imageSmoothingEnabled" in this.context)