prepare tvg v0.8 release
[platform/core/graphics/tizenvg.git] / test / wasm / wasm_test.html
1 <!doctype html>
2 <html>
3   <canvas id="thorvg" width="320" height="320"></canvas>
4   <script>
5     var Module = {
6       onRuntimeInitialized: function() {
7
8         class SvgViewer {
9           constructor() {
10              var thorvg = new Module.ThorvgWasm();
11              this.canvas = document.getElementById("thorvg");
12              var context = this.canvas.getContext('2d');
13              thorvg.load("", this.canvas.width, this.canvas.height);
14              var buffer = thorvg.render();
15              var clampedBuffer = Uint8ClampedArray.from(buffer);
16              var imageData = new ImageData(clampedBuffer, this.canvas.width, this.canvas.height);
17              context.putImageData(imageData, 0, 0);
18           }
19         }
20
21         var instance = new SvgViewer();
22       }
23     };
24   </script>
25   <script src="thorvg-wasm.js"></script>
26 </html>