tags:

views:

64

answers:

2

I'm seeing a strange problem when calling Win32 GDI Polyline() when printing out. On screen it all looks ok, however if printing it will stop the polyline when it encounters a large value. I think this discrepency is due to the scaling for printing yielding larger POINT values.

It appears as if the polyline stops drawing if it hits a value > 32767, ie, as if there is a 16 bit limit on the POINT values.

I've seen some hear-say online about 16 bit values however no definitive reasoning. I would like to find out why this is occuring before thinking about a potential solution.

+1  A: 

According to MS documentation, this would occur in Windows 9X, where the coordinates are 32-bit but the underlying implementation is 16-bit and the values are just truncated. In practice, I already had the same problem years ago in non-9X Windows versions, but the situation was a bit different from yours, I believe. My "big" coordinates weren't there because the DC resolution was high, but because I had lines with one end inside the screen and the other far away outside - and the behaviour was that the visible part would not intercept the screen edge at the right point. In my case I solved the problem by clipping the lines before drawing. Maybe your problem is a bug in the specific printer driver you're using, have you tried to use another one?

http://books.google.com/books?id=-O92IIF1Bj4C&lpg=PA359&ots=Sw0FC-9lk7&dq=gdi%2016%20bit%20coordinates&pg=PA359#v=onepage&q=gdi%2016%20bit%20coordinates&f=false

Fabio Ceconello
Actually the problem that you are describing is exactly what I'm doing as well. I'm drawing a point that is actually off-screen. With screen resolution it is under 16bit boundary but when printing it isn't. I'll be clipping the region prior to display / printing - code I inherited ;)
geekboyUK
+1  A: 

Yes, the old 16-bit Windows 3.x maximum value on coordinates is still around in scattered unobvious places. In this case it is very likely to be your printer driver. If a driver upgrade doesn't fix it, there's not much you can do but scale the polyline yourself.

Hans Passant