* Updates the canvas with the RGBA values in the * img.pixels array. * * `img.updatePixels()` only needs to be called after changing values in * the img.pixels array. Such changes can be * made directly after calling *
(x, y, w, h)
| 271 | * } |
| 272 | */ |
| 273 | updatePixels(x, y, w, h) { |
| 274 | // Renderer2D.prototype.updatePixels.call(this, x, y, w, h); |
| 275 | const pixelsState = this._pixelsState; |
| 276 | const pd = this._pixelDensity; |
| 277 | if ( |
| 278 | x === undefined && |
| 279 | y === undefined && |
| 280 | w === undefined && |
| 281 | h === undefined |
| 282 | ) { |
| 283 | x = 0; |
| 284 | y = 0; |
| 285 | w = this.width; |
| 286 | h = this.height; |
| 287 | } |
| 288 | x *= pd; |
| 289 | y *= pd; |
| 290 | w *= pd; |
| 291 | h *= pd; |
| 292 | |
| 293 | if (this.gifProperties) { |
| 294 | this.gifProperties.frames[this.gifProperties.displayIndex].image = |
| 295 | pixelsState.imageData; |
| 296 | } |
| 297 | |
| 298 | this.drawingContext.putImageData(pixelsState.imageData, x, y, 0, 0, w, h); |
| 299 | this.setModified(true); |
| 300 | } |
| 301 | |
| 302 | /** |
| 303 | * Gets a pixel or a region of pixels from the image. |
no test coverage detected