@@ -24,21 +24,14 @@ | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
GlowEffect::GlowEffect() | |||||
: radius (2.0f), | |||||
colour (Colours::white) | |||||
{ | |||||
} | |||||
GlowEffect::~GlowEffect() | |||||
{ | |||||
} | |||||
GlowEffect::GlowEffect() {} | |||||
GlowEffect::~GlowEffect() {} | |||||
void GlowEffect::setGlowProperties (const float newRadius, | |||||
Colour newColour) | |||||
void GlowEffect::setGlowProperties (float newRadius, Colour newColour, Point<int> pos) | |||||
{ | { | ||||
radius = newRadius; | radius = newRadius; | ||||
colour = newColour; | colour = newColour; | ||||
offset = pos; | |||||
} | } | ||||
void GlowEffect::applyEffect (Image& image, Graphics& g, float scaleFactor, float alpha) | void GlowEffect::applyEffect (Image& image, Graphics& g, float scaleFactor, float alpha) | ||||
@@ -53,8 +46,8 @@ void GlowEffect::applyEffect (Image& image, Graphics& g, float scaleFactor, floa | |||||
blurKernel.applyToImage (temp, image, image.getBounds()); | blurKernel.applyToImage (temp, image, image.getBounds()); | ||||
g.setColour (colour.withMultipliedAlpha (alpha)); | g.setColour (colour.withMultipliedAlpha (alpha)); | ||||
g.drawImageAt (temp, 0, 0, true); | |||||
g.drawImageAt (temp, offset.x, offset.y, true); | |||||
g.setOpacity (alpha); | g.setOpacity (alpha); | ||||
g.drawImageAt (image, 0, 0, false); | |||||
g.drawImageAt (image, offset.x, offset.y, false); | |||||
} | } |
@@ -40,7 +40,6 @@ class JUCE_API GlowEffect : public ImageEffectFilter | |||||
public: | public: | ||||
//============================================================================== | //============================================================================== | ||||
/** Creates a default 'glow' effect. | /** Creates a default 'glow' effect. | ||||
To customise its appearance, use the setGlowProperties() method. | To customise its appearance, use the setGlowProperties() method. | ||||
*/ | */ | ||||
GlowEffect(); | GlowEffect(); | ||||
@@ -56,17 +55,19 @@ public: | |||||
opacity). | opacity). | ||||
*/ | */ | ||||
void setGlowProperties (float newRadius, | void setGlowProperties (float newRadius, | ||||
Colour newColour); | |||||
Colour newColour, | |||||
Point<int> offset = {}); | |||||
//============================================================================== | //============================================================================== | ||||
/** @internal */ | /** @internal */ | ||||
void applyEffect (Image& sourceImage, Graphics& destContext, float scaleFactor, float alpha) override; | |||||
void applyEffect (Image&, Graphics&, float scaleFactor, float alpha) override; | |||||
private: | private: | ||||
//============================================================================== | //============================================================================== | ||||
float radius; | |||||
Colour colour; | |||||
float radius = 2.0f; | |||||
Colour colour { Colours::white }; | |||||
Point<int> offset; | |||||
JUCE_LEAK_DETECTOR (GlowEffect) | JUCE_LEAK_DETECTOR (GlowEffect) | ||||
}; | }; |