[cairo] Transparency troubles with PNGs on Windows

Brad Elliott brad_e at hotmail.com
Mon Mar 12 12:19:49 PDT 2007


Hi Owen,

Now that I know what is wrong I fixed the issue by using the right version of libcairo2.dll. I thought I was using version 1.4.0 but it turns out I had an older version of libcairo2.dll first in my path because I installed the GIMP ages ago and it required GTK. It was picking up that version of the DLL instead of the correct one. Now that I'm using the correct DLL the surface is being cleared on initialization. I guess that points out the obvious fact that I should be checking the cairo version in my code.

Thanks a lot for the help. I appreciate it.

Brad

----------------------------------------
> Subject: Re: [cairo] Transparency troubles with PNGs on Windows
> From: otaylor at redhat.com
> To: brad_e at hotmail.com
> CC: cairo at cairographics.org
> Date: Mon, 12 Mar 2007 08:59:50 -0400
> 
> It's really very simple here ... an image surface isn't cleared
> or initialized in any way 
> 
> 
> > 
> > The following is an example demonstrating this problem on Cairo 1.4.0.
> > When I make the second call to draw() the contents of the original
> > surface are left around in the second image (red rectangle).  Am I
> > doing something wrong in tearing down the surface/cairo object? It
> > works fine under Linux but not under Win32 (Visual Studio .Net 2003
> > under XP) using the library provided by Tor.
> > 
> > Incorrect output on Windows:
> >     http://bradford.elliott.googlepages.com/one_windows.png
> >     http://bradford.elliott.googlepages.com/two_windows.png (red
> > rectangle is left around from one_windows.png)
> > 
> > Correct output on Linux:
> >     http://bradford.elliott.googlepages.com/one_linux.png
> >     http://bradford.elliott.googlepages.com/two_linux.png (no red
> > rectangle which is what I expect)
> > 
> > Can anyone tell me what I'm doing wrong? Any help would be
> > appreciated.
> > 
> > Thanks,
> > 
> > Here is a short snippet demonstrating the problem:
> > 
> >    #include 
> >    
> >    void draw(const char* output_file, int x, int y)
> >    {
> >       cairo_t*         image;
> >       cairo_surface_t* surface;
> >       int              width  = 126; 
> >       int              height = 24;
> >     
> >       surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width,
> > height);
> >       image = cairo_create(surface);
> >     
> >       cairo_rectangle(image, x, y, 20, 20);
> >       cairo_set_source_rgba(image, 0,0,0,1);
> >       cairo_fill(image);
> >     
> >       cairo_surface_write_to_png(surface, output_file);
> >       cairo_surface_destroy(surface);
> >       cairo_destroy(image);
> >    }
> > 
> >    int main(void) 
> >    {
> >       draw("one.png", 0, 0);
> >       draw("two.png", 10, 10);
> >    }
> > 
> > 
> > 
> > 
> > ______________________________________________________________________
> > Explore the seven wonders of the world Learn more!
> > _______________________________________________
> > cairo mailing list
> > cairo at cairographics.org
> > http://cairographics.org/cgi-bin/mailman/listinfo/cairo
> 

_________________________________________________________________
Discover the new Windows Vista
http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE


More information about the cairo mailing list