An effect filter that adds a drop-shadow behind the image's content. More...
Inherits ImageEffectFilter.
Public Member Functions | |
| DropShadowEffect () | |
| Creates a default drop-shadow effect. | |
| ~DropShadowEffect () | |
| Destructor. | |
| void | setShadowProperties (float newRadius, float newOpacity, int newShadowOffsetX, int newShadowOffsetY) |
| Sets up parameters affecting the shadow's appearance. | |
| void | applyEffect (Image &sourceImage, Graphics &destContext, float alpha) |
| Overridden to render the effect. | |
An effect filter that adds a drop-shadow behind the image's content.
(This will only work on images/components that aren't opaque, of course).
When added to a component, this effect will draw a soft-edged shadow based on what gets drawn inside it. The shadow will also be applied to the component's children.
For speed, this doesn't use a proper gaussian blur, but cheats by using a simple bilinear filter. If you need a really high-quality shadow, check out ImageConvolutionKernel::createGaussianBlur()
| DropShadowEffect::DropShadowEffect | ( | ) |
Creates a default drop-shadow effect.
To customise the shadow's appearance, use the setShadowProperties() method.
| DropShadowEffect::~DropShadowEffect | ( | ) |
Destructor.
| void DropShadowEffect::setShadowProperties | ( | float | newRadius, |
| float | newOpacity, | ||
| int | newShadowOffsetX, | ||
| int | newShadowOffsetY | ||
| ) |
Sets up parameters affecting the shadow's appearance.
| newRadius | the (approximate) radius of the blur used |
| newOpacity | the opacity with which the shadow is rendered |
| newShadowOffsetX | allows the shadow to be shifted in relation to the component's contents |
| newShadowOffsetY | allows the shadow to be shifted in relation to the component's contents |
| void DropShadowEffect::applyEffect | ( | Image & | sourceImage, |
| Graphics & | destContext, | ||
| float | alpha | ||
| ) | [virtual] |
Overridden to render the effect.
The implementation of this method must use the image that is passed in as its source, and should render its output to the graphics context passed in.
| sourceImage | the image that the source component has just rendered with its paint() method. The image may or may not have an alpha channel, depending on whether the component is opaque. |
| destContext | the graphics context to use to draw the resultant image. |
| alpha | the alpha with which to draw the resultant image to the target context |
Implements ImageEffectFilter.