[cairo] cairo_image_surface_create_from_png and pango_cairo_show_layout problem

Ricchetti, Andrea Andrea.Ricchetti at snapon.com
Tue Nov 3 05:16:31 PST 2009



I'm drawing a table using cairo.

On the cells I can put graphics or text (for text I'm using pangocairo).


I put graphics with:


pSurface = cairo_image_surface_create_from_png (guiSpec.TIcon.strValue);

w = cairo_image_surface_get_width (pSurface);

h = cairo_image_surface_get_height (pSurface);       

cairo_set_source_surface (m_pCairo, pSurface, x-(w/2), y-(h/2));

            cairo_paint (m_pCairo);

           cairo_surface_destroy (pSurface);            


I put text with:

(CPangoCairoWrapper ia a wrapper for pangocairo and it's work fine).


    CPangoCairoWrapper *write;    

    int width, height;

    double cellwidth, cellheight;


    write = new CPangoCairoWrapper;      






    write->GetTextExtension(&width, &height);


    cairo_move_to (m_pCairo, x-(width/2.), y-(height/2.));

    pango_cairo_show_layout(m_pCairo,  write->CA_PA_GetPangoLayout());

   delete write;


The problem is:

If I put a graphic element on a cell of a row, nothing appear when I'll
try to insert a text on a different cell of the same row.


Can someone help me.


Thanks in advance,



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cairographics.org/archives/cairo/attachments/20091103/8ec44f0a/attachment.html 

More information about the cairo mailing list