MCPcopy Create free account
hub / github.com/pmndrs/postprocessing / from

Method from

src/textures/RawImageData.js:98–122  ·  view source on GitHub ↗

* Creates a new image data container. * * @param {ImageData|Image} image - An image or plain image data. * @return {RawImageData} The image data.

(image)

Source from the content-addressed store, hash-verified

96 */
97
98 static from(image) {
99
100 const { width, height } = image;
101 let data;
102
103 if(image instanceof Image) {
104
105 const canvas = createCanvas(width, height, image);
106
107 if(canvas !== null) {
108
109 const context = canvas.getContext("2d");
110 data = context.getImageData(0, 0, width, height).data;
111
112 }
113
114 } else {
115
116 data = image.data;
117
118 }
119
120 return new RawImageData(width, height, data);
121
122 }
123
124}

Callers 6

lut.jsFile · 0.45
updateLUTPreviewFunction · 0.45
changeLUTFunction · 0.45
initializeMethod · 0.45
updateLUTPreviewMethod · 0.45
changeLUTMethod · 0.45

Calls 1

createCanvasFunction · 0.85

Tested by

no test coverage detected