mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-08 05:42:07 -05:00
Document some more Raster functions.
This commit is contained in:
parent
04e34128ae
commit
872fbe1574
1 changed files with 23 additions and 3 deletions
|
@ -177,7 +177,9 @@ var Raster = this.Raster = Item.extend({
|
||||||
|
|
||||||
// DOCS: document Raster#getSubImage
|
// DOCS: document Raster#getSubImage
|
||||||
/**
|
/**
|
||||||
* @param {Rectangle} rect
|
* @param {Rectangle} rect the boundaries of the sub image in pixel
|
||||||
|
* coordinates
|
||||||
|
*
|
||||||
* @return {Canvas}
|
* @return {Canvas}
|
||||||
*/
|
*/
|
||||||
getSubImage: function(rect) {
|
getSubImage: function(rect) {
|
||||||
|
@ -188,10 +190,12 @@ var Raster = this.Raster = Item.extend({
|
||||||
return canvas;
|
return canvas;
|
||||||
},
|
},
|
||||||
|
|
||||||
// DOCS: document Raster#drawImage
|
|
||||||
/**
|
/**
|
||||||
|
* Draws an image on the raster.
|
||||||
|
*
|
||||||
* @param {HTMLImageELement|Canvas} image
|
* @param {HTMLImageELement|Canvas} image
|
||||||
* @param {Point} point
|
* @param {Point} point the offset of the image as a point in pixel
|
||||||
|
* coordinates
|
||||||
*/
|
*/
|
||||||
drawImage: function(image, point) {
|
drawImage: function(image, point) {
|
||||||
point = Point.read(arguments, 1);
|
point = Point.read(arguments, 1);
|
||||||
|
@ -321,11 +325,21 @@ var Raster = this.Raster = Item.extend({
|
||||||
return total ? Color.read(channels) : null;
|
return total ? Color.read(channels) : null;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// DOCS: document Raster#createData
|
||||||
|
/**
|
||||||
|
* @param {Size} size
|
||||||
|
* @return {ImageData}
|
||||||
|
*/
|
||||||
createData: function(size) {
|
createData: function(size) {
|
||||||
size = Size.read(arguments);
|
size = Size.read(arguments);
|
||||||
return this.getContext().createImageData(size.width, size.height);
|
return this.getContext().createImageData(size.width, size.height);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// DOCS: document Raster#getData
|
||||||
|
/**
|
||||||
|
* @param {Rectangle} rect
|
||||||
|
* @return {ImageData}
|
||||||
|
*/
|
||||||
getData: function(rect) {
|
getData: function(rect) {
|
||||||
rect = Rectangle.read(arguments);
|
rect = Rectangle.read(arguments);
|
||||||
if (rect.isEmpty())
|
if (rect.isEmpty())
|
||||||
|
@ -334,6 +348,12 @@ var Raster = this.Raster = Item.extend({
|
||||||
rect.width, rect.height);
|
rect.width, rect.height);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// DOCS: document Raster#setData
|
||||||
|
/**
|
||||||
|
* @param {ImageData} data
|
||||||
|
* @param {Point} point
|
||||||
|
* @return {ImageData}
|
||||||
|
*/
|
||||||
setData: function(data, point) {
|
setData: function(data, point) {
|
||||||
point = Point.read(arguments, 1);
|
point = Point.read(arguments, 1);
|
||||||
this.getContext().putImageData(data, point.x, point.y);
|
this.getContext().putImageData(data, point.x, point.y);
|
||||||
|
|
Loading…
Reference in a new issue