Added sample for HTML.
authorKoichi KAMICHI <kamichi@fonts.jp>
Mon, 9 Feb 2009 04:59:21 +0000 (04:59 +0000)
committerKoichi KAMICHI <kamichi@fonts.jp>
Mon, 9 Feb 2009 04:59:21 +0000 (04:59 +0000)
engine/sample.html [new file with mode: 0644]
engine/sample.js

diff --git a/engine/sample.html b/engine/sample.html
new file mode 100644 (file)
index 0000000..f8825f9
--- /dev/null
@@ -0,0 +1,41 @@
+<html>\r
+ <head>\r
+  <script type="text/javascript" src="2d.js"></script>\r
+  <script type="text/javascript" src="buhin.js"></script>\r
+  <script type="text/javascript" src="kage.js"></script>\r
+  <script type="text/javascript" src="kagecd.js"></script>\r
+  <script type="text/javascript" src="kagedf.js"></script>\r
+  <script type="text/javascript" src="polygon.js"></script>\r
+  <script type="text/javascript" src="polygons.js"></script>\r
+  <script type="application/x-javascript">\r
+function draw() {\r
+ var canvas = document.getElementById("canvas");\r
+ var ctx = canvas.getContext("2d");\r
\r
+ var kage = new Kage();\r
+ var polygons = new Polygons();\r
\r
+ kage.kBuhin.push("u6f22", "99:0:0:9:12:73:200:u6c35-07$99:0:0:54:10:190:199:u26c29-07");\r
+ kage.kBuhin.push("u6c35-07", "2:7:8:42:12:99:23:124:35$2:7:8:20:62:75:71:97:85$2:7:8:12:123:90:151:81:188$2:2:7:63:144:109:118:188:51");\r
+ kage.kBuhin.push("u26c29-07", "1:0:0:18:29:187:29$1:0:0:73:10:73:48$1:0:0:132:10:132:48$1:12:13:44:59:44:87$1:2:2:44:59:163:59$1:22:23:163:59:163:87$1:2:2:44:87:163:87$1:0:0:32:116:176:116$1:0:0:21:137:190:137$7:32:7:102:59:102:123:102:176:10:190$2:7:0:105:137:126:169:181:182");\r
\r
+ kage.makeGlyph(polygons, "u6f22");\r
\r
+ ctx.fillStyle = "rgb(0, 0, 0)";\r
\r
+ for(var i = 0; i < polygons.array.length; i++){\r
+  ctx.beginPath();\r
+  ctx.moveTo(polygons.array[i].array[0].x, polygons.array[i].array[0].y);\r
+  for(var j = 1; j < polygons.array[i].array.length; j++){\r
+   ctx.lineTo(polygons.array[i].array[j].x, polygons.array[i].array[j].y);\r
+  }\r
+  ctx.closePath();\r
+  ctx.fill();\r
+ }\r
+}\r
+  </script>\r
+ </head>\r
+ <body onload="draw()">\r
+   <canvas style="border: 1px #ccc solid;" id="canvas" width="200" height="200"></canvas>\r
+ </body>\r
+</html>\r
index 6e23da3..319599f 100644 (file)
@@ -11,8 +11,8 @@ load("kagedf.js");
 load("polygon.js");
 load("polygons.js");
 
-kage = new Kage();
-polygons = new Polygons();
+var kage = new Kage();
+var polygons = new Polygons();
 
 kage.kBuhin.push("u6f22", "99:0:0:9:12:73:200:u6c35-07$99:0:0:54:10:190:199:u26c29-07");
 kage.kBuhin.push("u6c35-07", "2:7:8:42:12:99:23:124:35$2:7:8:20:62:75:71:97:85$2:7:8:12:123:90:151:81:188$2:2:7:63:144:109:118:188:51");