# DropShadow draws an filled rectangle

**URL:** <https://forum.juce.com/t/dropshadow-draws-an-filled-rectangle/27999>\
**Category:** General JUCE discussion\
**Created:** [June 5, 2018, 10:16am UTC](https://forum.juce.com/t/dropshadow-draws-an-filled-rectangle/27999 "2018-06-05T10:16:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kyrillos](https://avatars.discourse-cdn.com/v4/letter/k/4af34b/32.png) [@Kyrillos](https://forum.juce.com/u/Kyrillos)\
**Post date:** [June 5, 2018, 10:16am UTC](https://forum.juce.com/t/dropshadow-draws-an-filled-rectangle/27999/1 "2018-06-05T10:16:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kunz](https://avatars.discourse-cdn.com/v4/letter/k/f19dbf/32.png) [@kunz](https://forum.juce.com/u/kunz)\
**Post date:** [June 5, 2018, 11:29am UTC](https://forum.juce.com/t/dropshadow-draws-an-filled-rectangle/27999/2 "2018-06-05T11:29:08Z")

</div>

> [@Kyrillos](#):
>
> DropShadow

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

---

<div class="post-metadata">

**Author:** ![Kyrillos](https://avatars.discourse-cdn.com/v4/letter/k/4af34b/32.png) [@Kyrillos](https://forum.juce.com/u/Kyrillos)\
**Post date:** [June 5, 2018, 12:11pm UTC](https://forum.juce.com/t/dropshadow-draws-an-filled-rectangle/27999/3 "2018-06-05T12:11:18Z")

</div>

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](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/d/d98af324c744e54e341da7391e8c5d4b0439244e.png)  
Here is a picture with a radius of 5 :  
 ![radius%205](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/c/cb3743aa2bda1248621bee8e0024ede1efc9ff91.png)  
And a radius of 30 :  
 ![radius%2030](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/3/32cc30a484d598357b9166611847fc1ad88a8ba9.png)

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

Kyrillos

---

<div class="post-metadata">

**Author:** ![kunz](https://avatars.discourse-cdn.com/v4/letter/k/f19dbf/32.png) [@kunz](https://forum.juce.com/u/kunz)\
**Post date:** [June 5, 2018, 12:53pm UTC](https://forum.juce.com/t/dropshadow-draws-an-filled-rectangle/27999/4 "2018-06-05T12:53:54Z")

</div>

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.
