[cairo] scaling a surface

Michael Gurnett gurnett at glocalnet.net
Sun Sep 14 10:39:51 PDT 2008


I'm sure this is trivial, but for some reason I can't get it to work.

Basically I have a graph that I want to start to shrink in the x direction 
when the data reaches the right side of the graph. My idea was to use a 
buffer so that the following would occur (based on a graph width of 100).

if data_x> 100
{
    copy surface to buffer
    shrink buffer surface so that it is 99 wide
    copy the buffer back to the surface
}
 cairo_move_to(cr , 99,y_prev);
cairo_line_to(cr, 100,y_current);

obsiously the 99 will also have to be properly scaled so that it has the 
same scaling as the other data so I will have to keep tabs on how many times 
the data has been scaled.

Hope someone can come up with an idea..

Thanks 



More information about the cairo mailing list