how to improve circular region

ThatFella

New member
Joined
Sep 29, 2003
Messages
1
Hi,

Attached you will find two circles that I have generated. The blue circle was created using FillEllipse with anti-aliasing. The grating was drawn by clipping an elliptical region and then drawing a series of lines. Without the clipping, the image would be a rectangle. As you can see, the elliptical region look pretty bad around the edges. Is there any way to improve this??

Ive implemented the grating using a Region, because I couldnt find another way to do it. The grating was generated by a series of diagonal DrawLine commands at varying grayness levels. Is there a better way to do this?

The image must be circular, and the rugged edges are not acceptible. Thanks in advance for any suggestions!

Here is how I clipped the region (C++):
Code:
	GraphicsPath path;
	path.AddEllipse(startX, startY, width, length);
	Region region(&path);
	graphics.SetClip(&region);

And this is the Anti-aliasing code I used for the blue circle, and left in there for the grating:
Code:
	graphics.SetSmoothingMode(SmoothingModeAntiAlias);


--
ThatFella
 

Attachments

  • circles1.jpg
    circles1.jpg
    27.5 KB · Views: 23
Sorry if im not understanding your problem correctly :), but if you want to draw an ellipse with effect such as that you could try using HatchBrush class - which has a lot of patterns to choose from - with the FillEllipse method. You could try looking through it and see if you find a pattern you want.
 
I dont think youre going to get the antialiasing on a region. The drawing works because it can compare the edge pixels to whats currently on the screen (or on the graphical device youre drawing to) and blend them accordingly. On a region, its just a pure "this pixel is in or out" kind of test. Now you might be able to manually examine those pixels along the edge and blend them yourself, but that sounds like a LOT of work and using the .NET functions to read/write pixels, performance isnt going to be realtime.

If you know more about the region outside of your region, such as if its always black, you could make some assumptions and blend things easier.

-Nerseus
 
Back
Top