[cairo] Transform update?

Maarten Bosmans mkbosmans at gmail.com
Mon Nov 28 00:19:45 PST 2011


2011/11/27 Blagoj Kupev <bkupev at gmail.com>:
> Hello
> I'm now in cairo and this might be already answered, but...
>
> I'd like to create a image that will be then modified by translation using a
> functionality similar to the cairo_transform function where i'd like to
> define cairo_matrix_t for each pixel. The final idea is to modify the image
> that will be projected to a white ball and after reflection it will be a
> symmetric image.

This sounds like you want arbitrary transformation. Currently Cairo
only supports affine transformations of a surface.

> I thought that i can do this using cairo_user_to_device function, but
> without any success. First, I'm not sure what is the usage of this function,
> so can anyone help me with the answers to the following questions:
> 1. How to set different cairo_matrix_t for each pixel during the
> translation, the CTM is one for complete image.

not possible

> 2. What is the purpose of cairo_to_device function?

Do you mean the cairo_user_to_device function?
That one just transforms a coordinate pair with the current
transformation matrix.

> If there's no functionality to define translation using different matrix for
> each pixel, i'd like to add this functionality in cairo...
>
> So, after i compile the cairo and make new libraries what to do to use them?
> I've succeeded in building the libraries and installing them (i can see new
> library files are copied to /usr/local/lib and other places), but i'm not
> sure if they are really used since modification do not seem to be used in
> the new application.
>
> The procedure that i'm doing is:
> - modify the cairo_translate function by adding while(1) or other line to
> see if it affects the library.
> - the code is compiled (i know this since if i put invalid line, error is
> reported)
> - sudo make install, to install the libraries
> - i'm recompiling the application that is calling cairo_translate function,
> but the new code is not executed. I'm using the following line to compile
> the application:
> gcc -o transform transform.c `pkg-config --libs --cflags gtk+-2.0`
>
> What should i do to have new library used? How to debug code in libraries?

You should link against the cairo lib you just installed (probably in
/usr/local). You can see by checking the output of pkg-config --libs
--cflags gtk+-2.0 that it only picks up your distributions cairo. To
make sure pkg-config knows about your own version, set
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig or something similar.

Maarten


More information about the cairo mailing list