Mercurial > MadButterfly
comparison nodejs/mbfly_njs.h @ 1067:7b4e80ab671a openvg
merge from default branch
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Wed, 01 Dec 2010 12:25:56 +0800 |
parents | 88bd0eee2b00 |
children | 3eaf708b52c3 |
comparison
equal
deleted
inserted
replaced
630:bd18951b51d5 | 1067:7b4e80ab671a |
---|---|
1 // -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- | |
2 // vim: sw=4:ts=8:sts=4 | |
1 #ifndef __MBFLY_NJS_H_ | 3 #ifndef __MBFLY_NJS_H_ |
2 #define __MBFLY_NJS_H_ | 4 #define __MBFLY_NJS_H_ |
3 | 5 |
4 #include <v8.h> | 6 #include <v8.h> |
5 extern "C" { | 7 extern "C" { |
6 #include <mb.h> | 8 #include <mb.h> |
9 #include "njs_mb_supp.h" | |
7 } | 10 } |
8 | 11 |
9 #define THROW(x) \ | 12 #define THROW(x) \ |
10 do { \ | 13 do { \ |
11 v8::Handle<v8::Value> exc; \ | 14 v8::Handle<v8::Value> exc; \ |
12 exc = v8::Exception::Error(v8::String::New(x)); \ | 15 exc = v8::Exception::Error(v8::String::New(x)); \ |
13 return v8::ThrowException(exc); \ | 16 return v8::ThrowException(exc); \ |
17 } while(0) | |
18 #define THROW_noret(x) \ | |
19 do { \ | |
20 v8::Handle<v8::Value> exc; \ | |
21 exc = v8::Exception::Error(v8::String::New(x)); \ | |
22 v8::ThrowException(exc); \ | |
23 return; \ | |
14 } while(0) | 24 } while(0) |
15 #define UNWRAP(o) v8::External::Unwrap((o)->GetInternalField(0)) | 25 #define UNWRAP(o) v8::External::Unwrap((o)->GetInternalField(0)) |
16 #define WRAP(o, v) (o)->SetInternalField(0, v8::External::Wrap(v)) | 26 #define WRAP(o, v) (o)->SetInternalField(0, v8::External::Wrap(v)) |
17 #define SET(o, n, v) (o)->Set(v8::String::New(n), v) | 27 #define SET(o, n, v) (o)->Set(v8::String::New(n), v) |
18 #define GET(o, n) (o)->Get(v8::String::New(n)) | 28 #define GET(o, n) (o)->Get(v8::String::New(n)) |
19 | 29 |
20 redraw_man_t *xnjsmb_rt_rdman(v8::Handle<v8::Object> mbrt); | 30 redraw_man_t *xnjsmb_rt_rdman(v8::Handle<v8::Object> mbrt); |
21 | 31 |
22 /* From coord.cc */ | 32 /* From coord.cc */ |
23 v8::Handle<v8::Value> xnjsmb_coord_new(const v8::Arguments &args); | |
24 void xnjsmb_coord_mkroot(v8::Handle<v8::Object> js_rt); | 33 void xnjsmb_coord_mkroot(v8::Handle<v8::Object> js_rt); |
34 v8::Handle<v8::Value> export_xnjsmb_auto_coord_new(coord_t *coord); | |
25 | 35 |
26 /* From shapes.cc */ | 36 /* From shapes.cc */ |
27 void xnjsmb_shapes_init_mb_rt_temp(v8::Handle<v8::FunctionTemplate> rt_temp); | 37 void xnjsmb_shapes_init_mb_rt_temp(v8::Handle<v8::FunctionTemplate> rt_temp); |
38 shape_t *xnjsmb_path_new(njs_runtime_t *rt, const char *d); | |
39 shape_t *xnjsmb_stext_new(njs_runtime_t *rt, const char *txt, | |
40 float x, float y); | |
41 shape_t *xnjsmb_image_new(njs_runtime_t *rt, float x, float y, | |
42 float w, float h); | |
43 shape_t *xnjsmb_rect_new(njs_runtime_t *rt, float x, float y, | |
44 float w, float h, | |
45 float rx, float ry, const char **err); | |
46 v8::Handle<v8::Value> export_xnjsmb_auto_path_new(shape_t *sh); | |
47 v8::Handle<v8::Value> export_xnjsmb_auto_stext_new(shape_t *sh); | |
48 v8::Handle<v8::Value> export_xnjsmb_auto_image_new(shape_t *sh); | |
49 v8::Handle<v8::Value> export_xnjsmb_auto_rect_new(shape_t *sh); | |
28 | 50 |
29 /* From paints.cc */ | 51 /* From paints.cc */ |
30 void xnjsmb_paints_init_mb_rt_temp(v8::Handle<v8::FunctionTemplate> rt_temp); | 52 void xnjsmb_paints_init_mb_rt_temp(v8::Handle<v8::FunctionTemplate> rt_temp); |
53 paint_t *xnjsmb_paint_color_new(njs_runtime_t *rt, | |
54 float r, float g, float b, float a, | |
55 const char **err); | |
56 paint_t *xnjsmb_paint_image_new(njs_runtime_t *rt, mb_img_data_t *img, | |
57 const char **err); | |
58 paint_t *xnjsmb_paint_linear_new(njs_runtime_t *rt, | |
59 float x1, float y1, float x2, float y2, | |
60 const char **err); | |
61 paint_t *xnjsmb_paint_radial_new(njs_runtime_t *rt, | |
62 float cx, float cy, float r, | |
63 const char **err); | |
64 v8::Handle<v8::Value> export_xnjsmb_auto_paint_color_new(paint_t *paint); | |
65 v8::Handle<v8::Value> export_xnjsmb_auto_paint_image_new(paint_t *paint); | |
66 v8::Handle<v8::Value> export_xnjsmb_auto_paint_linear_new(paint_t *sh); | |
67 v8::Handle<v8::Value> export_xnjsmb_auto_paint_radial_new(paint_t *sh); | |
31 | 68 |
32 /* From font.cc */ | 69 /* From font.cc */ |
33 void xnjsmb_font_init_mb_rt_temp(v8::Handle<v8::FunctionTemplate> mb_rt_temp); | 70 void xnjsmb_font_init_mb_rt_temp(v8::Handle<v8::FunctionTemplate> mb_rt_temp); |
34 | 71 |
72 /* From image_ldr.cc */ | |
73 void | |
74 xnjsmb_img_ldr_init_mb_rt_temp(v8::Handle<v8::Object> mb_rt_temp); | |
75 | |
76 /* From observer.cc */ | |
77 v8::Handle<v8::Value> export_xnjsmb_auto_subject_new(subject_t *subject); | |
78 void xnjsmb_observer_init(void); | |
79 | |
35 #endif /* __MBFLY_NJS_H_ */ | 80 #endif /* __MBFLY_NJS_H_ */ |