[cairo] drawing inconsistency
bertram.felgenhauer at googlemail.com
Mon Jan 21 06:37:41 PST 2008
Adi Oanca wrote:
> > There are a few ways to fix this:
> > - use a line width of 2 (which is, incidentally, cairo's default).
> AFAIR it gives the same result, only that the line is thicker at
> the left/bottom side.
When I run the program with line width 2, I see a rectangle with a
thicker, white border. When the rectangle is filled later (in red),
the fill paints over the inner half of said border, and only a 1 pixel
> > I can't reproduce that. Did you add the cairo_set_line_width(cr, 1)
> > line after testing that, perhaps?
> In the code snippet I gave, cairo_set_line_width(cr, 1) is present.
> To reproduce:
> 1) - take the code from the first mail, add
> cairo_surface_write_to_png(cairoSurface, "image2.png");
> right before
> => check image2.png and see the inconsistency.
> 2) let cairo_surface_write_to_png(cairoSurface, "image2.png");
> to be where it was pointed at 1)
> then replace:
> cairoSurface = cairo_image_surface_create_for_data(
> (unsigned char*)screen->pixels,
> cairoSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 640, 480);
> => check the image and see that the result is correct (the rectangle
> is properly shown/visible)
Not for me, I get the same result as in 1). (Using cairo 1.4.12 on
linux. The git version produces the same result.)
> So, this is why I'm puzzled. If I provide a pre-allocated drawing
> buffer, Cairo won't draw properly, but if I tell it to allocate the
> drawing buffer, the result is just fine.
You are probably hitting some bug (although I have no clue where that
bug could be). But in any case, the behaviour in case 1) is the correct
one, even if it is not what you expected.
More information about the cairo