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 #include "../../../core/juce_StandardHeader.h"
30 #include "juce_GlowEffect.h"
31 #include "../../graphics/imaging/juce_ImageConvolutionKernel.h"
34 //==============================================================================
35 GlowEffect::GlowEffect()
37 colour (Colours::white
)
41 GlowEffect::~GlowEffect()
45 void GlowEffect::setGlowProperties (const float newRadius
,
46 const Colour
& newColour
)
52 void GlowEffect::applyEffect (Image
& image
, Graphics
& g
, float alpha
)
54 Image
temp (image
.getFormat(), image
.getWidth(), image
.getHeight(), true);
56 ImageConvolutionKernel
blurKernel (roundToInt (radius
* 2.0f
));
58 blurKernel
.createGaussianBlur (radius
);
59 blurKernel
.rescaleAllValues (radius
);
61 blurKernel
.applyToImage (temp
, image
, image
.getBounds());
63 g
.setColour (colour
.withMultipliedAlpha (alpha
));
64 g
.drawImageAt (temp
, 0, 0, true);
67 g
.drawImageAt (image
, 0, 0, false);