Mercurial > MadButterfly
comparison src/paint.c @ 265:b42ee279669e
Change function name and add comments.
- sh_image_set_geometry() to replace sh_image_set().
- page "Image and Image Loader".
- comments.
diff -r 1ed06481e9ea img/image_n_ldr.dia
Binary file img/image_n_ldr.dia has changed
diff -r 1ed06481e9ea img/image_n_ldr.png
Binary file img/image_n_ldr.png has changed
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Sat, 24 Jan 2009 15:09:03 +0800 |
parents | 29acbd8a0dd0 |
children | 43900cae1d49 |
comparison
equal
deleted
inserted
replaced
264:1ed06481e9ea | 265:b42ee279669e |
---|---|
243 | 243 |
244 return old_stops; | 244 return old_stops; |
245 } | 245 } |
246 | 246 |
247 | 247 |
248 /*! \brief Using an image as a paint. | |
249 * | |
250 * This type of paints fill/stroke shapes with an image. | |
251 */ | |
248 typedef struct _paint_image { | 252 typedef struct _paint_image { |
249 paint_t paint; | 253 paint_t paint; |
250 mb_img_data_t *img; | 254 mb_img_data_t *img; |
251 cairo_surface_t *surf; | 255 cairo_surface_t *surf; |
252 cairo_pattern_t *ptn; | 256 cairo_pattern_t *ptn; |
271 MB_IMG_DATA_FREE(img_data); | 275 MB_IMG_DATA_FREE(img_data); |
272 paint_destroy(&paint_img->paint); | 276 paint_destroy(&paint_img->paint); |
273 free(paint); | 277 free(paint); |
274 } | 278 } |
275 | 279 |
280 /*! \brief Create an image painter. | |
281 * | |
282 * Create a painter that fill/stroke shapes with an image. | |
283 */ | |
276 paint_t *rdman_paint_image_new(redraw_man_t *rdman, | 284 paint_t *rdman_paint_image_new(redraw_man_t *rdman, |
277 mb_img_data_t *img) { | 285 mb_img_data_t *img) { |
278 paint_image_t *paint; | 286 paint_image_t *paint; |
279 int fmt; | 287 int fmt; |
280 | 288 |
321 } | 329 } |
322 | 330 |
323 return (paint_t *)paint; | 331 return (paint_t *)paint; |
324 } | 332 } |
325 | 333 |
334 /*! \brief Setting transformation from user space to image space. | |
335 * | |
336 * This transformation matrix maps points drawed in user space to | |
337 * corresponding points in image space. It is used to resample | |
338 * the image to generate pixels of result image. | |
339 */ | |
326 void paint_image_set_matrix(paint_t *paint, co_aix matrix[6]) { | 340 void paint_image_set_matrix(paint_t *paint, co_aix matrix[6]) { |
327 paint_image_t *img_paint = (paint_image_t *)paint; | 341 paint_image_t *img_paint = (paint_image_t *)paint; |
328 cairo_matrix_t cmatrix; | 342 cairo_matrix_t cmatrix; |
329 | 343 |
330 cmatrix.xx = matrix[0]; | 344 cmatrix.xx = matrix[0]; |