BUG: Outline of a Pie() Slice May Not Be Completely SmoothLast reviewed: January 5, 1995Article ID: Q111866 |
The information in this article applies to:
SYMPTOMSThe outline of a Pie() slice may not be completely smooth.
CAUSEWindows calculates the Pie() center using device points. Round-off errors, especially in mapping modes other than MM_TEXT, can put the center of the pie off center, resulting in a slightly "crinkly" pie slice.
RESOLUTIONThe bounding rectangle of the Pie() function includes the top left coordinates (X1,Y1) but not the bottom right coordinates (X2,Y2). Adding 1 to X2 and Y2 makes the real extent even, and therefore the radius can be nicely placed. But this method works on the screen only in the default MM_TEXT mode. If you change the mapping of the device context to some high resolution mode, such as MM_HIENGLISH or MM_TWIPS, the center again goes off 1 by pixel and you get slightly crinkly pie slices. Windows converts all four pairs of coordinates of the Pie() function from logical points to device points, and then it calculates the center of the pie. If you're going from a high resolution mode to a low resolution device, such as the screen or a 75 dpi printer, you'll get rounding errors. As a workaround, an application can do a DPtoLP() of (1,1) and add that to X2 and Y2. For example, in MM_HIENGLISH, the result of the DPtoLP() of (1,1) is about 13 logical points instead of just 1. Note, however, that this method will not work all the time, because the rounding error will depend on the actual coordinates. If an application requires smooth pie slices, and must use a mapping mode other than MM_TEXT, the application could proceed as follows (this does defeat the purpose of using a mapping mode):
for the pie.3. Call DPtoLP() on the coordinate pairs. 4. Pass the coordinates to Pie().
STATUSMicrosoft has confirmed this to be a bug in Windows versions 3.0 and 3.1. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
|
Additional reference words: buglist3.00 buglist3.10 3.00 3.10
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |