annotate nodejs/canvas.js @ 762:6133319d3fb4

Add udpate command
author wycc
date Sat, 28 Aug 2010 23:11:02 +0800
parents 9f4a1134ec82
children 1b522a22e16a
rev   line source
736
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
1 var mbfly = require("mbfly");
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
2 var sys=require("sys");
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
3
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
4
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
5 function canvas(app,root) {
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
6 this.mb_rt = app.mb_rt;
751
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
7 this.parent = root;
736
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
8 this.root = this.mb_rt.coord_new(root);
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
9 this.bg_r = 0;
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
10 this.bg_g = 0;
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
11 this.bg_b = 0;
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
12 this.bg_a = 0;
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
13 this.stroke_r = 0;
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
14 this.stroke_g = 0;
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
15 this.stroke_b = 0;
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
16 this.stroke_a = 0;
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
17 this.stroke_w = 1;
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
18 }
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
19
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
20 canvas.prototype.background=function(r,g,b,a) {
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
21 this.bg_r = r;
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
22 this.bg_g = g;
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
23 this.bg_b = b;
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
24 this.bg_a = a;
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
25 }
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
26
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
27 canvas.prototype.rect=function(x,y,w,h) {
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
28 var rect = this.mb_rt.rect_new(x,y,w,h,0,0);
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
29 var paint = this.mb_rt.paint_color_new(this.bg_r,this.bg_g,this.bg_b,this.bg_a);
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
30 paint.fill(rect);
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
31 this.root.add_shape(rect);
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
32 }
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
33
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
34 canvas.prototype.stroke=function(r,g,b,a) {
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
35 this.stroke_r = r;
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
36 this.stroke_g = g;
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
37 this.stroke_b = b;
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
38 this.stroke_a = a;
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
39 }
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
40
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
41
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
42 canvas.prototype.line=function(x1,y1,x2,y2) {
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
43 var s = "M "+x1+","+y1+" L "+x2+","+y2;
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
44 sys.puts(s);
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
45
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
46 var p = this.mb_rt.path_new(s);
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
47 this.root.add_shape(p);
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
48 var paint = this.mb_rt.paint_color_new(this.stroke_r,this.stroke_g,this.stroke_b,this.stroke_a);
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
49 paint.stroke(p);
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
50 p.stroke_width = this.stroke_w;
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
51 }
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
52
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
53 canvas.prototype.strokeWeight=function(w) {
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
54 this.stroke_w = w;
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
55 }
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
56
751
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
57 canvas.prototype.alpha=function(c) {
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
58 }
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
59
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
60 canvas.prototype.red=function(c) {
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
61 }
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
62 canvas.prototype.green=function(c) {
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
63 }
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
64 canvas.prototype.blue=function(c) {
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
65 }
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
66
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
67
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
68 canvas.prototype.clear=function() {
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
69 this.root.remove();
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
70 this.root = this.mb_rt.coord_new(this.parent);
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
71 }
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
72
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
73 canvas.prototype.arc=function(x,y,w,h,start,end) {
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
74 }
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
75
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
76 canvas.prototype.ellipse=function(x, y, width, height) {
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
77 }
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
78
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
79 canvas.prototype.point=function(x,y) {
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
80 }
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
81
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
82 canvas.prototype.quad=function(x1,y1,x2,y2,x3,y3,x4,y4) {
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
83 }
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
84
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
85 canvas.prototype.triangle=function(x1,y1,x2,y2,x3,y3) {
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
86 }
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
87
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
88 canvas.prototype.bezier=function(x1, y1, cx1, cy1, cx2, cy2, x2, y2) {
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
89 }
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
90
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
91 canvas.prototype.curveTightness=function(squishy) {
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
92 }
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
93
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
94 canvas.prototype.colorMode=function() {
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
95 }
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
96
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
97 canvas.prototype.fill=function(color) {
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
98 }
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
99
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
100 canvas.prototype.noFill=function() {
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
101 }
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
102
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
103 canvas.prototype.noStroke=function() {
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
104 }
9f4a1134ec82 Use the coord.remove() to implement the processing canvas
wycc
parents: 736
diff changeset
105
736
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
106
cdd578c1f866 Add Canvas class for the dynamic content generation. The testcanvas.js is used to demostrate the capability of it.
wycc
parents:
diff changeset
107 exports.canvas = canvas;