Add remaining files
[juce-lv2.git] / juce / source / src / gui / graphics / effects / juce_DropShadowEffect.h
blob2fdc7068ae651027b48d9019ec3821cd3c97a8c0
1 /*
2 ==============================================================================
4 This file is part of the JUCE library - "Jules' Utility Class Extensions"
5 Copyright 2004-11 by Raw Material Software Ltd.
7 ------------------------------------------------------------------------------
9 JUCE can be redistributed and/or modified under the terms of the GNU General
10 Public License (Version 2), as published by the Free Software Foundation.
11 A copy of the license is included in the JUCE distribution, or can be found
12 online at www.gnu.org/licenses.
14 JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18 ------------------------------------------------------------------------------
20 To release a closed-source product which uses JUCE, commercial licenses are
21 available: visit www.rawmaterialsoftware.com/juce for more information.
23 ==============================================================================
26 #ifndef __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
27 #define __JUCE_DROPSHADOWEFFECT_JUCEHEADER__
29 #include "juce_ImageEffectFilter.h"
32 //==============================================================================
33 /**
34 An effect filter that adds a drop-shadow behind the image's content.
36 (This will only work on images/components that aren't opaque, of course).
38 When added to a component, this effect will draw a soft-edged
39 shadow based on what gets drawn inside it. The shadow will also
40 be applied to the component's children.
42 For speed, this doesn't use a proper gaussian blur, but cheats by
43 using a simple bilinear filter. If you need a really high-quality
44 shadow, check out ImageConvolutionKernel::createGaussianBlur()
46 @see Component::setComponentEffect
48 class JUCE_API DropShadowEffect : public ImageEffectFilter
50 public:
51 //==============================================================================
52 /** Creates a default drop-shadow effect.
54 To customise the shadow's appearance, use the setShadowProperties()
55 method.
57 DropShadowEffect();
59 /** Destructor. */
60 ~DropShadowEffect();
62 //==============================================================================
63 /** Sets up parameters affecting the shadow's appearance.
65 @param newRadius the (approximate) radius of the blur used
66 @param newOpacity the opacity with which the shadow is rendered
67 @param newShadowOffsetX allows the shadow to be shifted in relation to the
68 component's contents
69 @param newShadowOffsetY allows the shadow to be shifted in relation to the
70 component's contents
72 void setShadowProperties (float newRadius,
73 float newOpacity,
74 int newShadowOffsetX,
75 int newShadowOffsetY);
78 //==============================================================================
79 /** @internal */
80 void applyEffect (Image& sourceImage, Graphics& destContext, float alpha);
83 private:
84 //==============================================================================
85 int offsetX, offsetY;
86 float radius, opacity;
88 JUCE_LEAK_DETECTOR (DropShadowEffect);
92 #endif // __JUCE_DROPSHADOWEFFECT_JUCEHEADER__