comparison src/graph_engine_cairo.c @ 602:ac2e6468a22a openvg

Replace mbe_image_surface_create_from_png() with mbe_pattern_create_image()
author Thinker K.F. Li <thinker@branda.to>
date Fri, 02 Jul 2010 13:42:22 +0800
parents b42d69ab8857
children 7b4e80ab671a
comparison
equal deleted inserted replaced
601:8863d23cea4b 602:ac2e6468a22a
151 } 151 }
152 152
153 return ptn; 153 return ptn;
154 } 154 }
155 155
156 mbe_pattern_t *
157 mbe_pattern_create_image(mb_img_data_t *img) {
158 cairo_surface_t *surf;
159 cairo_pattern_t *ptn;
160 cairo_format_t fmt;
161
162 switch(img->fmt) {
163 case MB_IFMT_ARGB32:
164 fmt = CAIRO_FORMAT_ARGB32;
165 break;
166
167 case MB_IFMT_RGB24:
168 fmt = CAIRO_FORMAT_RGB24;
169 break;
170
171 case MB_IFMT_A8:
172 fmt = CAIRO_FORMAT_A8;
173 break;
174
175 case MB_IFMT_A1:
176 fmt = CAIRO_FORMAT_A1;
177 break;
178
179 case MB_IFMT_RGB16_565:
180 fmt = CAIRO_FORMAT_RGB16_565;
181 break;
182
183 default:
184 return NULL;
185 }
186
187 surf = cairo_image_surface_create_for_data(img->content, fmt,
188 img->w, img->h, img->stride);
189 ptn = cairo_pattern_create_for_surface(surf);
190 cairo_surface_destroy(surf);
191
192 return ptn;
193 }
194
156 void 195 void
157 mbe_scissoring(mbe_t *canvas, int n_areas, area_t **areas) { 196 mbe_scissoring(mbe_t *canvas, int n_areas, area_t **areas) {
158 area_t *area; 197 area_t *area;
159 int i; 198 int i;
160 199