mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-14 12:04:29 +00:00
wasm test: update sample index.html
Update index.html according to updated wasm interface. Missed chance to update index.html during review.
This commit is contained in:
parent
0aaa04cd47
commit
1e030004ed
1 changed files with 4 additions and 3 deletions
|
@ -1,16 +1,17 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<canvas id="thorvg" width="100" height="100"></canvas>
|
||||
<canvas id="thorvg" width="320" height="320"></canvas>
|
||||
<script>
|
||||
var Module = {
|
||||
onRuntimeInitialized: function() {
|
||||
|
||||
class SvgViewer {
|
||||
constructor() {
|
||||
var instance = new Module.ThorvgWasm();
|
||||
var thorvg = new Module.ThorvgWasm();
|
||||
this.canvas = document.getElementById("thorvg");
|
||||
var context = this.canvas.getContext('2d');
|
||||
var buffer = instance.render(this.canvas.width, this.canvas.height);
|
||||
thorvg.load("", this.canvas.width, this.canvas.height);
|
||||
var buffer = thorvg.render();
|
||||
var clampedBuffer = Uint8ClampedArray.from(buffer);
|
||||
var imageData = new ImageData(clampedBuffer, this.canvas.width, this.canvas.height);
|
||||
context.putImageData(imageData, 0, 0);
|
||||
|
|
Loading…
Add table
Reference in a new issue