comparison include/mb_graph_engine_skia.h @ 469:4dc0be6c044a Android_Skia

Add copy and clear graphic engine functions. To replace set/get options, copy and clear is more meanful, functional, and independently. set/get options are too graphic engine dependently.
author Thinker K.F. Li <thinker@branda.to>
date Thu, 12 Nov 2009 21:30:35 +0800
parents d8181696b689
children e54cd19cec28
comparison
equal deleted inserted replaced
468:ae784a86ba82 469:4dc0be6c044a
9 */ 9 */
10 #define MBE_OPERATOR_CLEAR CAIRO_OPERATOR_CLEAR 10 #define MBE_OPERATOR_CLEAR CAIRO_OPERATOR_CLEAR
11 #define MBE_OPERATOR_SOURCE CAIRO_OPERATOR_SOURCE 11 #define MBE_OPERATOR_SOURCE CAIRO_OPERATOR_SOURCE
12 #define MBE_STATUS_SUCCESS CAIRO_STATUS_SUCCESS 12 #define MBE_STATUS_SUCCESS CAIRO_STATUS_SUCCESS
13 13
14 #define mbe_ft_font_face_create_for_pattern
15 #define mbe_image_surface_create_from_png 14 #define mbe_image_surface_create_from_png
16 #define mbe_pattern_add_color_stop_rgba 15 #define mbe_pattern_add_color_stop_rgba
17 #define mbe_pattern_create_for_surface 16 #define mbe_pattern_create_for_surface
18 #define mbe_scaled_font_text_extents 17 #define mbe_scaled_font_text_extents
19 #define mbe_image_surface_get_stride 18 #define mbe_image_surface_get_stride
21 #define mbe_image_surface_get_width 20 #define mbe_image_surface_get_width
22 #define mbe_image_surface_get_data 21 #define mbe_image_surface_get_data
23 #define mbe_scaled_font_reference 22 #define mbe_scaled_font_reference
24 #define mbe_pattern_create_radial 23 #define mbe_pattern_create_radial
25 #define mbe_pattern_create_linear 24 #define mbe_pattern_create_linear
26 #define mbe_xlib_surface_create
27 #define mbe_scaled_font_destroy 25 #define mbe_scaled_font_destroy
28 #define mbe_font_face_reference 26 #define mbe_font_face_reference
29 #define mbe_set_source_surface 27 #define mbe_set_source_surface
30 #define mbe_scaled_font_status 28 #define mbe_scaled_font_status
31 #define mbe_scaled_font_create 29 #define mbe_scaled_font_create
40 #define mbe_get_scaled_font 38 #define mbe_get_scaled_font
41 #define mbe_set_source_rgb 39 #define mbe_set_source_rgb
42 #define mbe_set_line_width 40 #define mbe_set_line_width
43 #define mbe_get_font_face 41 #define mbe_get_font_face
44 #define mbe_fill_preserve 42 #define mbe_fill_preserve
45 #define mbe_set_operator
46 #define mbe_get_operator
47 #define mbe_set_source 43 #define mbe_set_source
48 #define mbe_reset_clip 44 #define mbe_reset_clip
49 #define mbe_get_target 45 #define mbe_get_target
50 #define mbe_close_path 46 #define mbe_close_path
51 #define mbe_text_path 47 #define mbe_text_path
52 #define mbe_show_text
53 #define mbe_rectangle 48 #define mbe_rectangle
54 #define mbe_in_stroke 49 #define mbe_in_stroke
55 #define mbe_new_path 50 #define mbe_new_path
56 #define mbe_curve_to 51 #define mbe_curve_to
57 #define mbe_restore 52 #define mbe_restore
67 #define mbe_clip 62 #define mbe_clip
68 63
69 typedef cairo_text_extents_t mbe_text_extents_t; 64 typedef cairo_text_extents_t mbe_text_extents_t;
70 typedef cairo_scaled_font_t mbe_scaled_font_t; 65 typedef cairo_scaled_font_t mbe_scaled_font_t;
71 typedef cairo_font_face_t mbe_font_face_t; 66 typedef cairo_font_face_t mbe_font_face_t;
72 typedef cairo_operator_t mbe_operator_t;
73 typedef cairo_surface_t mbe_surface_t; 67 typedef cairo_surface_t mbe_surface_t;
74 typedef cairo_pattern_t mbe_pattern_t; 68 typedef cairo_pattern_t mbe_pattern_t;
75 typedef cairo_status_t mbe_status_t; 69 typedef cairo_status_t mbe_status_t;
76 typedef cairo_matrix_t mbe_matrix_t; 70 typedef cairo_matrix_t mbe_matrix_t;
77 typedef cairo_t mbe_t; 71 typedef cairo_t mbe_t;
78 typedef float co_aix; 72 typedef float co_aix;
79 73
80 extern mbe_font_face_t * mbe_query_font_face(const char *family, 74 extern mbe_font_face_t * mbe_query_font_face(const char *family,
81 int slant, int weight); 75 int slant, int weight);
82 extern void mbe_free_font_face(mbe_font_face_t *face); 76 extern void mbe_free_font_face(mbe_font_face_t *face);
77
78 static void mbe_clear(mbe_t *canvas) {
79 cairo_operator_t old_op;
80
81 old_op = mbe_get_operator(canvas);
82 mbe_set_operator(canvas, MBE_OPERATOR_CLEAR);
83 mbe_paint(canvas);
84 mbe_set_operator(canvas, old_op);
85 }
86
87 static void mbe_copy_source(mbe_t *canvas) {
88 mbe_operator_t saved_op;
89
90 saved_op = mbe_get_operator(canvas);
91 mbe_set_operator(canvas, MBE_OPERATOR_SOURCE);
92 mbe_paint(canvas);
93 mbe_set_operator(canvas, saved_op);
94 }
83 95
84 static mbe_surface_t * 96 static mbe_surface_t *
85 mbe_image_surface_create_for_data(unsigned char *data, 97 mbe_image_surface_create_for_data(unsigned char *data,
86 mb_img_fmt_t fmt, 98 mb_img_fmt_t fmt,
87 int width, int height, 99 int width, int height,