Is there a soft pen equivalent in GDI +?

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

The edge of the path is displayed in red. I would like to use a wide handle that would be smooth. I also need the ability to control the smoothness of the pen.

I tried using a gradient brush with a pen, but could not find a solution that works.

I can achieve the desired result by drawing the 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 is slow when I have to process the whole image, which could be quite large.

Is there a way to draw a smooth outline outline?

+5
source share
1 answer

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

You can track line segments and draw a fuzzy, filled circle by segments. Scrolling a fuzzy circle once until the bitmap image, it should be quite simple and fast to continuously inflate it. By mixing it slowly over time on the canvas, you can also create a very nice effect, and this will allow the user to control the intensity and, possibly, the size of the circle.

+2
source

Source: https://habr.com/ru/post/1204619/


All Articles