annotate include/mb_graph_engine_openvg.h @ 603:39d27911c3ae openvg

Remove mbe_image_surface_create_for_data()
author Thinker K.F. Li <thinker@branda.to>
date Sun, 04 Jul 2010 00:16:43 +0800
parents ac2e6468a22a
children 38514a7c6b26
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>
582
dd546c4da180 deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents: 580
diff changeset
5 #include <stdlib.h>
dd546c4da180 deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents: 580
diff changeset
6 #include <EGL/egl.h>
dd546c4da180 deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents: 580
diff changeset
7 #include <VG/openvg.h>
578
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
8 #include "mb_basic_types.h"
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
9 #include "mb_img_ldr.h"
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 /*! \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
12 * @{
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
13 */
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
14 #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
15 #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
16 #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
17 #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
18 #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
19 #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
20 #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
21 #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
22 #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
23 cx1, cy1, radius1, stops, stop_cnt) \
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
24 ((mbe_pattern_t *)NULL)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
25 #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
26 ((mbe_pattern_t *)NULL)
602
ac2e6468a22a Replace mbe_image_surface_create_from_png() with mbe_pattern_create_image()
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
27 #define mbe_pattern_create_image(img) ((mbe_pattern_t *)NULL)
578
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
28 #define mbe_scaled_font_destroy(scaled)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
29 #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
30 #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
31 #define mbe_pattern_set_matrix(ptn, mtx)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
32 #define mbe_font_face_destroy(face)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
33 #define mbe_paint_with_alpha(canvas, alpha)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
34 #define mbe_set_scaled_font(canvas, scaled)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
35 #define mbe_pattern_destroy(pattern)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
36 #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
37 #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
38 #define mbe_free_font_face(face)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
39 #define mbe_set_line_width(canvas, w)
600
20b396c09c23 Integrate pattern source with paint model of canvas
Thinker K.F. Li <thinker@branda.to>
parents: 599
diff changeset
40 #define mbe_set_source_rgb(canvas, r, g, b) \
20b396c09c23 Integrate pattern source with paint model of canvas
Thinker K.F. Li <thinker@branda.to>
parents: 599
diff changeset
41 mbe_set_source_rgba(canvas, r, g, b, 1)
578
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
42 #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
43 #define mbe_fill_preserve(canvas)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
44 #define mbe_copy_source(src_canvas, dst_canvas)
582
dd546c4da180 deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents: 580
diff changeset
45 #define mbe_set_source(canvas, pattern) \
600
20b396c09c23 Integrate pattern source with paint model of canvas
Thinker K.F. Li <thinker@branda.to>
parents: 599
diff changeset
46 do { \
20b396c09c23 Integrate pattern source with paint model of canvas
Thinker K.F. Li <thinker@branda.to>
parents: 599
diff changeset
47 (canvas)->src = (pattern); \
20b396c09c23 Integrate pattern source with paint model of canvas
Thinker K.F. Li <thinker@branda.to>
parents: 599
diff changeset
48 (canvas)->paint = (pattern)->paint; \
20b396c09c23 Integrate pattern source with paint model of canvas
Thinker K.F. Li <thinker@branda.to>
parents: 599
diff changeset
49 (canvas)->paint_installed = 0; \
20b396c09c23 Integrate pattern source with paint model of canvas
Thinker K.F. Li <thinker@branda.to>
parents: 599
diff changeset
50 } while(0)
586
b42d69ab8857 Replace mbe_clip() with mbe_scissoring()
Thinker K.F. Li <thinker@branda.to>
parents: 585
diff changeset
51 #define mbe_reset_scissoring(canvas)
582
dd546c4da180 deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents: 580
diff changeset
52 #define mbe_get_target(canvas) ((mbe_surface_t *)(canvas)->tgt)
578
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
53 #define mbe_close_path(canvas)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
54 #define mbe_text_path(canvas, utf8)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
55 #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
56 #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
57 #define mbe_new_path(canvas)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
58 #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
59 #define mbe_restore(canvas)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
60 #define mbe_move_to(canvas, x, y)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
61 #define mbe_line_to(canvas, x, y)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
62 #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
63 #define mbe_save(canvas)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
64 #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
65
580
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
66 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
67 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
68 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
69 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
70 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
71 typedef struct _ge_openvg_mbe mbe_t;
603
39d27911c3ae Remove mbe_image_surface_create_for_data()
Thinker K.F. Li <thinker@branda.to>
parents: 602
diff changeset
72 typedef struct _ge_openvg_img _ge_openvg_img_t;
580
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
73
578
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
74 struct _mbe_text_extents_t {
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
75 co_aix x_bearing;
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
76 co_aix y_bearing;
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
77 co_aix width;
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
78 co_aix height;
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
79 co_aix x_advance;
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
80 co_aix y_advance;
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
81 };
580
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
82
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
83 struct _ge_openvg_mbe {
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
84 mbe_pattern_t *src;
595
aaaaa03af04d Set VGPaint for canvas
Thinker K.F. Li <thinker@branda.to>
parents: 593
diff changeset
85 VGPaint paint; /*!< \brief The paint associated with
aaaaa03af04d Set VGPaint for canvas
Thinker K.F. Li <thinker@branda.to>
parents: 593
diff changeset
86 * the src pattern */
aaaaa03af04d Set VGPaint for canvas
Thinker K.F. Li <thinker@branda.to>
parents: 593
diff changeset
87 int paint_installed;
580
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
88 mbe_surface_t *tgt;
582
dd546c4da180 deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents: 580
diff changeset
89 EGLContext ctx;
590
b714f0c9992e include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents: 589
diff changeset
90 VGPath path;
580
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
91 };
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
92
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
93 struct _ge_openvg_surface {
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
94 void *surface;
590
b714f0c9992e include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents: 589
diff changeset
95 mbe_t *asso_mbe; /* There is a association between
b714f0c9992e include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents: 589
diff changeset
96 * surface and mbe */
603
39d27911c3ae Remove mbe_image_surface_create_for_data()
Thinker K.F. Li <thinker@branda.to>
parents: 602
diff changeset
97 _ge_openvg_img_t *asso_img;
592
de9d210e9c38 Specify width and height while create an image surface
Thinker K.F. Li <thinker@branda.to>
parents: 590
diff changeset
98 int w, h;
580
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
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
101 struct _ge_openvg_pattern {
603
39d27911c3ae Remove mbe_image_surface_create_for_data()
Thinker K.F. Li <thinker@branda.to>
parents: 602
diff changeset
102 _ge_openvg_img_t *asso_img;
595
aaaaa03af04d Set VGPaint for canvas
Thinker K.F. Li <thinker@branda.to>
parents: 593
diff changeset
103 VGPaint paint;
580
7bfeccdc91cb Encapsulate information of OpenVG objects in structures.
Thinker K.F. Li <thinker@branda.to>
parents: 578
diff changeset
104 };
578
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
105
603
39d27911c3ae Remove mbe_image_surface_create_for_data()
Thinker K.F. Li <thinker@branda.to>
parents: 602
diff changeset
106 /*! \brief Information associated with VGImage.
39d27911c3ae Remove mbe_image_surface_create_for_data()
Thinker K.F. Li <thinker@branda.to>
parents: 602
diff changeset
107 *
39d27911c3ae Remove mbe_image_surface_create_for_data()
Thinker K.F. Li <thinker@branda.to>
parents: 602
diff changeset
108 * A VGImage can associated one of pattern or surface. This type is
39d27911c3ae Remove mbe_image_surface_create_for_data()
Thinker K.F. Li <thinker@branda.to>
parents: 602
diff changeset
109 * used to make sure previous associated pattern or surface being
39d27911c3ae Remove mbe_image_surface_create_for_data()
Thinker K.F. Li <thinker@branda.to>
parents: 602
diff changeset
110 * released before new association.
39d27911c3ae Remove mbe_image_surface_create_for_data()
Thinker K.F. Li <thinker@branda.to>
parents: 602
diff changeset
111 *
39d27911c3ae Remove mbe_image_surface_create_for_data()
Thinker K.F. Li <thinker@branda.to>
parents: 602
diff changeset
112 * Functions must release assocation specified by
39d27911c3ae Remove mbe_image_surface_create_for_data()
Thinker K.F. Li <thinker@branda.to>
parents: 602
diff changeset
113 * _ge_openvg_img::asso_pattern or _ge_openvg_img::asso_surface before
39d27911c3ae Remove mbe_image_surface_create_for_data()
Thinker K.F. Li <thinker@branda.to>
parents: 602
diff changeset
114 * new association, and record new association as one of thes two
39d27911c3ae Remove mbe_image_surface_create_for_data()
Thinker K.F. Li <thinker@branda.to>
parents: 602
diff changeset
115 * vairables.
39d27911c3ae Remove mbe_image_surface_create_for_data()
Thinker K.F. Li <thinker@branda.to>
parents: 602
diff changeset
116 *
39d27911c3ae Remove mbe_image_surface_create_for_data()
Thinker K.F. Li <thinker@branda.to>
parents: 602
diff changeset
117 * \sa _ge_openvg_img_t
39d27911c3ae Remove mbe_image_surface_create_for_data()
Thinker K.F. Li <thinker@branda.to>
parents: 602
diff changeset
118 * \note This is type is for internal using of OpenVG graphic engine.
39d27911c3ae Remove mbe_image_surface_create_for_data()
Thinker K.F. Li <thinker@branda.to>
parents: 602
diff changeset
119 */
39d27911c3ae Remove mbe_image_surface_create_for_data()
Thinker K.F. Li <thinker@branda.to>
parents: 602
diff changeset
120 struct _ge_openvg_img {
39d27911c3ae Remove mbe_image_surface_create_for_data()
Thinker K.F. Li <thinker@branda.to>
parents: 602
diff changeset
121 VGImage img;
39d27911c3ae Remove mbe_image_surface_create_for_data()
Thinker K.F. Li <thinker@branda.to>
parents: 602
diff changeset
122 mbe_pattern_t *asso_pattern;
39d27911c3ae Remove mbe_image_surface_create_for_data()
Thinker K.F. Li <thinker@branda.to>
parents: 602
diff changeset
123 mbe_surface_t *asso_surface;
39d27911c3ae Remove mbe_image_surface_create_for_data()
Thinker K.F. Li <thinker@branda.to>
parents: 602
diff changeset
124 };
39d27911c3ae Remove mbe_image_surface_create_for_data()
Thinker K.F. Li <thinker@branda.to>
parents: 602
diff changeset
125
578
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
126 #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
127 (vgmtx)[0] = (mtx)[0]; \
583
ca57132020e4 Set transform matrix for VG contexts
Thinker K.F. Li <thinker@branda.to>
parents: 582
diff changeset
128 (vgmtx)[1] = (mtx)[1]; \
ca57132020e4 Set transform matrix for VG contexts
Thinker K.F. Li <thinker@branda.to>
parents: 582
diff changeset
129 (vgmtx)[2] = (mtx)[2]; \
ca57132020e4 Set transform matrix for VG contexts
Thinker K.F. Li <thinker@branda.to>
parents: 582
diff changeset
130 (vgmtx)[3] = (mtx)[3]; \
578
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
131 (vgmtx)[4] = (mtx)[4]; \
583
ca57132020e4 Set transform matrix for VG contexts
Thinker K.F. Li <thinker@branda.to>
parents: 582
diff changeset
132 (vgmtx)[5] = (mtx)[5]; \
ca57132020e4 Set transform matrix for VG contexts
Thinker K.F. Li <thinker@branda.to>
parents: 582
diff changeset
133 (vgmtx)[6] = 0; \
ca57132020e4 Set transform matrix for VG contexts
Thinker K.F. Li <thinker@branda.to>
parents: 582
diff changeset
134 (vgmtx)[7] = 0; \
578
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
135 (vgmtx)[8] = 1; \
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
136 } while(0)
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
137
582
dd546c4da180 deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents: 580
diff changeset
138 extern EGLNativeDisplayType _ge_openvg_disp_id;
584
543a2a8523fb Make surce current VG context
Thinker K.F. Li <thinker@branda.to>
parents: 583
diff changeset
139 extern mbe_t *_ge_openvg_current_canvas;
582
dd546c4da180 deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents: 580
diff changeset
140
598
aba62eb9362d define color source for VG
Thinker K.F. Li <thinker@branda.to>
parents: 597
diff changeset
141 extern void mbe_set_source_rgba(mbe_t *canvas, co_comp_t r, co_comp_t g,
aba62eb9362d define color source for VG
Thinker K.F. Li <thinker@branda.to>
parents: 597
diff changeset
142 co_comp_t b, co_comp_t a);
588
e9923024f65e Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 586
diff changeset
143 extern void mbe_scissoring(mbe_t *canvas, int n_areas, area_t **areas);
e9923024f65e Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 586
diff changeset
144
e9923024f65e Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 586
diff changeset
145
584
543a2a8523fb Make surce current VG context
Thinker K.F. Li <thinker@branda.to>
parents: 583
diff changeset
146 #define _VG_DISPLAY() eglGetDisplay(_ge_openvg_disp_id)
543a2a8523fb Make surce current VG context
Thinker K.F. Li <thinker@branda.to>
parents: 583
diff changeset
147
543a2a8523fb Make surce current VG context
Thinker K.F. Li <thinker@branda.to>
parents: 583
diff changeset
148 /* \brief Make the context of a canvas to be current context.
543a2a8523fb Make surce current VG context
Thinker K.F. Li <thinker@branda.to>
parents: 583
diff changeset
149 */
543a2a8523fb Make surce current VG context
Thinker K.F. Li <thinker@branda.to>
parents: 583
diff changeset
150 #define _MK_CURRENT_CTX(canvas) do { \
543a2a8523fb Make surce current VG context
Thinker K.F. Li <thinker@branda.to>
parents: 583
diff changeset
151 if(_ge_openvg_current_canvas != (canvas)) { \
543a2a8523fb Make surce current VG context
Thinker K.F. Li <thinker@branda.to>
parents: 583
diff changeset
152 _ge_openvg_current_canvas = canvas; \
543a2a8523fb Make surce current VG context
Thinker K.F. Li <thinker@branda.to>
parents: 583
diff changeset
153 eglMakeCurrent(_VG_DISPLAY(), (canvas)->tgt, \
543a2a8523fb Make surce current VG context
Thinker K.F. Li <thinker@branda.to>
parents: 583
diff changeset
154 (canvas)->tgt, (canvas)->ctx); \
543a2a8523fb Make surce current VG context
Thinker K.F. Li <thinker@branda.to>
parents: 583
diff changeset
155 } \
543a2a8523fb Make surce current VG context
Thinker K.F. Li <thinker@branda.to>
parents: 583
diff changeset
156 } while(0)
595
aaaaa03af04d Set VGPaint for canvas
Thinker K.F. Li <thinker@branda.to>
parents: 593
diff changeset
157 #define _MK_CURRENT_PAINT(canvas) \
aaaaa03af04d Set VGPaint for canvas
Thinker K.F. Li <thinker@branda.to>
parents: 593
diff changeset
158 if((canvas)->paint_installed) \
aaaaa03af04d Set VGPaint for canvas
Thinker K.F. Li <thinker@branda.to>
parents: 593
diff changeset
159 vgSetPaint((canvas)->paint, VG_FILL_PATH|VG_STROKE_PATH)
583
ca57132020e4 Set transform matrix for VG contexts
Thinker K.F. Li <thinker@branda.to>
parents: 582
diff changeset
160
ca57132020e4 Set transform matrix for VG contexts
Thinker K.F. Li <thinker@branda.to>
parents: 582
diff changeset
161 static void
ca57132020e4 Set transform matrix for VG contexts
Thinker K.F. Li <thinker@branda.to>
parents: 582
diff changeset
162 mbe_transform(mbe_t *canvas, co_aix *mtx) {
ca57132020e4 Set transform matrix for VG contexts
Thinker K.F. Li <thinker@branda.to>
parents: 582
diff changeset
163 VGfloat vg_mtx[9];
ca57132020e4 Set transform matrix for VG contexts
Thinker K.F. Li <thinker@branda.to>
parents: 582
diff changeset
164
ca57132020e4 Set transform matrix for VG contexts
Thinker K.F. Li <thinker@branda.to>
parents: 582
diff changeset
165 _MK_CURRENT_CTX(canvas);
ca57132020e4 Set transform matrix for VG contexts
Thinker K.F. Li <thinker@branda.to>
parents: 582
diff changeset
166 MB_MATRIX_2_OPENVG(vg_mtx, mtx);
ca57132020e4 Set transform matrix for VG contexts
Thinker K.F. Li <thinker@branda.to>
parents: 582
diff changeset
167 vgLoadMatrix(vg_mtx);
ca57132020e4 Set transform matrix for VG contexts
Thinker K.F. Li <thinker@branda.to>
parents: 582
diff changeset
168 }
ca57132020e4 Set transform matrix for VG contexts
Thinker K.F. Li <thinker@branda.to>
parents: 582
diff changeset
169
582
dd546c4da180 deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents: 580
diff changeset
170 #define EGL_GLX 1
dd546c4da180 deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents: 580
diff changeset
171 #ifdef EGL_GLX
dd546c4da180 deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents: 580
diff changeset
172 #include <X11/Xlib.h>
dd546c4da180 deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents: 580
diff changeset
173 #include <X11/Xutil.h>
dd546c4da180 deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents: 580
diff changeset
174
589
d733e198bb25 Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents: 588
diff changeset
175 extern mbe_surface_t *mbe_vg_win_surface_create(Display *display,
d733e198bb25 Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents: 588
diff changeset
176 Drawable drawable,
d733e198bb25 Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents: 588
diff changeset
177 Visual *visual,
d733e198bb25 Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents: 588
diff changeset
178 int width, int height);
582
dd546c4da180 deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents: 580
diff changeset
179 #endif
dd546c4da180 deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents: 580
diff changeset
180
589
d733e198bb25 Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents: 588
diff changeset
181 extern mbe_surface_t *mbe_image_surface_create(mb_img_fmt_t fmt,
d733e198bb25 Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents: 588
diff changeset
182 int w, int h);
582
dd546c4da180 deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents: 580
diff changeset
183
dd546c4da180 deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents: 580
diff changeset
184 static void
dd546c4da180 deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents: 580
diff changeset
185 mbe_surface_destroy(mbe_surface_t *surface) {
dd546c4da180 deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents: 580
diff changeset
186 EGLDisplay display;
dd546c4da180 deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents: 580
diff changeset
187
dd546c4da180 deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents: 580
diff changeset
188 display = _VG_DISPLAY();
dd546c4da180 deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents: 580
diff changeset
189 eglDestroySurface(display, surface->surface);
dd546c4da180 deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents: 580
diff changeset
190
dd546c4da180 deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents: 580
diff changeset
191 if(surface->asso_mbe)
dd546c4da180 deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents: 580
diff changeset
192 surface->asso_mbe->tgt = NULL;
603
39d27911c3ae Remove mbe_image_surface_create_for_data()
Thinker K.F. Li <thinker@branda.to>
parents: 602
diff changeset
193
39d27911c3ae Remove mbe_image_surface_create_for_data()
Thinker K.F. Li <thinker@branda.to>
parents: 602
diff changeset
194 if(surface->asso_img)
39d27911c3ae Remove mbe_image_surface_create_for_data()
Thinker K.F. Li <thinker@branda.to>
parents: 602
diff changeset
195 surface->asso_img->asso_surface = NULL;
582
dd546c4da180 deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents: 580
diff changeset
196
dd546c4da180 deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents: 580
diff changeset
197 free(surface);
dd546c4da180 deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents: 580
diff changeset
198 }
dd546c4da180 deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents: 580
diff changeset
199
589
d733e198bb25 Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents: 588
diff changeset
200 extern mbe_t *mbe_create(mbe_surface_t *surface);
590
b714f0c9992e include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents: 589
diff changeset
201 extern void mbe_destroy(mbe_t *canvas);
595
aaaaa03af04d Set VGPaint for canvas
Thinker K.F. Li <thinker@branda.to>
parents: 593
diff changeset
202 extern void mbe_paint(mbe_t *canvas);
597
3300992b29ff Define mbe_clear() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 595
diff changeset
203 extern void mbe_clear(mbe_t *canvas);
595
aaaaa03af04d Set VGPaint for canvas
Thinker K.F. Li <thinker@branda.to>
parents: 593
diff changeset
204
593
ac942664fe86 stroke and fill for VG
Thinker K.F. Li <thinker@branda.to>
parents: 592
diff changeset
205 static void
ac942664fe86 stroke and fill for VG
Thinker K.F. Li <thinker@branda.to>
parents: 592
diff changeset
206 mbe_stroke(mbe_t *canvas) {
ac942664fe86 stroke and fill for VG
Thinker K.F. Li <thinker@branda.to>
parents: 592
diff changeset
207 _MK_CURRENT_CTX(canvas);
595
aaaaa03af04d Set VGPaint for canvas
Thinker K.F. Li <thinker@branda.to>
parents: 593
diff changeset
208 _MK_CURRENT_PAINT(canvas);
593
ac942664fe86 stroke and fill for VG
Thinker K.F. Li <thinker@branda.to>
parents: 592
diff changeset
209
ac942664fe86 stroke and fill for VG
Thinker K.F. Li <thinker@branda.to>
parents: 592
diff changeset
210 vgDrawPath(canvas->path, VG_STROKE_PATH);
ac942664fe86 stroke and fill for VG
Thinker K.F. Li <thinker@branda.to>
parents: 592
diff changeset
211 vgClearPath(canvas->path, VG_PATH_CAPABILITY_ALL);
ac942664fe86 stroke and fill for VG
Thinker K.F. Li <thinker@branda.to>
parents: 592
diff changeset
212 }
ac942664fe86 stroke and fill for VG
Thinker K.F. Li <thinker@branda.to>
parents: 592
diff changeset
213
ac942664fe86 stroke and fill for VG
Thinker K.F. Li <thinker@branda.to>
parents: 592
diff changeset
214 static void
ac942664fe86 stroke and fill for VG
Thinker K.F. Li <thinker@branda.to>
parents: 592
diff changeset
215 mbe_fill(mbe_t *canvas) {
ac942664fe86 stroke and fill for VG
Thinker K.F. Li <thinker@branda.to>
parents: 592
diff changeset
216 _MK_CURRENT_CTX(canvas);
595
aaaaa03af04d Set VGPaint for canvas
Thinker K.F. Li <thinker@branda.to>
parents: 593
diff changeset
217 _MK_CURRENT_PAINT(canvas);
593
ac942664fe86 stroke and fill for VG
Thinker K.F. Li <thinker@branda.to>
parents: 592
diff changeset
218
ac942664fe86 stroke and fill for VG
Thinker K.F. Li <thinker@branda.to>
parents: 592
diff changeset
219 vgDrawPath(canvas->path, VG_FILL_PATH);
ac942664fe86 stroke and fill for VG
Thinker K.F. Li <thinker@branda.to>
parents: 592
diff changeset
220 vgClearPath(canvas->path, VG_PATH_CAPABILITY_ALL);
ac942664fe86 stroke and fill for VG
Thinker K.F. Li <thinker@branda.to>
parents: 592
diff changeset
221 }
578
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
222
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
223 /* @} */
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
224
fd5f5d9e00d2 A dummy graphic engine for OpenVG.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
225 #endif /* __MB_GE_OPENVG_H_ */