* @function Pixel.prototype.add * @description 在原来像素坐标基础上,x 值加上传入的 x 参数,y 值加上传入的 y 参数。 * @example * var pixcel = new Pixel(100,50); * //pixcel2是新的对象 * var pixcel2 = pixcel.add(20,30); * * @param {number} x - 传入的 x 值。 * @param {number} y - 传入的 y 值。 * @returns {Pixel} 新的 pix
(x, y)
| 115 | * @returns {Pixel} 新的 pixel 对象,该 pixel 是由当前的 pixel 与传入的 x,y 相加得到。 |
| 116 | */ |
| 117 | add(x, y) { |
| 118 | if (x == null || y == null) { |
| 119 | throw new TypeError('Pixel.add cannot receive null values'); |
| 120 | } |
| 121 | return new Pixel(this.x + x, this.y + y); |
| 122 | } |
| 123 | |
| 124 | /** |
| 125 | * @function Pixel.prototype.offset |
no outgoing calls
no test coverage detected