Skip to content

Commit

Permalink
Merge pull request #307 from gpujs/306-image-documentation
Browse files Browse the repository at this point in the history
Correct documentation
  • Loading branch information
robertleeplummerjr authored Jun 8, 2018
2 parents cfd3c77 + 20b0ffe commit d5a1734
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,13 @@ const myFunc = gpu.createKernel(function(image) {
})
.setGraphical(true)
.setOutput([100]);

myFunc([1, 2, 3]);
// Result: colorful image

const image = new document.createElement('img');
image.src = 'my/image/source.png';
image.onload = () => {
myFunc(image);
// Result: colorful image
};
```

An Array of HTML Images:
Expand All @@ -217,9 +221,25 @@ const myFunc = gpu.createKernel(function(image) {
})
.setGraphical(true)
.setOutput([100]);

myFunc([1, 2, 3]);
// Result: colorful image

const image1 = new document.createElement('img');
image1.src = 'my/image/source1.png';
image1.onload = onload;
const image2 = new document.createElement('img');
image2.src = 'my/image/source2.png';
image2.onload = onload;
const image3 = new document.createElement('img');
image3.src = 'my/image/source3.png';
image3.onload = onload;
const totalImages = 3;
let loadedImages = 0;
function onload() {
loadedImages++;
if (loadedImages === totalImages) {
myFunc([image1, image2, image3]);
// Result: colorful image composed of many images
}
};
```

## Graphical Output
Expand Down

0 comments on commit d5a1734

Please sign in to comment.