[cairo] Observations from a newb

Dirk Schönberger dirk.schoenberger at sz-online.de
Thu Nov 8 11:28:05 PST 2007


First of all thanks for your help. Sorry if I am a little picky ;)

> So, the answer to your question above on how to render a transformed
> surface might look like this:

>  void
>  draw_transformed_surface (cairo_t *cr,
>      cairo_matrix_t *matrix,
>      cairo_surface_t *surface)
> {
>     cairo_save (cr);
>
>     cairo_transform (cr, matrix);
>     cairo_set_source_surface (cr, surface, 0.0, 0.0);
>     cairo_paint (cr);
>
>     cairo_restore (cr);
>  }
>
> After setting up a source pattern based on the given surface, we use a
> "paint" operation to paint the entire surface.

> And notice that "draw an image" is not a primitive at all. You can use
> the same set_source_surface to then fill or stroke an arbitrary path
> with the contents of an image, or you can fill text with image
> contents. (And where I'm saying "image" here, you can use any type of
> surface or any other type of pattern as well---such as gradients).

Ok. But what if I want to transform just the image data, not the
coordinates.
Basically I would like to draw the image at (10,10) in user coordinates
(i.e. without further transformations), but the image itself should be
rendered with a scale factor of (.5, .5)
I think basically I would like to see more operations about image surfaces
(transformations, filtering, bitmap level operations like darken, edge
detection, gaussian blur, drop shadows etc)


Regards
Dirk





More information about the cairo mailing list