Mercurial > MadButterfly
annotate nodejs/image_ldr.cc @ 788:7ec13634c97d
Add holder for animate
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Tue, 31 Aug 2010 02:36:01 +0800 |
parents | b346e4699e55 |
children | 586e50f82c1f |
rev | line source |
---|---|
639
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
1 /*! \file |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
2 * This file implements Javascript binding for img_ldr_t of MadButterfly. |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
3 */ |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
4 #include <v8.h> |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
5 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
6 extern "C" { |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
7 #include "mb.h" |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
8 } |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
9 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
10 #include "mbfly_njs.h" |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
11 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
12 using namespace v8; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
13 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
14 #ifndef ASSERT |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
15 #define ASSERT(x) |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
16 #endif |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
17 |
684
b346e4699e55
Add more comment for JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
643
diff
changeset
|
18 /*! \defgroup xnjsmb_img_ldr_js Javascript binding for image loader. |
b346e4699e55
Add more comment for JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
643
diff
changeset
|
19 * \ingroup xnjsmb |
640
9016e7e70f7d
Group binding for image loader with Doxygen syntax
Thinker K.F. Li <thinker@branda.to>
parents:
639
diff
changeset
|
20 * |
9016e7e70f7d
Group binding for image loader with Doxygen syntax
Thinker K.F. Li <thinker@branda.to>
parents:
639
diff
changeset
|
21 * @{ |
9016e7e70f7d
Group binding for image loader with Doxygen syntax
Thinker K.F. Li <thinker@branda.to>
parents:
639
diff
changeset
|
22 */ |
9016e7e70f7d
Group binding for image loader with Doxygen syntax
Thinker K.F. Li <thinker@branda.to>
parents:
639
diff
changeset
|
23 |
639
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
24 static Persistent<ObjectTemplate> img_data_temp; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
25 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
26 /*! \brief load() method of img_ldr Javascript objects. |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
27 */ |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
28 static Handle<Value> |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
29 xnjsmb_img_ldr_load(const Arguments &args) { |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
30 HandleScope scope; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
31 int argc = args.Length(); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
32 Handle<Object> self = args.This(); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
33 char *img_id; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
34 mb_img_ldr_t *img_ldr; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
35 mb_img_data_t *img_data; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
36 Handle<Object> img_data_obj; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
37 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
38 if(argc != 1) |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
39 THROW("Invalid number of arguments (!= 1)"); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
40 if(!args[0]->IsString()) |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
41 THROW("Invalid argument type"); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
42 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
43 String::Utf8Value img_id_utf8(args[0]->ToString()); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
44 img_id = *img_id_utf8; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
45 img_ldr = (mb_img_ldr_t *)UNWRAP(self); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
46 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
47 img_data_obj = img_data_temp->NewInstance(); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
48 ASSERT(img_data_obj); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
49 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
50 img_data = MB_IMG_LDR_LOAD(img_ldr, img_id); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
51 if(img_data == NULL) |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
52 THROW("Can not load an image"); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
53 WRAP(img_data_obj, img_data); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
54 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
55 scope.Close(img_data_obj); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
56 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
57 return img_data_obj; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
58 } |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
59 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
60 /*! \brief Constructor function of img_ldr Javascript objects. |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
61 */ |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
62 static Handle<Value> |
643
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
63 xnjsmb_img_ldr(const Arguments &args) { |
639
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
64 HandleScope scope; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
65 int argc = args.Length(); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
66 Handle<Object> self = args.This(); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
67 char *path; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
68 mb_img_ldr_t *img_ldr; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
69 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
70 if(argc != 1) |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
71 THROW("Invalid number of arguments (!= 1)"); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
72 if(!args[0]->IsString()) |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
73 THROW("Invalid argument type"); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
74 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
75 String::Utf8Value pathutf8(args[0]->ToString()); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
76 path = *pathutf8; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
77 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
78 img_ldr = simple_mb_img_ldr_new(path); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
79 if(img_ldr == NULL) |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
80 THROW("Can not create an image loader"); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
81 WRAP(self, img_ldr); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
82 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
83 return Null(); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
84 } |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
85 |
643
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
86 static Persistent<FunctionTemplate> xnjsmb_img_ldr_temp; |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
87 |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
88 static Handle<Value> |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
89 xnjsmb_img_ldr_new(const Arguments &args) { |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
90 HandleScope scope; |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
91 int argc = args.Length(); |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
92 Handle<Value> il_args[1]; |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
93 Handle<Object> img_ldr; |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
94 Handle<Function> func; |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
95 |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
96 if(argc != 1) |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
97 THROW("Invalid number of arguments (!= 1)"); |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
98 if(!args[0]->IsString()) |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
99 THROW("Invalid argument type"); |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
100 |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
101 il_args[0] = args[0]; |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
102 func = xnjsmb_img_ldr_temp->GetFunction(); |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
103 img_ldr = func->NewInstance(1, il_args); |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
104 |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
105 scope.Close(img_ldr); |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
106 return img_ldr; |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
107 } |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
108 |
640
9016e7e70f7d
Group binding for image loader with Doxygen syntax
Thinker K.F. Li <thinker@branda.to>
parents:
639
diff
changeset
|
109 /* @} */ |
9016e7e70f7d
Group binding for image loader with Doxygen syntax
Thinker K.F. Li <thinker@branda.to>
parents:
639
diff
changeset
|
110 |
639
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
111 /*! \brief Initialize image loader. |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
112 * |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
113 * This function is called by init() in mbfly_njs.cc when the module |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
114 * being loaded. |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
115 */ |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
116 void |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
117 xnjsmb_img_ldr_init_mb_rt_temp(Handle<Object> rt_temp) { |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
118 HandleScope scope; |
643
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
119 Handle<FunctionTemplate> img_ldr_temp; |
639
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
120 Handle<FunctionTemplate> img_ldr_new_temp; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
121 Handle<ObjectTemplate> ldr_inst_temp; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
122 Handle<ObjectTemplate> ldr_proto_temp; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
123 Handle<FunctionTemplate> img_ldr_load_temp; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
124 Handle<ObjectTemplate> _img_data_temp; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
125 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
126 /* Setup object template for img_data_t object for Javascript */ |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
127 _img_data_temp = ObjectTemplate::New(); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
128 _img_data_temp->SetInternalFieldCount(1); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
129 img_data_temp = Persistent<ObjectTemplate>::New(_img_data_temp); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
130 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
131 /* Setup img_ldr class */ |
643
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
132 img_ldr_temp = FunctionTemplate::New(xnjsmb_img_ldr); |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
133 img_ldr_temp->SetClassName(String::New("img_ldr")); |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
134 ldr_inst_temp = img_ldr_temp->InstanceTemplate(); |
639
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
135 ldr_inst_temp->SetInternalFieldCount(1); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
136 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
137 /* Set method load() for img_ldr */ |
643
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
138 ldr_proto_temp = img_ldr_temp->PrototypeTemplate(); |
639
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
139 img_ldr_load_temp = FunctionTemplate::New(xnjsmb_img_ldr_load); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
140 SET(ldr_proto_temp, "load", img_ldr_load_temp); |
643
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
141 |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
142 xnjsmb_img_ldr_temp = Persistent<FunctionTemplate>::New(img_ldr_temp); |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
143 |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
144 /* Initialize img_ldr_new function */ |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
145 img_ldr_new_temp = FunctionTemplate::New(xnjsmb_img_ldr_new); |
639
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
146 SET(rt_temp, "img_ldr_new", img_ldr_new_temp->GetFunction()); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
147 } |