<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
<blockquote
cite="mid:mailman.43.1185390015.4824.cairo@cairographics.org"
type="cite">
<blockquote type="cite">
<pre wrap=""><span class="moz-txt-citetags">> </span>Hi
<span class="moz-txt-citetags">> </span>I'm trying to use gtk printing in my app. It uses cairo to draw.
<span class="moz-txt-citetags">> </span>I'd like to fill paths with different hatches. I'm using the code
<span class="moz-txt-citetags">> </span>below to create a little part of the hatch and to repeat it to fill
<span class="moz-txt-citetags">> </span>the path.
<span class="moz-txt-citetags">> </span>The problem is that when I do it, there's a little space (a thin
<span class="moz-txt-citetags">> </span>and transparent line) between each repeat. For example, if I want
<span class="moz-txt-citetags">> </span>to repeat a completely black square (see the code below), it gives
<span class="moz-txt-citetags">> </span>me this result : <a
class="moz-txt-link-freetext"
href="http://img96.imageshack.us/img96/8747/">http://img96.imageshack.us/img96/8747/</a>
<span class="moz-txt-citetags">> </span>cairopblmcw6.png
<span class="moz-txt-citetags">> </span>I expected it to draw a completely black area. If I draw a line or
<span class="moz-txt-citetags">> </span>anything else instead of a black square, I get the same type of
<span class="moz-txt-citetags">> </span>result.
<span class="moz-txt-citetags">> </span>This result is displayed in the preview window of gtk printing (in
<span class="moz-txt-citetags">> </span>fact in evince).
<span class="moz-txt-citetags">> </span>Is there any way to suppress this line ?
<span class="moz-txt-citetags">> </span>Thanks.
<span class="moz-txt-citetags">></span>
<span class="moz-txt-citetags">> </span>The code :
<span class="moz-txt-citetags">></span>
<span class="moz-txt-citetags">> </span>cairo_t * cr;
<span class="moz-txt-citetags">> </span>cairo_surface_t *surface;
<span class="moz-txt-citetags">> </span>surface = cairo_surface_create_similar(cairo_get_target
<span class="moz-txt-citetags">> </span>(m_cairo),CAIRO_CONTENT_COLOR_ALPHA,5,5);
<span class="moz-txt-citetags">> </span>cr = cairo_create(surface);
<span class="moz-txt-citetags">> </span>cairo_set_line_cap(cr, CAIRO_LINE_CAP_SQUARE);
<span class="moz-txt-citetags">> </span>cairo_set_line_width(cr, 1);
<span class="moz-txt-citetags">> </span>cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
<span class="moz-txt-citetags">> </span>cairo_set_source_rgba(cr, redPS, greenPS, bluePS, alphaPS); //these
<span class="moz-txt-citetags">> </span>values give black color
<span class="moz-txt-citetags">> </span>cairo_paint(cr);
<span class="moz-txt-citetags">> </span>cairo_stroke (cr);
<span class="moz-txt-citetags">> </span>cairo_destroy(cr);
<span class="moz-txt-citetags">> </span>cairo_pattern_t * pattern = cairo_pattern_create_for_surface
<span class="moz-txt-citetags">> </span>(surface);
<span class="moz-txt-citetags">> </span>cairo_surface_destroy(surface);
<span class="moz-txt-citetags">> </span>cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
<span class="moz-txt-citetags">> </span>cairo_set_source(m_cairo, pattern);
<span class="moz-txt-citetags">> </span>//here i create a path in another cairo context (m_cairo)
<span class="moz-txt-citetags">> </span>//and i fill it with the pattern:
<span class="moz-txt-citetags">> </span>cairo_fill( m_cairo );
<span class="moz-txt-citetags">></span>
</pre>
</blockquote>
<!---->I just replicated this code (I used a simple rectangle for the
path), using the VW/ST binding for Cairo running on Quartz. It looks
fine. So that'd point at possible X issues, rather than Cairo issues?</blockquote>
<blockquote
cite="mid:mailman.43.1185390015.4824.cairo@cairographics.org"
type="cite">Couple thoughts. You don't need the cairo_stroke, or even
the linewidth/cap, since you're using paint which fills the whole clip
area.</blockquote>
You're right. I leave it there since my first version of this code was
drawing a line instead of using paint.<br>
<blockquote
cite="mid:mailman.43.1185390015.4824.cairo@cairographics.org"
type="cite">What happens if you turn ANTIALIAS back on? I would guess
most/many of the Cairo cases leave AA on, so you may be in an area that
doesn't get used much?</blockquote>
I've tried to turn it on and it doesn't change anything (maybe the
borders of the black squares are a little less sharp but I'm not even
sure).<br>
<blockquote
cite="mid:mailman.43.1185390015.4824.cairo@cairographics.org"
type="cite">--
Travis Griggs
Objologist
"I choose. Therefore, I Am"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <a class="moz-txt-link-freetext"
href="http://lists.cairographics.org/archives/cairo/attachments/20070724/0dcb9269/attachment.htm">http://lists.cairographics.org/archives/cairo/attachments/20070724/0dcb9269/attachment.htm</a>
------------------------------</blockquote>
</body>
</html>