mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-31 03:00:05 +00:00
Added an offset to GlowEffect
This commit is contained in:
parent
d7197f8f42
commit
433a82edee
2 changed files with 12 additions and 18 deletions
|
|
@ -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;
|
||||
colour = newColour;
|
||||
offset = pos;
|
||||
}
|
||||
|
||||
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());
|
||||
|
||||
g.setColour (colour.withMultipliedAlpha (alpha));
|
||||
g.drawImageAt (temp, 0, 0, true);
|
||||
g.drawImageAt (temp, offset.x, offset.y, true);
|
||||
|
||||
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:
|
||||
//==============================================================================
|
||||
/** Creates a default 'glow' effect.
|
||||
|
||||
To customise its appearance, use the setGlowProperties() method.
|
||||
*/
|
||||
GlowEffect();
|
||||
|
|
@ -56,17 +55,19 @@ public:
|
|||
opacity).
|
||||
*/
|
||||
void setGlowProperties (float newRadius,
|
||||
Colour newColour);
|
||||
Colour newColour,
|
||||
Point<int> offset = {});
|
||||
|
||||
|
||||
//==============================================================================
|
||||
/** @internal */
|
||||
void applyEffect (Image& sourceImage, Graphics& destContext, float scaleFactor, float alpha) override;
|
||||
void applyEffect (Image&, Graphics&, float scaleFactor, float alpha) override;
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
float radius;
|
||||
Colour colour;
|
||||
float radius = 2.0f;
|
||||
Colour colour { Colours::white };
|
||||
Point<int> offset;
|
||||
|
||||
JUCE_LEAK_DETECTOR (GlowEffect)
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue