DropShadow draws an filled rectangle


#1

Hi,
I’m trying to use a dropshadow on a rectangle in the paint class inside my component, but it draws a full and filled rectangle of the color of my drop shadow.
Here is my code :

shadow = DropShadow(Colours::white, 1,point);
Rectangle<int> intBounds((int) area.getX(), (int)area.getY(), (int) area.getWidth(), (int) area.getHeight());
shadow.drawForRectangle(g, intBounds);

Does anyone has ever experienced this ?

Thank,
Kyrillos


#2

You need to increase the radius from 1 to something higher to get a smooth shadow.


#3

Thank for your response,
If I increase the radius, there is still an fully filled rect at the center + the shadow goes to far.
Here is a picture of the original grid:
orig
Here is a picture with a radius of 5 :
radius%205
And a radius of 30 :
radius%2030

I’d like to have the shadow just outside the contour, maybe I do something wrong ?

Kyrillos


#4

You don’t do something wrong. You need to fill your buttons with the background color if you want that effect. At the moment it looks like your buttons only have a border and a transparent background. Also make sure you have enough space around the buttons (bigger component), otherwise it clips the shadow like in your example with radius 30.
You can use a path to draw the shadow when you only want the shadow around our button border lines.