From 2bd4c548490cda5f66656e731e1bf2e932982f87 Mon Sep 17 00:00:00 2001 From: Olivier Biot Date: Wed, 28 Dec 2022 08:59:36 +0800 Subject: [PATCH] doc: add a note about calling `getImageData()` and setting the `willReadFrequently` attribute --- src/video/texture/canvas_texture.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/video/texture/canvas_texture.js b/src/video/texture/canvas_texture.js index c83fbe4cea..9aed8e46a2 100644 --- a/src/video/texture/canvas_texture.js +++ b/src/video/texture/canvas_texture.js @@ -99,7 +99,8 @@ class CanvasTexture { } /** - * Returns an ImageData object representing the underlying pixel data for a specified portion of this canvas texture + * Returns an ImageData object representing the underlying pixel data for a specified portion of this canvas texture. + * (Note: when using getImageData(), it is highly recommended to use the `willReadFrequently` attribute when creatimg the corresponding canvas texture) * @param {number} x - The x-axis coordinate of the top-left corner of the rectangle from which the ImageData will be extracted * @param {number} y - The y-axis coordinate of the top-left corner of the rectangle from which the ImageData will be extracted * @param {number} width - The width of the rectangle from which the ImageData will be extracted. Positive values are to the right, and negative to the left