Mercurial > MadButterfly
annotate nodejs/image_ldr.cc @ 654:21f944e79b19
Use --with-backend to specify display backend.
author | Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com> |
---|---|
date | Sat, 31 Jul 2010 17:31:00 +0800 |
parents | a65720721c60 |
children | b346e4699e55 |
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 |
640
9016e7e70f7d
Group binding for image loader with Doxygen syntax
Thinker K.F. Li <thinker@branda.to>
parents:
639
diff
changeset
|
18 /*! \defgroup img_ldr_js Javascript binding for image loader. |
9016e7e70f7d
Group binding for image loader with Doxygen syntax
Thinker K.F. Li <thinker@branda.to>
parents:
639
diff
changeset
|
19 * |
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 |
639
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
23 static Persistent<ObjectTemplate> img_data_temp; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
24 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
25 /*! \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
|
26 */ |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
27 static Handle<Value> |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
28 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
|
29 HandleScope scope; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
30 int argc = args.Length(); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
31 Handle<Object> self = args.This(); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
32 char *img_id; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
33 mb_img_ldr_t *img_ldr; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
34 mb_img_data_t *img_data; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
35 Handle<Object> img_data_obj; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
36 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
37 if(argc != 1) |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
38 THROW("Invalid number of arguments (!= 1)"); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
39 if(!args[0]->IsString()) |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
40 THROW("Invalid argument type"); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
41 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
42 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
|
43 img_id = *img_id_utf8; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
44 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
|
45 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
46 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
|
47 ASSERT(img_data_obj); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
48 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
49 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
|
50 if(img_data == NULL) |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
51 THROW("Can not load an image"); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
52 WRAP(img_data_obj, img_data); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
53 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
54 scope.Close(img_data_obj); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
55 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
56 return img_data_obj; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
57 } |
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 /*! \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
|
60 */ |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
61 static Handle<Value> |
643
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
62 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
|
63 HandleScope scope; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
64 int argc = args.Length(); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
65 Handle<Object> self = args.This(); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
66 char *path; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
67 mb_img_ldr_t *img_ldr; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
68 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
69 if(argc != 1) |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
70 THROW("Invalid number of arguments (!= 1)"); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
71 if(!args[0]->IsString()) |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
72 THROW("Invalid argument type"); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
73 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
74 String::Utf8Value pathutf8(args[0]->ToString()); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
75 path = *pathutf8; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
76 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
77 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
|
78 if(img_ldr == NULL) |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
79 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
|
80 WRAP(self, img_ldr); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
81 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
82 return Null(); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
83 } |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
84 |
643
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
85 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
|
86 |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
87 static Handle<Value> |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
88 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
|
89 HandleScope scope; |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
90 int argc = args.Length(); |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
91 Handle<Value> il_args[1]; |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
92 Handle<Object> img_ldr; |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
93 Handle<Function> func; |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
94 |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
95 if(argc != 1) |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
96 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
|
97 if(!args[0]->IsString()) |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
98 THROW("Invalid argument type"); |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
99 |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
100 il_args[0] = args[0]; |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
101 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
|
102 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
|
103 |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
104 scope.Close(img_ldr); |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
105 return img_ldr; |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
106 } |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
107 |
640
9016e7e70f7d
Group binding for image loader with Doxygen syntax
Thinker K.F. Li <thinker@branda.to>
parents:
639
diff
changeset
|
108 /* @} */ |
9016e7e70f7d
Group binding for image loader with Doxygen syntax
Thinker K.F. Li <thinker@branda.to>
parents:
639
diff
changeset
|
109 |
639
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
110 /*! \brief Initialize image loader. |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
111 * |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
112 * 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
|
113 * being loaded. |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
114 */ |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
115 void |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
116 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
|
117 HandleScope scope; |
643
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
118 Handle<FunctionTemplate> img_ldr_temp; |
639
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
119 Handle<FunctionTemplate> img_ldr_new_temp; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
120 Handle<ObjectTemplate> ldr_inst_temp; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
121 Handle<ObjectTemplate> ldr_proto_temp; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
122 Handle<FunctionTemplate> img_ldr_load_temp; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
123 Handle<ObjectTemplate> _img_data_temp; |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
124 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
125 /* 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
|
126 _img_data_temp = ObjectTemplate::New(); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
127 _img_data_temp->SetInternalFieldCount(1); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
128 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
|
129 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
130 /* Setup img_ldr class */ |
643
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
131 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
|
132 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
|
133 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
|
134 ldr_inst_temp->SetInternalFieldCount(1); |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
135 |
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
136 /* 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
|
137 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
|
138 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
|
139 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
|
140 |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
141 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
|
142 |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
143 /* Initialize img_ldr_new function */ |
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
640
diff
changeset
|
144 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
|
145 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
|
146 } |