mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-06-08 03:04:17 -04:00
Return Raster#size as a LinkedSize.
This commit is contained in:
parent
9311b38894
commit
0c9914285f
1 changed files with 4 additions and 3 deletions
|
@ -112,10 +112,11 @@ var Raster = Item.extend(/** @lends Raster# */{
|
||||||
* @bean
|
* @bean
|
||||||
*/
|
*/
|
||||||
getSize: function() {
|
getSize: function() {
|
||||||
return this._size;
|
var size = this._size;
|
||||||
|
return new LinkedSize(size.width, size.height, this, 'setSize');
|
||||||
},
|
},
|
||||||
|
|
||||||
setSize: function() {
|
setSize: function(/* size */) {
|
||||||
var size = Size.read(arguments);
|
var size = Size.read(arguments);
|
||||||
if (!this._size.equals(size)) {
|
if (!this._size.equals(size)) {
|
||||||
// Get reference to image before changing canvas
|
// Get reference to image before changing canvas
|
||||||
|
@ -517,7 +518,7 @@ var Raster = Item.extend(/** @lends Raster# */{
|
||||||
getImageData: function(rect) {
|
getImageData: function(rect) {
|
||||||
rect = Rectangle.read(arguments);
|
rect = Rectangle.read(arguments);
|
||||||
if (rect.isEmpty())
|
if (rect.isEmpty())
|
||||||
rect = new Rectangle(this.getSize());
|
rect = new Rectangle(this._size);
|
||||||
return this.getContext().getImageData(rect.x, rect.y,
|
return this.getContext().getImageData(rect.x, rect.y,
|
||||||
rect.width, rect.height);
|
rect.width, rect.height);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue