File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -203,9 +203,13 @@ const myFunc = gpu.createKernel(function(image) {
203203})
204204 .setGraphical (true )
205205 .setOutput ([100 ]);
206-
207- myFunc ([1 , 2 , 3 ]);
208- // Result: colorful image
206+
207+ const image = new document.createElement (' img' );
208+ image .src = ' my/image/source.png' ;
209+ image .onload = () => {
210+ myFunc (image);
211+ // Result: colorful image
212+ };
209213```
210214
211215An Array of HTML Images:
@@ -217,9 +221,22 @@ const myFunc = gpu.createKernel(function(image) {
217221})
218222 .setGraphical (true )
219223 .setOutput ([100 ]);
220-
221- myFunc ([1 , 2 , 3 ]);
222- // Result: colorful image
224+
225+ const image1 = new document.createElement (' img' );
226+ image1 .src = ' my/image/source1.png' ;
227+ const image2 = new document.createElement (' img' );
228+ image2 .src = ' my/image/source2.png' ;
229+ const image3 = new document.createElement (' img' );
230+ image3 .src = ' my/image/source3.png' ;
231+ const totalImages = 3 ;
232+ let loadedImages = 0 ;
233+ const onload = () => {
234+ loadedImages++ ;
235+ if (loadedImages === totalImages) {
236+ myFunc ([image1, image2, image3]);
237+ // Result: colorful image composed of many images
238+ }
239+ };
223240```
224241
225242## Graphical Output
You can’t perform that action at this time.
0 commit comments