MCPcopy Index your code
hub / github.com/processing/p5.js / updatePixels

Method updatePixels

src/image/p5.Image.js:273–300  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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.

Callers 15

readFramebufferRegionMethod · 0.95
readFramebufferRegionMethod · 0.95
drawBlobMethod · 0.45
drawFunction · 0.45
setupFunction · 0.45
p5.MediaElement.jsFile · 0.45
p5.Image.jsFile · 0.45
filters.jsFile · 0.45
pixels.jsFile · 0.45
rendering.jsFile · 0.45
p5.Framebuffer.jsFile · 0.45
getColorsFunction · 0.45

Calls 1

setModifiedMethod · 0.95

Tested by

no test coverage detected