[cairo] Problem with CAIRO_EXTEND_REPEAT

Behdad Esfahbod behdad at behdad.org
Tue Jul 24 20:01:40 EEST 2007

On Mon, 2007-07-23 at 07:57 -0400, Sikamikaniboots wrote:
> Hi
> I'm trying to use gtk printing in my app. It uses cairo to draw.
> I'd like to fill paths with different hatches. I'm using the code
> below to create a little part of the hatch and to repeat it to fill
> the path.
> The problem is that when I do it, there's a little space (a thin and
> transparent line) between each repeat. For example, if I want to
> repeat a completely black square (see the code below), it gives me
> this result : http://img96.imageshack.us/img96/8747/cairopblmcw6.png
> I expected it to draw a completely black area. If I draw a line or
> anything else instead of a black square, I get the same type of
> result.
> This result is displayed in the preview window of gtk printing (in
> fact in evince).
> Is there any way to suppress this line ?
> Thanks.

Carl and I hit the same bug the other day (again, when preparing our
slides).  Someone should debug it to see if it's a cairo or an X server


> The code :
> cairo_t * cr;
> cairo_surface_t *surface;
> surface =
> cairo_surface_create_similar(cairo_get_target(m_cairo),CAIRO_CONTENT_COLOR_ALPHA,5,5);
> cr = cairo_create(surface);
> cairo_set_line_cap(cr, CAIRO_LINE_CAP_SQUARE);
> cairo_set_line_width(cr, 1);
> cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
> cairo_set_source_rgba(cr, redPS, greenPS, bluePS, alphaPS); //these
> values give black color
> cairo_paint(cr);
> cairo_stroke (cr);
> cairo_destroy(cr);
> cairo_pattern_t * pattern = cairo_pattern_create_for_surface
> (surface);
> cairo_surface_destroy(surface);
> cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
> cairo_set_source(m_cairo, pattern);
> //here i create a path in another cairo context (m_cairo)
> //and i fill it with the pattern:
> cairo_fill( m_cairo );
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759

More information about the cairo mailing list