Problem with regions
-
Hi, I have a problem when creating win32 regions and drawing into them. The edges of the shapes drawing inside the region are distored or cut-off. For example: CDC* pdc = GetDC(); CRgn rgn; rgn.CreateEllipticRgn(10,10,50,50); pdc->SelectClipRgn(&rgn, RGN_COPY); pdc->Ellipse(10, 10, 50, 50); pdc->SelectClipRgn(NULL, RGN_COPY); ReleaseDC(pdc); Although the coordinates of the region are the same of the ellipse coordinates, it still does not draw the ellipse perfectly. The edges are distorted. Is there a way I can calculate the perfect region. I also do not want to use paths as they don't work properly in win98. What could be the solution. Thanks
-
Hi, I have a problem when creating win32 regions and drawing into them. The edges of the shapes drawing inside the region are distored or cut-off. For example: CDC* pdc = GetDC(); CRgn rgn; rgn.CreateEllipticRgn(10,10,50,50); pdc->SelectClipRgn(&rgn, RGN_COPY); pdc->Ellipse(10, 10, 50, 50); pdc->SelectClipRgn(NULL, RGN_COPY); ReleaseDC(pdc); Although the coordinates of the region are the same of the ellipse coordinates, it still does not draw the ellipse perfectly. The edges are distorted. Is there a way I can calculate the perfect region. I also do not want to use paths as they don't work properly in win98. What could be the solution. Thanks
Are you acconting for the pen width of the border of the object? In that case, your region needs to be slightly larger than the actual object boundaries, since most programs leave the pen drawing code to drawn ON the object's edge rather than within it. Since I don't see any code explicitly setting your pen, it could be any guess what it is at the time this code executes. Are you seeing distortion when the pen width is more than 1? I would not expect it too much with this code when the pen width is 1, except maybe at the outer edge of the ellipse. No shirt, no shoes, no brains, no service.
-
Are you acconting for the pen width of the border of the object? In that case, your region needs to be slightly larger than the actual object boundaries, since most programs leave the pen drawing code to drawn ON the object's edge rather than within it. Since I don't see any code explicitly setting your pen, it could be any guess what it is at the time this code executes. Are you seeing distortion when the pen width is more than 1? I would not expect it too much with this code when the pen width is 1, except maybe at the outer edge of the ellipse. No shirt, no shoes, no brains, no service.
Thanks for your reply. I am not selecting any pen into the device, so I assume that the default is a 1 pixel black pen. I tried making the region larger by one pixel, but the result shows the ellipse. However, there are extra little blank spaces around the ellipse. I also tried to make the pen PS_INSIDEFRAME but with the same result.