annotate include/mb_graph_engine_openvg.h @ 581:953acea89f76 openvg

dummy implementation of graphic engine
author Thinker K.F. Li <thinker@branda.to>
date Sat, 19 Jun 2010 11:43:53 +0800
parents 7bfeccdc91cb
children dd546c4da180
rev   line source
578
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
1 #ifndef __MB_GE_OPENVG_H_
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
2 #define __MB_GE_OPENVG_H_
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
3
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
4 #include <stdio.h>
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
5 #include <GL/glut.h>
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
6 #include "mb_basic_types.h"
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
7 #include "mb_img_ldr.h"
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
8
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
9 /*! \defgroup mb_ge_cairo MadButterfly Graphic Engine with Cairo
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
10 * @{
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
11 */
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
12 #define MBE_OPERATOR_CLEAR OPENVG_OPERATOR_CLEAR
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
13 #define MBE_OPERATOR_SOURCE OPENVG_OPERATOR_SOURCE
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
14 #define MBE_STATUS_SUCCESS OPENVG_STATUS_SUCCESS
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
15
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
16 #define mbe_image_surface_create_from_png(fn) ((mbe_surface_t *)NULL)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
17 #define mbe_image_surface_create_for_data(data, fmt, w, h, stride) \
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
18 ((mbe_surface_t *)NULL)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
19 #define mbe_pattern_create_for_surface(canvas) ((mbe_pattern_t *)NULL)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
20 #define mbe_scaled_font_text_extents(scaled, utf8, extents)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
21 #define mbe_image_surface_get_stride(surface) (20)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
22 #define mbe_image_surface_get_format(surface) ((mb_img_fmt_t)0)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
23 #define mbe_image_surface_get_height(surface) (1)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
24 #define mbe_image_surface_get_width(surface) (1)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
25 #define mbe_image_surface_get_data(surface) ((unsigned char *)NULL)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
26 #define mbe_scaled_font_reference(scaled) ((mbe_scaled_font_t *)NULL)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
27 /* For OpenVG backend, never invoke xlib surface.
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
28 * #define mbe_xlib_surface_create cairo_xlib_surface_create
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
29 */
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
30 #define mbe_pattern_create_radial(cx0, cy0, radius0, \
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
31 cx1, cy1, radius1, stops, stop_cnt) \
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
32 ((mbe_pattern_t *)NULL)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
33 #define mbe_pattern_create_linear(x0, y0, x1, y1, stops, stop_cnt) \
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
34 ((mbe_pattern_t *)NULL)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
35 #define mbe_image_surface_create(fmt, w, h) ((mbe_surface_t *)NULL)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
36 #define mbe_scaled_font_destroy(scaled)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
37 #define mbe_font_face_reference(face) ((mbe_font_face_t *)NULL)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
38 #define mbe_scaled_font_create(face, fnt_mtx, ctm) ((mbe_scaled_font_t *)NULL)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
39 #define mbe_pattern_set_matrix(ptn, mtx)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
40 #define mbe_font_face_destroy(face)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
41 #define mbe_paint_with_alpha(canvas, alpha)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
42 #define mbe_surface_destroy(surface)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
43 #define mbe_set_source_rgba(canvas, r, g, b, a)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
44 #define mbe_set_scaled_font(canvas, scaled)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
45 #define mbe_pattern_destroy(pattern)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
46 #define mbe_get_scaled_font(canvas) ((mbe_scaled_font_t *)NULL)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
47 #define mbe_query_font_face(family, slant, weight) ((mbe_font_face_t *)NULL)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
48 #define mbe_free_font_face(face)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
49 #define mbe_set_line_width(canvas, w)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
50 #define mbe_set_source_rgb(canvas, r, g, b)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
51 #define mbe_get_font_face(canvas) ((mbe_font_face_t *)NULL)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
52 #define mbe_fill_preserve(canvas)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
53 #define mbe_copy_source(src_canvas, dst_canvas)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
54 #define mbe_set_source(canvas, pattern)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
55 #define mbe_reset_clip(canvas)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
56 #define mbe_get_target(canvas) ((mbe_surface_t *)NULL)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
57 #define mbe_close_path(canvas)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
58 #define mbe_text_path(canvas, utf8)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
59 #define mbe_transform(canvas, mtx)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
60 #define mbe_rectangle(canvas, x, y, w, h)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
61 #define mbe_in_stroke(canvas, x, y) (0)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
62 #define mbe_new_path(canvas)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
63 #define mbe_curve_to(canvas, x1, y1, x2, y2, x3, y3)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
64 #define mbe_restore(canvas)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
65 #define mbe_move_to(canvas, x, y)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
66 #define mbe_line_to(canvas, x, y)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
67 #define mbe_in_fill(canvas, x, y) (0)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
68 #define mbe_destroy(canvas)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
69 #define mbe_stroke(canvas)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
70 #define mbe_create(surface) ((mbe_t *)NULL)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
71 #define mbe_clear(canvas)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
72 #define mbe_paint(canvas)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
73 #define mbe_save(canvas)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
74 #define mbe_fill(canvas)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
75 #define mbe_clip(canvas)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
76 #define mbe_arc(canvas, x, y, radius, angle_start, angle_stop)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
77
580
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
78 typedef struct _mbe_text_extents_t mbe_text_extents_t;
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
79 typedef int mbe_scaled_font_t;
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
80 typedef int mbe_font_face_t;
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
81 typedef struct _ge_openvg_surface mbe_surface_t;
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
82 typedef struct _ge_openvg_pattern mbe_pattern_t;
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
83 typedef struct _ge_openvg_mbe mbe_t;
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
84
578
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
85 struct _mbe_text_extents_t {
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
86 co_aix x_bearing;
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
87 co_aix y_bearing;
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
88 co_aix width;
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
89 co_aix height;
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
90 co_aix x_advance;
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
91 co_aix y_advance;
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
92 };
580
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
93
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
94 struct _ge_openvg_mbe {
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
95 mbe_pattern_t *src;
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
96 mbe_surface_t *tgt;
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
97 void *ctx;
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
98 };
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
99
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
100 struct _ge_openvg_surface {
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
101 void *surface;
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
102 mbe_t *asso_mbe;
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
103 };
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
104
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
105 struct _ge_openvg_pattern {
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
106 void *pattern;
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
107 void *asso_img;
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
108 };
578
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
109
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
110 #define MB_MATRIX_2_OPENVG(vgmtx, mtx) do { \
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
111 (vgmtx)[0] = (mtx)[0]; \
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
112 (vgmtx)[1] = (mtx)[3]; \
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
113 (vgmtx)[2] = 0; \
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
114 (vgmtx)[3] = (mtx)[1]; \
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
115 (vgmtx)[4] = (mtx)[4]; \
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
116 (vgmtx)[5] = 0; \
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
117 (vgmtx)[6] = (mtx)[2]; \
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
118 (vgmtx)[7] = (mtx)[5]; \
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
119 (vgmtx)[8] = 1; \
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
120 } while(0)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
121
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
122
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
123 /* @} */
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
124
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
125 #endif /* __MB_GE_OPENVG_H_ */