[cairo] Compiling Cairo with MinGW under Win32

Jack Chen jacks_small_world at yahoo.com
Mon Nov 1 09:13:19 PST 2004


 --- Carl Worth <cworth at cworth.org> wrote: 

> 
> Or are you perhaps wanting to "vectorize" a bitmapped image? That is,
> create a vector-based description of an input image? If so, cairo
> doesn't have any code to help with this problem. But there are
> several
> free software projects that do address this problem. For example:
> 
> Command-line tools:
> 	autotrace - http://autotrace.sourceforge.net/
> 	potrace - http://potrace.sourceforge.net/
> 
> GUI frontends:
> 	delineate - http://delineate.sourceforge.net/
> 
> And the potrace page suggests that an upcoming release of inkscape
> may
> have built-in support for doing this kind of thing:
> 
> 	inkscape - http://www.inkscape.org/
> 
> Have fun.
> 
> -Carl
> 
>  

Hi, Carl, thank you. That's whay I wanted.

I do have some questions though. 

1.) Suppose I create a bmp, a square, and apply a gradient to fill
it.If I save the file and load it, will the above programs you
mentioned be able to interpret the bmp as a vector format with the same
simplicity as when I construct them with Cairo? Something like, in
Cairo I create 4 points for the square, then specify the color for each
point, then fill it. So basically when I save the vector file I only
need about 20 integer variables for a square...very convenient! But are
the above programs' convertion algorithms able to convert a huge bmp to
20 integers? That's what I am most curious about, and sorry if I have
misunderstood something because I'm not very familiar with Cairo's API
yet.

2.) With question #1 there comes another question. How exactly does
Cairo structure a gradient? Do I just specify a color at each point of
a shape and let Cairo's internal rendering engine do all the work for
me (like OpenGL), or is there something more to it?

3.) Is Cairo able to do radial gradients? If so, can you please tell me
how? I read the tutorial by Keith Packard but couldn't find information
on that topic. libsvg has radial gradient capabilities, though.

4.) Is Cairo's gradient calculated linearly? That is, does the color
fall/increase arithmatically sequencially from one point to another? If
I want to represent the colors of a flat surface illuminated from a
point-light source, I know that the color of each point on the surface
is the full intensity of the light times the sin() of the angle from
the surface to the light source, and a gradient made with sin(x) (x is
a arithmatic sequance but sin(x) is not), cannot be arithmatic and
hence the gradient created by Cairo cannot be that realistic, and
conversely if I want to convert a bmp composed of a sin(x)'s gradient,
the output vector format won't be that simple as something less than 10
variables.

5.) A side question. OpenGL uses a surface normal to create a gradient
for a surface if the scene uses a light, but when OpenGL calculates the
colors falling from one point to another, is the change an arithmatic
sequence or is it a sin() function?

Oh and, why don't you post this webpage on your website

http://cairographics.org/cairo/win32

After I posted my original question all the replies made me think
compiling Cairo with MingGW was so hard, until I did a google search
and found that webpage, and figured that all I have to do is download
the file and convert the .lib to .a, which is documented with MinGW,
and then I have a MinGW port in 2 minutes! Jesus!

Thanks for your help! autotrace is REALLY COOL!

Jack

______________________________________________________________________ 
Post your free ad now! http://personals.yahoo.ca



More information about the cairo mailing list