<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><div id="yiv1781611113"><div id="yiv1859373890"><div id="yiv1736240048"><div id="yiv1122394356"><div id="yiv1271070972">Hi everyone,<br><br>I'm testing Cairo under Win32 so I wrote a small Windows program (in C) that draws lines on a child window. So far, I have implemented panning and zooming successfully. I use cairo_win32_surface_create() to create the surface. User space origin is translated to the center of my display window with the Y axis going up (like in a CAD program). I have a dozen of random lines whose endpoints coord. range approx. between -32000.0 and +32000.0 <br>When my program starts with a cairo_scale(cr, 0.125, -0.125), I can't see all the lines (I'm zoomed in and can only see parts of a few lines) so I zoom out (gradually by dividing the scale factor -- initially 0.125 -- by 2.0) until I reach cairo_scale(cr, 0.0078125, -0.0078125) in order
to have all my lines shown inside the display window.
Fine.<br><br>Then I decided to
add a taller line (-1000000000.0, -1000000000.0, 1000000000.0, 1000000000.0) [that's one billion, ok?] which should obviously pass through the orgin (0,0).. but when I start the program with my initial scale factor 0.125, the tall line is not displayed; Logically, I should be able to see it crossing my window! Now here's the wierd part: if I zoom out from 0.125 to 0.000061035156 (dividing scale factor by 2.0 each time), nothing special happens except that my bunch of initial lines become a tiny spot at the middle of my display window.. logical.. now if I zoom out just one more time -- so I move from cairo_scale(cr, 0.000061035156 to cairo_scale(cr, 0.000030517578) -- the tall line appears! It crosses the display window's central point (0,0) as expected.. in order to see the tall lines endpoints (-/+ 1 billion) on my screen, I have to zoom out to 0.000000238419.<br><br>Note: In order to keep line width 1 single pixel regardless of transformation, I'm
using:<br><br>double w1, w2;<br> w1 = w2 = 1.0;<br> cairo_device_to_user_distance (cr, &w1, &w2);<br> cairo_set_line_width (cr, w1 > w2 ? w1 : w2); <br><br>Could someone please explain to me what's going on? According to my past programming experience with other libraries, such behavior may be related to a variable range overflow during user-space to device-space conversion operations. Do you have a fix for that? If not, what are the minimum/maximum limits for shape coordinates and scale factors to avoid such problems?<br><br>Thank you very much!<br><br>PS. If I can provide further information to clear out this issue, please let me know.<br><br>Robert<br><br></div></div></div></div></div></td></tr></table><br>