Mercurial > MadButterfly
annotate nodejs/paints.cc @ 699:0b98bdc53215
Add binding for color changing of paint_color_t in JS
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Wed, 11 Aug 2010 17:38:44 +0800 |
parents | da12923a789a |
children | 163f0d9e6382 |
rev | line source |
---|---|
567
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
1 #include <v8.h> |
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
2 |
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
3 extern "C" { |
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
4 #include "mb.h" |
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
5 } |
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
6 |
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
7 #include "mbfly_njs.h" |
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
8 |
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
9 using namespace v8; |
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
10 |
568
d796e6b8b97e
Real initialize a paint_color_t object for paint_color JS obj
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
11 #ifndef ASSERT |
d796e6b8b97e
Real initialize a paint_color_t object for paint_color JS obj
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
12 #define ASSERT(x) |
d796e6b8b97e
Real initialize a paint_color_t object for paint_color JS obj
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
13 #endif |
567
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
14 |
684
b346e4699e55
Add more comment for JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
637
diff
changeset
|
15 /*! \defgroup xnjsmb_paints JS binding for paints |
b346e4699e55
Add more comment for JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
637
diff
changeset
|
16 * \ingroup xnjsmb |
b346e4699e55
Add more comment for JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
637
diff
changeset
|
17 * |
b346e4699e55
Add more comment for JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
637
diff
changeset
|
18 * @{ |
b346e4699e55
Add more comment for JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
637
diff
changeset
|
19 */ |
567
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
20 |
687
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
21 static void |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
22 xnjsmb_paint_fill(paint_t *paint, Handle<Object> self, shape_t *sh) { |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
23 Handle<Value> rt_v; |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
24 Handle<Object> rt_o; |
569
f87a368e847a
Functions of stroke and fill a shape
Thinker K.F. Li <thinker@branda.to>
parents:
568
diff
changeset
|
25 redraw_man_t *rdman; |
f87a368e847a
Functions of stroke and fill a shape
Thinker K.F. Li <thinker@branda.to>
parents:
568
diff
changeset
|
26 |
687
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
27 rt_v = GET(self, "mbrt"); |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
28 rt_o = rt_v->ToObject(); |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
29 rdman = xnjsmb_rt_rdman(rt_o); |
569
f87a368e847a
Functions of stroke and fill a shape
Thinker K.F. Li <thinker@branda.to>
parents:
568
diff
changeset
|
30 |
f87a368e847a
Functions of stroke and fill a shape
Thinker K.F. Li <thinker@branda.to>
parents:
568
diff
changeset
|
31 rdman_paint_fill(rdman, paint, sh); |
570
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
32 |
576
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
33 if(sh_get_coord(sh)) |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
34 rdman_shape_changed(rdman, sh); |
569
f87a368e847a
Functions of stroke and fill a shape
Thinker K.F. Li <thinker@branda.to>
parents:
568
diff
changeset
|
35 } |
f87a368e847a
Functions of stroke and fill a shape
Thinker K.F. Li <thinker@branda.to>
parents:
568
diff
changeset
|
36 |
687
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
37 static void |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
38 xnjsmb_paint_stroke(paint_t *paint, Handle<Object> self, shape_t *sh) { |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
39 Handle<Value> rt_v; |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
40 Handle<Object> rt_o; |
569
f87a368e847a
Functions of stroke and fill a shape
Thinker K.F. Li <thinker@branda.to>
parents:
568
diff
changeset
|
41 redraw_man_t *rdman; |
f87a368e847a
Functions of stroke and fill a shape
Thinker K.F. Li <thinker@branda.to>
parents:
568
diff
changeset
|
42 |
687
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
43 rt_v = GET(self, "mbrt"); |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
44 rt_o = rt_v->ToObject(); |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
45 rdman = xnjsmb_rt_rdman(rt_o); |
569
f87a368e847a
Functions of stroke and fill a shape
Thinker K.F. Li <thinker@branda.to>
parents:
568
diff
changeset
|
46 |
f87a368e847a
Functions of stroke and fill a shape
Thinker K.F. Li <thinker@branda.to>
parents:
568
diff
changeset
|
47 rdman_paint_stroke(rdman, paint, sh); |
570
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
48 |
576
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
49 if(sh_get_coord(sh)) |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
50 rdman_shape_changed(rdman, sh); |
569
f87a368e847a
Functions of stroke and fill a shape
Thinker K.F. Li <thinker@branda.to>
parents:
568
diff
changeset
|
51 } |
f87a368e847a
Functions of stroke and fill a shape
Thinker K.F. Li <thinker@branda.to>
parents:
568
diff
changeset
|
52 |
699
0b98bdc53215
Add binding for color changing of paint_color_t in JS
Thinker K.F. Li <thinker@branda.to>
parents:
687
diff
changeset
|
53 static void |
0b98bdc53215
Add binding for color changing of paint_color_t in JS
Thinker K.F. Li <thinker@branda.to>
parents:
687
diff
changeset
|
54 xnjsmb_paint_color_set_color(paint_t *paint, Handle<Object> self, |
0b98bdc53215
Add binding for color changing of paint_color_t in JS
Thinker K.F. Li <thinker@branda.to>
parents:
687
diff
changeset
|
55 float r, float g, float b, float a) { |
0b98bdc53215
Add binding for color changing of paint_color_t in JS
Thinker K.F. Li <thinker@branda.to>
parents:
687
diff
changeset
|
56 Handle<Value> rt_v; |
0b98bdc53215
Add binding for color changing of paint_color_t in JS
Thinker K.F. Li <thinker@branda.to>
parents:
687
diff
changeset
|
57 Handle<Object> rt_o; |
0b98bdc53215
Add binding for color changing of paint_color_t in JS
Thinker K.F. Li <thinker@branda.to>
parents:
687
diff
changeset
|
58 redraw_man_t *rdman; |
0b98bdc53215
Add binding for color changing of paint_color_t in JS
Thinker K.F. Li <thinker@branda.to>
parents:
687
diff
changeset
|
59 |
0b98bdc53215
Add binding for color changing of paint_color_t in JS
Thinker K.F. Li <thinker@branda.to>
parents:
687
diff
changeset
|
60 rt_v = GET(self, "mbrt"); |
0b98bdc53215
Add binding for color changing of paint_color_t in JS
Thinker K.F. Li <thinker@branda.to>
parents:
687
diff
changeset
|
61 rt_o = rt_v->ToObject(); |
0b98bdc53215
Add binding for color changing of paint_color_t in JS
Thinker K.F. Li <thinker@branda.to>
parents:
687
diff
changeset
|
62 rdman = xnjsmb_rt_rdman(rt_o); |
0b98bdc53215
Add binding for color changing of paint_color_t in JS
Thinker K.F. Li <thinker@branda.to>
parents:
687
diff
changeset
|
63 |
0b98bdc53215
Add binding for color changing of paint_color_t in JS
Thinker K.F. Li <thinker@branda.to>
parents:
687
diff
changeset
|
64 paint_color_set(paint, r, g, b, a); |
0b98bdc53215
Add binding for color changing of paint_color_t in JS
Thinker K.F. Li <thinker@branda.to>
parents:
687
diff
changeset
|
65 |
0b98bdc53215
Add binding for color changing of paint_color_t in JS
Thinker K.F. Li <thinker@branda.to>
parents:
687
diff
changeset
|
66 rdman_paint_changed(rdman, paint); |
0b98bdc53215
Add binding for color changing of paint_color_t in JS
Thinker K.F. Li <thinker@branda.to>
parents:
687
diff
changeset
|
67 } |
0b98bdc53215
Add binding for color changing of paint_color_t in JS
Thinker K.F. Li <thinker@branda.to>
parents:
687
diff
changeset
|
68 |
687
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
69 #include "paints-inc.h" |
568
d796e6b8b97e
Real initialize a paint_color_t object for paint_color JS obj
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
70 |
687
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
71 /*! \defgroup xnjsmb_paints_cons Constructor of paints |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
72 * |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
73 * @{ |
567
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
74 */ |
687
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
75 paint_t * |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
76 xnjsmb_paint_color_new(njs_runtime_t *rt, |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
77 float r, float g, float b, float a, |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
78 const char **err) { |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
79 paint_t *paint; |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
80 redraw_man_t *rdman; |
567
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
81 |
687
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
82 rdman = X_njs_MB_rdman(rt); |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
83 paint = rdman_paint_color_new(rdman, r, g, b, a); |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
84 if(paint == NULL) { |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
85 *err = "can not allocate a paint_color_t"; |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
86 return NULL; |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
87 } |
567
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
88 |
687
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
89 return paint; |
567
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
90 } |
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
91 |
687
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
92 paint_t * |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
93 xnjsmb_paint_image_new(njs_runtime_t *rt, mb_img_data_t *img, |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
94 const char **err) { |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
95 paint_t *paint; |
636
cc39cf3f623c
paint_image_t for nodejs.
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
96 redraw_man_t *rdman; |
cc39cf3f623c
paint_image_t for nodejs.
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
97 |
687
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
98 rdman = X_njs_MB_rdman(rt); |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
99 paint = rdman_paint_image_new(rdman, img); |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
100 if(paint == NULL) { |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
101 *err = "can not allocate a paint_image_t"; |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
102 return NULL; |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
103 } |
636
cc39cf3f623c
paint_image_t for nodejs.
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
104 |
687
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
105 return paint; |
636
cc39cf3f623c
paint_image_t for nodejs.
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
106 } |
cc39cf3f623c
paint_image_t for nodejs.
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
107 |
687
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
108 /* @} */ |
636
cc39cf3f623c
paint_image_t for nodejs.
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
109 |
687
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
110 /*! \defgroup xnjsmb_paints_export Exported wrapper maker for paints |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
111 * |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
112 * These functions are used by MB runtime to wrap C paints to JS |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
113 * objects. |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
114 * |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
115 * @{ |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
116 */ |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
117 Handle<Value> |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
118 export_xnjsmb_auto_paint_color_new(paint_t *paint) { |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
119 Handle<Value> ret; |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
120 |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
121 ret = xnjsmb_auto_paint_color_new(paint); |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
122 |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
123 return ret; |
636
cc39cf3f623c
paint_image_t for nodejs.
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
124 } |
cc39cf3f623c
paint_image_t for nodejs.
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
125 |
687
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
126 Handle<Value> |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
127 export_xnjsmb_auto_paint_image_new(paint_t *paint) { |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
128 Handle<Value> ret; |
569
f87a368e847a
Functions of stroke and fill a shape
Thinker K.F. Li <thinker@branda.to>
parents:
568
diff
changeset
|
129 |
687
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
130 ret = xnjsmb_auto_paint_image_new(paint); |
636
cc39cf3f623c
paint_image_t for nodejs.
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
131 |
687
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
132 return ret; |
567
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
133 } |
687
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
134 /* @} */ |
567
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
135 |
637
714cd6470bd9
Doc on xnjsmb_paints_init_mb_rt_temp()
Thinker K.F. Li <thinker@branda.to>
parents:
636
diff
changeset
|
136 /*! \brief Initialize paints for mbfly. |
714cd6470bd9
Doc on xnjsmb_paints_init_mb_rt_temp()
Thinker K.F. Li <thinker@branda.to>
parents:
636
diff
changeset
|
137 * |
714cd6470bd9
Doc on xnjsmb_paints_init_mb_rt_temp()
Thinker K.F. Li <thinker@branda.to>
parents:
636
diff
changeset
|
138 * This function is called by init() in mbfly_njs.cc when the module |
714cd6470bd9
Doc on xnjsmb_paints_init_mb_rt_temp()
Thinker K.F. Li <thinker@branda.to>
parents:
636
diff
changeset
|
139 * being loaded. |
714cd6470bd9
Doc on xnjsmb_paints_init_mb_rt_temp()
Thinker K.F. Li <thinker@branda.to>
parents:
636
diff
changeset
|
140 */ |
567
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
141 void xnjsmb_paints_init_mb_rt_temp(Handle<FunctionTemplate> rt_temp) { |
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
142 static int init_flag = 0; |
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
143 Handle<ObjectTemplate> rt_proto_temp; |
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
144 |
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
145 if(!init_flag) { |
687
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
146 xnjsmb_auto_paint_init(); |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
147 xnjsmb_auto_paint_color_init(); |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
148 xnjsmb_auto_paint_image_init(); |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
684
diff
changeset
|
149 |
567
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
150 init_flag = 1; |
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
151 } |
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
152 } |
684
b346e4699e55
Add more comment for JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
637
diff
changeset
|
153 |
b346e4699e55
Add more comment for JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
637
diff
changeset
|
154 /* @} */ |