[cairo] cairo_clip + cairo_show_text = bug?

Igor Nikitin igor_nikitin at valentina-db.com
Mon Jul 12 07:31:13 PDT 2010


(sorry for my english)

Hi All, Here small sample code to reproduce:

#include<cairo/cairo.h>

int main( int argc, char** argv )
{
     cairo_surface_t* surface    = cairo_image_surface_create(
CAIRO_FORMAT_ARGB32, 40, 15 );
     cairo_t*         target     = cairo_create( surface );

     // Height of region must by only 5 px
     cairo_rectangle( target, 0, 0, 40, 5 );
     cairo_clip( target );

     cairo_set_font_size( target, 12 );
     cairo_select_font_face(
         target,
         "sans",
         CAIRO_FONT_SLANT_NORMAL,
         CAIRO_FONT_WEIGHT_NORMAL );

     cairo_set_source_rgb( target, 0, 0, 0 );

     cairo_move_to( target, 0, 12 );
     cairo_show_text( target, "TEST" );
     cairo_stroke( target );

     cairo_reset_clip( target );

     cairo_surface_write_to_png( surface, "1.png" );

     return 0;
}

Result file attached - no clipping at all.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20100712/4aa0e567/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1 (1).png
Type: image/png
Size: 299 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20100712/4aa0e567/attachment.png>


More information about the cairo mailing list