Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an equivalent of soft pen in GDI+?

I need to draw a soft wide outline for my GDI+ GraphicsPath. Something like this: A path edge (red) drawn with a smooth pen

A path edge is shown in red. I'd like to use a wide pen which is smooth. I also need an ability to control smoothness of the pen.

I tried to use a gradient brush with the pen but couldn't find a solution that works.

I can achieve the desired result by drawing an outline with a black solid pen and applying a Gaussian smoothing filter on top of the result image, but I want to avoid this because it's slow when I have to process the whole image which could be quite large.

Is there a way to draw a smooth path outline?

like image 616
Lev Avatar asked Nov 01 '22 15:11

Lev


1 Answers

There is no standard way in GDI+ that provides this functionality so you will have to create it.

You could track the line segments and draw a fuzzy, filled circle along the segments. By drawling the fuzzy circle once to a bitmap it should be fairly easy and fast to blit it continuously. By blending it slowly over time to the canvas you can also create a very nice effect and it would allow the user to control the intensity and maybe the size of the circle.

like image 128
Emond Avatar answered Dec 20 '22 18:12

Emond