Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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??

 

I've implemented the grating using a Region, because I couldn't 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++):

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:

graphics.SetSmoothingMode(SmoothingModeAntiAlias);

 

 

--

ThatFella

  • *Experts*
Posted
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.
  • *Experts*
Posted

I don't think you're going to get the antialiasing on a region. The drawing works because it can compare the edge pixels to what's currently on the screen (or on the graphical device you're drawing to) and blend them accordingly. On a region, it's 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 isn't going to be realtime.

 

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

 

-Nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...