annotate nodejs/shapes.cc @ 687:da12923a789a

Migrate paints.cc to use gen_v8_binding.m4
author Thinker K.F. Li <thinker@branda.to>
date Sat, 07 Aug 2010 21:37:57 +0800
parents b346e4699e55
children cadebc13be2f
rev   line source
564
0cd1511272d2 Make base type for shapes.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
1 #include <v8.h>
0cd1511272d2 Make base type for shapes.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
2 #include "mbfly_njs.h"
0cd1511272d2 Make base type for shapes.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
3
683
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
4 #include <string.h>
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
5
564
0cd1511272d2 Make base type for shapes.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
6 extern "C" {
0cd1511272d2 Make base type for shapes.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
7 #include <mb.h>
0cd1511272d2 Make base type for shapes.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
8 }
0cd1511272d2 Make base type for shapes.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
9
570
49e79253b6d3 Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents: 569
diff changeset
10 #ifndef ASSERT
49e79253b6d3 Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents: 569
diff changeset
11 #define ASSERT(x)
49e79253b6d3 Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents: 569
diff changeset
12 #endif
49e79253b6d3 Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents: 569
diff changeset
13
564
0cd1511272d2 Make base type for shapes.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
14 using namespace v8;
0cd1511272d2 Make base type for shapes.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
15
684
b346e4699e55 Add more comment for JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 683
diff changeset
16 /*! \defgroup xnjsmb_shapes JS binding for shapes.
683
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
17 * \ingroup xnjsmb
564
0cd1511272d2 Make base type for shapes.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
18 *
0cd1511272d2 Make base type for shapes.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
19 * @{
0cd1511272d2 Make base type for shapes.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
20 */
683
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
21 static void
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
22 xnjsmb_sh_stext_set_style(shape_t *sh, Handle<Value> blks, const char **err) {
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
23 Array *blksobj;
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
24 Array *blkobj;
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
25 mb_style_blk_t *mb_blks;
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
26 int nblks;
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
27 int r;
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
28 int i;
564
0cd1511272d2 Make base type for shapes.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
29
683
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
30 blksobj = Array::Cast(*blks);
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
31 nblks = blksobj->Length();
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
32 mb_blks = new mb_style_blk_t[nblks];
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
33 for(i = 0; i < nblks; i++) {
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
34 blkobj = Array::Cast(*blksobj->Get(i));
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
35 mb_blks[i].n_chars = blkobj->Get(0)->ToInt32()->Value();
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
36 mb_blks[i].face = (mb_font_face_t *)UNWRAP(blkobj->Get(1)->ToObject());
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
37 mb_blks[i].font_sz = blkobj->Get(2)->ToNumber()->Value();
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
38 }
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
39
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
40 r = sh_stext_set_style(sh, mb_blks, nblks);
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
41 if(r != 0) {
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
42 *err = "Unknown error";
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
43 return;
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
44 }
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
45
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
46 delete mb_blks;
564
0cd1511272d2 Make base type for shapes.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
47 }
0cd1511272d2 Make base type for shapes.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
48
0cd1511272d2 Make base type for shapes.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
49 static Handle<Value>
683
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
50 xnjsmb_shape_stroke_width_get(Handle<Object> self, shape_t *sh,
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
51 const char **err) {
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
52 float stroke_width;
564
0cd1511272d2 Make base type for shapes.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
53
683
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
54 stroke_width = sh_get_stroke_width(sh);
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
55 return Number::New(stroke_width);
564
0cd1511272d2 Make base type for shapes.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
56 }
0cd1511272d2 Make base type for shapes.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
57
683
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
58 static void
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
59 xnjsmb_shape_stroke_width_set(Handle<Object> self, shape_t *sh,
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
60 Handle<Value> value, const char **err) {
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
61 float stroke_width;
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
62 Handle<Object> rt;
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
63 redraw_man_t *rdman;
570
49e79253b6d3 Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents: 569
diff changeset
64
683
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
65 stroke_width = value->Int32Value();
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
66 sh_set_stroke_width(sh, stroke_width);
570
49e79253b6d3 Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents: 569
diff changeset
67
49e79253b6d3 Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents: 569
diff changeset
68 /*
49e79253b6d3 Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents: 569
diff changeset
69 * Mark changed.
49e79253b6d3 Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents: 569
diff changeset
70 */
49e79253b6d3 Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents: 569
diff changeset
71 rt = GET(self, "mbrt")->ToObject();
49e79253b6d3 Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents: 569
diff changeset
72 ASSERT(rt != NULL);
49e79253b6d3 Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents: 569
diff changeset
73 rdman = xnjsmb_rt_rdman(rt);
49e79253b6d3 Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents: 569
diff changeset
74
576
5a68e2bcea17 Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents: 574
diff changeset
75 if(sh_get_coord(sh))
5a68e2bcea17 Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents: 574
diff changeset
76 rdman_shape_changed(rdman, sh);
570
49e79253b6d3 Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents: 569
diff changeset
77 }
49e79253b6d3 Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents: 569
diff changeset
78
564
0cd1511272d2 Make base type for shapes.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
79 /* @} */
0cd1511272d2 Make base type for shapes.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
80
683
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
81 #include "shapes-inc.h"
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
82
687
da12923a789a Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 684
diff changeset
83 /*! \defgroup xnjsmb_shapes_wraps Exported wrapper makers for shapes
683
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
84 * \ingroup xnjsmb_shapes
687
da12923a789a Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 684
diff changeset
85 *
da12923a789a Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 684
diff changeset
86 * These functions are used by methods of mb_rt to wrap shape objects
da12923a789a Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 684
diff changeset
87 * as Javascript objects.
565
c0bc60448913 Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents: 564
diff changeset
88 *
c0bc60448913 Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents: 564
diff changeset
89 * @{
c0bc60448913 Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents: 564
diff changeset
90 */
683
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
91 Handle<Value>
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
92 export_xnjsmb_auto_path_new(shape_t *sh) {
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
93 return xnjsmb_auto_path_new(sh);
565
c0bc60448913 Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents: 564
diff changeset
94 }
c0bc60448913 Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents: 564
diff changeset
95
683
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
96 Handle<Value>
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
97 export_xnjsmb_auto_stext_new(shape_t *sh) {
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
98 return xnjsmb_auto_stext_new(sh);
565
c0bc60448913 Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents: 564
diff changeset
99 }
c0bc60448913 Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents: 564
diff changeset
100
683
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
101 Handle<Value>
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
102 export_xnjsmb_auto_image_new(shape_t *sh) {
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
103 return xnjsmb_auto_image_new(sh);
565
c0bc60448913 Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents: 564
diff changeset
104 }
c0bc60448913 Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents: 564
diff changeset
105
c0bc60448913 Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents: 564
diff changeset
106 /* @} */
c0bc60448913 Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents: 564
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 /*! \defgroup xnjsmb_shapes_cons Constructor of shapes
683
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
109 * \ingroup xnjsmb_shapes
574
a2faee809514 Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents: 570
diff changeset
110 *
a2faee809514 Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents: 570
diff changeset
111 * @{
a2faee809514 Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents: 570
diff changeset
112 */
683
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
113 shape_t *
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
114 xnjsmb_path_new(njs_runtime_t *rt, const char *d) {
574
a2faee809514 Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents: 570
diff changeset
115 redraw_man_t *rdman;
683
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
116 shape_t *sh;
574
a2faee809514 Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents: 570
diff changeset
117
683
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
118 rdman = X_njs_MB_rdman(rt);
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
119 sh = rdman_shape_path_new(rdman, d);
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
120
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
121 return sh;
574
a2faee809514 Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents: 570
diff changeset
122 }
a2faee809514 Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents: 570
diff changeset
123
683
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
124 shape_t *
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
125 xnjsmb_stext_new(njs_runtime_t *rt, const char *txt, float x, float y) {
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
126 redraw_man_t *rdman;
576
5a68e2bcea17 Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents: 574
diff changeset
127 shape_t *sh;
5a68e2bcea17 Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents: 574
diff changeset
128
683
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
129 rdman = X_njs_MB_rdman(rt);
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
130 sh = rdman_shape_stext_new(rdman, txt, x, y);
576
5a68e2bcea17 Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents: 574
diff changeset
131
683
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
132 return sh;
574
a2faee809514 Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents: 570
diff changeset
133 }
a2faee809514 Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents: 570
diff changeset
134
683
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
135 shape_t *
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
136 xnjsmb_image_new(njs_runtime_t *rt, float x, float y, float w, float h) {
641
f60d8fa1c55b Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents: 576
diff changeset
137 redraw_man_t *rdman;
683
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
138 shape_t *sh;
641
f60d8fa1c55b Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents: 576
diff changeset
139
683
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
140 rdman = X_njs_MB_rdman(rt);
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
141 sh = rdman_shape_image_new(rdman, x, y, w, h);
641
f60d8fa1c55b Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents: 576
diff changeset
142
683
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
143 return sh;
641
f60d8fa1c55b Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents: 576
diff changeset
144 }
f60d8fa1c55b Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents: 576
diff changeset
145
f60d8fa1c55b Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents: 576
diff changeset
146 /* @} */
f60d8fa1c55b Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents: 576
diff changeset
147
565
c0bc60448913 Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents: 564
diff changeset
148 /*! \brief Set properties of template of mb_rt.
683
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
149 * \ingroup xnjsmb_shapes
565
c0bc60448913 Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents: 564
diff changeset
150 */
c0bc60448913 Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents: 564
diff changeset
151 void
c0bc60448913 Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents: 564
diff changeset
152 xnjsmb_shapes_init_mb_rt_temp(Handle<FunctionTemplate> rt_temp) {
574
a2faee809514 Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents: 570
diff changeset
153 HandleScope scope;
a2faee809514 Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents: 570
diff changeset
154 Handle<FunctionTemplate> path_new_temp, stext_new_temp;
641
f60d8fa1c55b Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents: 576
diff changeset
155 Handle<FunctionTemplate> image_new_temp;
565
c0bc60448913 Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents: 564
diff changeset
156 Handle<ObjectTemplate> rt_proto_temp;
c0bc60448913 Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents: 564
diff changeset
157 static int temp_init_flag = 0;
c0bc60448913 Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents: 564
diff changeset
158
c0bc60448913 Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents: 564
diff changeset
159 if(temp_init_flag == 0) {
683
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
160 xnjsmb_auto_shape_init();
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
161 xnjsmb_auto_path_init();
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
162 xnjsmb_auto_stext_init();
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
163 xnjsmb_auto_image_init();
565
c0bc60448913 Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents: 564
diff changeset
164 temp_init_flag = 1;
c0bc60448913 Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents: 564
diff changeset
165 }
683
7685c57e29d0 Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
166 return;
565
c0bc60448913 Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents: 564
diff changeset
167 }