I'm doing painting of a custom control and need some blur. I have a feeling this is impossible to do without doing "pixel math" (I hope I'm wrong).
The control is a node diagram with draws nodes as rectangles, and it should look something like the following:
I'm avoiding bitmaps, as the nodes can be of variable sizes. Is there an easy way to accomplish this?
Drawing blurred rectangle Topic is solved
Re: Drawing blurred rectangle
There is no built-in function that could blur the background, but i think a grey-to-transparent gradient should do the trick. But you'll have to use wxGraphicsContext for it.
https://docs.wxwidgets.org/trunk/classw ... 713ec29d93
BTW: In order to give the effect of a shadow, you'd usually have the dark areas only on two sides, e.g. right and bottom.
https://docs.wxwidgets.org/trunk/classw ... 713ec29d93
BTW: In order to give the effect of a shadow, you'd usually have the dark areas only on two sides, e.g. right and bottom.
Use the source, Luke!
Re: Drawing blurred rectangle
Thank you for the answer. I'm unsure on how to do the corners of the rectangle if I'm going for this solution. I did some testing in Inkscape with both linear and radial gradient, but can't get it to look right.
Re: Drawing blurred rectangle
Using a CreateRadialGradientBrush() for the corners should work.
Use the source, Luke!
Re: Drawing blurred rectangle
I am very certain a radiant brush for the corners will end up looking like this:
This is made in Inkscape, but if I can't get it right there, I certainly can't code it. I might be misunderstanding you, however.Re: Drawing blurred rectangle
The colors are just wrong. In principle that should work.I am very certain a radiant brush for the corners will end up looking like this:
If the color and width of the "shadow" is always the same, there is another option: Create a bitmap of how it's supposed to look in Photoshop (or similar) and in your app, stretch-blit the 4 corners and 4 edges of that bitmap onto your graphic.
Use the source, Luke!
Re: Drawing blurred rectangle
I will give it a go. Thank you for the help.