<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
Hi, <div><br class="webkit-block-placeholder"></div><div>We've isolated a problem where we seem to get white seams between two objects that really shouldn't have them. A black rectangle and a red image should touch seamlessly, but using these parameters for transformation matrix and image size they do generate a pixel-wide white line between them.</div><div><br class="webkit-block-placeholder"></div><div>Is there anything we can do about this?</div><div><br class="webkit-block-placeholder"></div><div>The attached sample code generates the white vertical line between where the right side of the black rectangle touches the left side of the red image, at 799.52 along the x-axis in userspace coordinates.</div><div><br class="webkit-block-placeholder"></div><div>We're using cairo 1.4.10.</div><div><br class="webkit-block-placeholder"></div><div>Any help is much appreciated.</div><div><br class="webkit-block-placeholder"></div><div>Thanks,</div><div>Kristof</div><div><br class="webkit-block-placeholder"></div><div><div><blockquote type="cite"><div><font class="Apple-style-span" face="Courier"></font></div></blockquote><br><blockquote type="cite"><div><font class="Apple-style-span" face="Courier"></font></div></blockquote><blockquote type="cite"><div><font class="Apple-style-span" face="Courier">// image of 444 x 608, ARGB</font></div></blockquote><blockquote type="cite"><div><font class="Apple-style-span" face="Courier">cairo_surface_t *lCairoSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,444,608);</font></div><div><font class="Apple-style-span" face="Courier">unsigned char *lBuffer1 = cairo_image_surface_get_data(lCairoSurface);</font></div><div><font class="Apple-style-span" face="Courier">memset(lBuffer1,255,444*608*4);</font></div><div><br></div></blockquote><blockquote type="cite"><div><font class="Apple-style-span" face="Courier">// turn off antialiasing</font></div><div><font class="Apple-style-span" face="Courier">cairo_t *lCairoState = cairo_create(lCairoSurface);</font></div><div><font class="Apple-style-span" face="Courier">cairo_set_antialias(lCairoState,CAIRO_ANTIALIAS_NONE);</font></div><div><font class="Apple-style-span" face="Courier"><br class="webkit-block-placeholder"></font></div><div><font class="Apple-style-span" face="Courier">// this transformation seems to be necessary</font></div><div><font class="Apple-style-span" face="Courier">cairo_matrix_t lFitInImageMatrix;</font></div><div><font class="Apple-style-span" face="Courier">cairo_matrix_init(&lFitInImageMatrix,0.49908064092,0,0,0.49908064092,-0.07092198377,0);</font></div><div><font class="Apple-style-span" face="Courier">cairo_transform(lCairoState,&lFitInImageMatrix);</font></div><div><font class="Apple-style-span" face="Courier"><br class="webkit-block-placeholder"></font></div><div><font class="Apple-style-span" face="Courier">// draw the black rectangle</font></div><div><font class="Apple-style-span" face="Courier">cairo_move_to(lCairoState, 48, 497.6);</font></div><div><font class="Apple-style-span" face="Courier">cairo_line_to(lCairoState, 799.52, 497.6);</font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier">        </font></span><font class="Apple-style-span" face="Courier">// right side at 799.52!</font></div><div><font class="Apple-style-span" face="Courier">cairo_line_to(lCairoState, 799.52, 513.44);</font></div><div><font class="Apple-style-span" face="Courier">cairo_line_to(lCairoState, 48, 513.44);</font></div><div><font class="Apple-style-span" face="Courier">cairo_close_path(lCairoState);</font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier">        </font></span></div><div><font class="Apple-style-span" face="Courier">cairo_set_source_rgba(lCairoState, 0, 0, 0, 255);</font></div><div><font class="Apple-style-span" face="Courier">cairo_fill(lCairoState);</font></div><div><font class="Apple-style-span" face="Courier"><br class="webkit-block-placeholder"></font></div><div><font class="Apple-style-span" face="Courier">// create a red image of 30 by 160 pixels, 4 bytes wide (ARGB)</font></div><div><font class="Apple-style-span" face="Courier">int i = 0;</font></div><div><font class="Apple-style-span" face="Courier">unsigned char *lImage = new unsigned char[30*160*4];</font></div><div><font class="Apple-style-span" face="Courier">for (; i<30*160*4; )</font></div><div><font class="Apple-style-span" face="Courier">{</font></div><div><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier">        </font></span><font class="Apple-style-span" face="Courier">lImage[i++] = 255; lImage[i++] = 0; lImage[i++] = 0; lImage[i++] = 255;</font></div><div><font class="Apple-style-span" face="Courier">}</font></div><div><font class="Apple-style-span" face="Courier"><br class="webkit-block-placeholder"></font></div><div><font class="Apple-style-span" face="Courier">// and draw it</font></div><div><font class="Apple-style-span" face="Courier">cairo_surface_t *lSurface = cairo_image_surface_create_for_data(</font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier">        </font></span><font class="Apple-style-span" face="Courier">lImage,</font></div><div><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier">                                                        </font></span><font class="Apple-style-span" face="Courier">CAIRO_FORMAT_ARGB32, 30, 160, 30*4 );</font></div><div><font class="Apple-style-span" face="Courier">cairo_matrix_t lMatrix;</font></div><div><font class="Apple-style-span" face="Courier">cairo_matrix_init_identity(&lMatrix);</font></div><div><font class="Apple-style-span" face="Courier">lMatrix.x0 += 799.52;</font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier">                                        </font></span><font class="Apple-style-span" face="Courier">// right next to the black rectangle!</font></div><div><font class="Apple-style-span" face="Courier">lMatrix.y0 += 464.32;</font></div><div><font class="Apple-style-span" face="Courier">cairo_transform(lCairoState,&lMatrix);</font></div><div><font class="Apple-style-span" face="Courier">cairo_set_source_surface(lCairoState,lSurface,0,0);</font></div><div><font class="Apple-style-span" face="Courier">cairo_paint(lCairoState);</font></div></blockquote></div><div><br class="webkit-block-placeholder"></div></div></body></html>