move around - flatter.
[profile/ivi/evas.git] / src / lib / include / evas_cairo_common.h
1 #ifndef EVAS_CAIRO_COMMON_H
2 #define EVAS_CAIRO_COMMON_H
3
4 #include "evas_common.h"
5 #include "config.h"
6
7 #include <stdio.h>
8 #include <unistd.h>
9 #include <stdlib.h>
10 #include <string.h>
11 #include <math.h>
12 #include <sys/time.h>
13 #include <unistd.h>
14
15 #include <X11/Xlib.h>
16 #include <X11/Xatom.h>
17 #include <X11/Xutil.h>
18
19 #include <cairo.h>
20 #include <cairo-xlib.h>
21
22 typedef struct _Evas_Cairo_Context                   Evas_Cairo_Context;
23 typedef struct _Evas_Cairo_Image                     Evas_Cairo_Image;
24 typedef struct _Evas_Cairo_Polygon                   Evas_Cairo_Polygon;
25 typedef struct _Evas_Cairo_Polygon_Point             Evas_Cairo_Polygon_Point;
26 typedef struct _Evas_Cairo_Gradient                  Evas_Cairo_Gradient;
27
28 struct _Evas_Cairo_Context
29 {
30    cairo_t         *cairo;
31
32    struct {
33       double r, g, b, a;
34    } col;
35    struct {
36       unsigned int set : 1;
37       double r, g, b, a;
38    } mul;
39 };
40
41 struct _Evas_Cairo_Image
42 {
43    RGBA_Image         *im;
44    int                 references;
45    DATA32             *mulpix;
46    cairo_surface_t    *surface;
47    cairo_pattern_t    *pattern;
48 #if 0
49    Evas_Cairo_Context *cc;
50    char                dirty : 1;
51    char                cached : 1;
52 #endif
53 };
54
55 struct _Evas_Cairo_Polygon
56 {
57    Evas_List *points;
58 };
59
60 struct _Evas_Cairo_Polygon_Point
61 {
62    int x, y;
63 };
64
65 #if 0
66 struct _Evas_Cairo_Context
67 {
68    unsigned char   r, g, b, a;
69
70    struct {
71       char         size : 1;
72       char         dither : 1;
73       char         blend : 1;
74       char         color : 1;
75       char         texture : 1;
76       char         clip : 1;
77       char         buf : 1;
78       char         other : 1;
79    } change;
80
81    struct {
82       char         active : 1;
83       int          x, y, w, h;
84    } clip;
85
86    struct {
87       int checked : 1;
88       int sgis_generate_mipmap : 1;
89       int nv_texture_rectangle : 1;
90    } ext;
91
92    int             references;
93
94    Evas_List      *images;
95 };
96
97 struct _Evas_Cairo_Image
98 {
99    Evas_Cairo_Context *cc;
100    RGBA_Image         *im;
101    cairo_surface_t    *surf;
102    DATA32             *mulpix;
103    int                 references;
104    char                dirty : 1;
105    char                cached : 1;
106 };
107
108 struct _Evas_Cairo_Polygon
109 {
110    Evas_List *points;
111 };
112
113 struct _Evas_Cairo_Polygon_Point
114 {
115    int x, y;
116 };
117
118 struct _Evas_Cairo_Gradient
119 {
120    RGBA_Gradient   *grad;
121 };
122 #endif
123
124 /*
125 Evas_GL_Context  *evas_gl_common_context_new(void);
126 void              evas_gl_common_context_free(Evas_GL_Context *gc);
127 void              evas_gl_common_context_use(Evas_GL_Context *gc);
128 void              evas_gl_common_context_resize(Evas_GL_Context *gc, int w, int h);
129 void              evas_gl_common_context_color_set(Evas_GL_Context *gc, int r, int g, int b, int a);
130 void              evas_gl_common_context_blend_set(Evas_GL_Context *gc, int blend);
131 void              evas_gl_common_context_dither_set(Evas_GL_Context *gc, int dither);
132 void              evas_gl_common_context_texture_set(Evas_GL_Context *gc, Evas_GL_Texture *tex, int smooth, int w, int h);
133 void              evas_gl_common_context_font_texture_set(Evas_GL_Context *gc, Evas_GL_Font_Texture *ft);
134 void              evas_gl_common_context_clip_set(Evas_GL_Context *gc, int on, int x, int y, int w, int h);
135 void              evas_gl_common_context_read_buf_set(Evas_GL_Context *gc, GLenum buf);
136 void              evas_gl_common_context_write_buf_set(Evas_GL_Context *gc, GLenum buf);
137
138 Evas_GL_Texture  *evas_gl_common_texture_new(Evas_GL_Context *gc, RGBA_Image *im, int smooth);
139 void              evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im, int smooth);
140 void              evas_gl_common_texture_free(Evas_GL_Texture *tex);
141 void              evas_gl_common_texture_mipmaps_build(Evas_GL_Texture *tex, RGBA_Image *im, int smooth);
142
143 Evas_GL_Image    *evas_gl_common_image_load(Evas_GL_Context *gc, char *file, char *key);
144 Evas_GL_Image    *evas_gl_common_image_new_from_data(Evas_GL_Context *gc, int w, int h, int *data);
145 Evas_GL_Image    *evas_gl_common_image_new_from_copied_data(Evas_GL_Context *gc, int w, int h, int *data);
146 Evas_GL_Image    *evas_gl_common_image_new(Evas_GL_Context *gc, int w, int h);
147 void              evas_gl_common_image_free(Evas_GL_Image *im);
148 void              evas_gl_common_image_dirty(Evas_GL_Image *im);
149
150 Evas_GL_Polygon  *evas_gl_common_poly_point_add(Evas_GL_Polygon *poly, int x, int y);
151 Evas_GL_Polygon  *evas_gl_common_poly_points_clear(Evas_GL_Polygon *poly);
152
153 Evas_GL_Gradient *evas_gl_common_gradient_color_add(Evas_GL_Gradient *gr, int r, int g, int b, int a, int distance);
154 Evas_GL_Gradient *evas_gl_common_gradient_colors_clear(Evas_GL_Gradient *gr);
155
156 void              evas_gl_common_swap_rect(Evas_GL_Context *gc, int x, int y, int w, int h);
157
158 void              evas_gl_common_rect_draw(Evas_GL_Context *gc, RGBA_Draw_Context *dc, int x, int y, int w, int h);
159 void              evas_gl_common_image_draw(Evas_GL_Context *gc, RGBA_Draw_Context *dc, Evas_GL_Image *im, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int smooth);
160 void              evas_gl_common_line_draw(Evas_GL_Context *gc, RGBA_Draw_Context *dc, int x1, int y1, int x2, int y2);
161 void              evas_gl_common_poly_draw(Evas_GL_Context *gc, RGBA_Draw_Context *dc, Evas_GL_Polygon *poly);
162 void              evas_gl_common_gradient_draw(Evas_GL_Context *gc, RGBA_Draw_Context *dc, Evas_GL_Gradient *gr, int x, int y, int w, int h, double angle);
163
164 Evas_GL_Font_Texture *evas_gl_font_texture_new(Evas_GL_Context *gc, RGBA_Font_Glyph *fg);
165 void                  evas_gl_font_texture_free(Evas_GL_Font_Texture *ft);
166 void                  evas_gl_font_texture_draw(Evas_GL_Context *gc, void *surface, RGBA_Draw_Context *dc, RGBA_Font_Glyph *fg, int x, int y);
167 */
168
169 #endif