migrating to the latest JUCE version
This commit is contained in:
		@@ -1,183 +1,183 @@
 | 
			
		||||
/*
 | 
			
		||||
  ==============================================================================
 | 
			
		||||
 | 
			
		||||
   This file is part of the JUCE library.
 | 
			
		||||
   Copyright (c) 2020 - Raw Material Software Limited
 | 
			
		||||
 | 
			
		||||
   JUCE is an open source library subject to commercial or open-source
 | 
			
		||||
   licensing.
 | 
			
		||||
 | 
			
		||||
   By using JUCE, you agree to the terms of both the JUCE 6 End-User License
 | 
			
		||||
   Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
 | 
			
		||||
 | 
			
		||||
   End User License Agreement: www.juce.com/juce-6-licence
 | 
			
		||||
   Privacy Policy: www.juce.com/juce-privacy-policy
 | 
			
		||||
 | 
			
		||||
   Or: You may also use this code under the terms of the GPL v3 (see
 | 
			
		||||
   www.gnu.org/licenses).
 | 
			
		||||
 | 
			
		||||
   JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
 | 
			
		||||
   EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
 | 
			
		||||
   DISCLAIMED.
 | 
			
		||||
 | 
			
		||||
  ==============================================================================
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
namespace juce
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
static void blurDataTriplets (uint8* d, int num, const int delta) noexcept
 | 
			
		||||
{
 | 
			
		||||
    uint32 last = d[0];
 | 
			
		||||
    d[0] = (uint8) ((d[0] + d[delta] + 1) / 3);
 | 
			
		||||
    d += delta;
 | 
			
		||||
 | 
			
		||||
    num -= 2;
 | 
			
		||||
 | 
			
		||||
    do
 | 
			
		||||
    {
 | 
			
		||||
        const uint32 newLast = d[0];
 | 
			
		||||
        d[0] = (uint8) ((last + d[0] + d[delta] + 1) / 3);
 | 
			
		||||
        d += delta;
 | 
			
		||||
        last = newLast;
 | 
			
		||||
    }
 | 
			
		||||
    while (--num > 0);
 | 
			
		||||
 | 
			
		||||
    d[0] = (uint8) ((last + d[0] + 1) / 3);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void blurSingleChannelImage (uint8* const data, const int width, const int height,
 | 
			
		||||
                                    const int lineStride, const int repetitions) noexcept
 | 
			
		||||
{
 | 
			
		||||
    jassert (width > 2 && height > 2);
 | 
			
		||||
 | 
			
		||||
    for (int y = 0; y < height; ++y)
 | 
			
		||||
        for (int i = repetitions; --i >= 0;)
 | 
			
		||||
            blurDataTriplets (data + lineStride * y, width, 1);
 | 
			
		||||
 | 
			
		||||
    for (int x = 0; x < width; ++x)
 | 
			
		||||
        for (int i = repetitions; --i >= 0;)
 | 
			
		||||
            blurDataTriplets (data + x, height, lineStride);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void blurSingleChannelImage (Image& image, int radius)
 | 
			
		||||
{
 | 
			
		||||
    const Image::BitmapData bm (image, Image::BitmapData::readWrite);
 | 
			
		||||
    blurSingleChannelImage (bm.data, bm.width, bm.height, bm.lineStride, 2 * radius);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//==============================================================================
 | 
			
		||||
DropShadow::DropShadow (Colour shadowColour, const int r, Point<int> o) noexcept
 | 
			
		||||
    : colour (shadowColour), radius (r), offset (o)
 | 
			
		||||
{
 | 
			
		||||
    jassert (radius > 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DropShadow::drawForImage (Graphics& g, const Image& srcImage) const
 | 
			
		||||
{
 | 
			
		||||
    jassert (radius > 0);
 | 
			
		||||
 | 
			
		||||
    if (srcImage.isValid())
 | 
			
		||||
    {
 | 
			
		||||
        Image shadowImage (srcImage.convertedToFormat (Image::SingleChannel));
 | 
			
		||||
        shadowImage.duplicateIfShared();
 | 
			
		||||
 | 
			
		||||
        blurSingleChannelImage (shadowImage, radius);
 | 
			
		||||
 | 
			
		||||
        g.setColour (colour);
 | 
			
		||||
        g.drawImageAt (shadowImage, offset.x, offset.y, true);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DropShadow::drawForPath (Graphics& g, const Path& path) const
 | 
			
		||||
{
 | 
			
		||||
    jassert (radius > 0);
 | 
			
		||||
 | 
			
		||||
    auto area = (path.getBounds().getSmallestIntegerContainer() + offset)
 | 
			
		||||
                  .expanded (radius + 1)
 | 
			
		||||
                  .getIntersection (g.getClipBounds().expanded (radius + 1));
 | 
			
		||||
 | 
			
		||||
    if (area.getWidth() > 2 && area.getHeight() > 2)
 | 
			
		||||
    {
 | 
			
		||||
        Image renderedPath (Image::SingleChannel, area.getWidth(), area.getHeight(), true);
 | 
			
		||||
 | 
			
		||||
        {
 | 
			
		||||
            Graphics g2 (renderedPath);
 | 
			
		||||
            g2.setColour (Colours::white);
 | 
			
		||||
            g2.fillPath (path, AffineTransform::translation ((float) (offset.x - area.getX()),
 | 
			
		||||
                                                             (float) (offset.y - area.getY())));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        blurSingleChannelImage (renderedPath, radius);
 | 
			
		||||
 | 
			
		||||
        g.setColour (colour);
 | 
			
		||||
        g.drawImageAt (renderedPath, area.getX(), area.getY(), true);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void drawShadowSection (Graphics& g, ColourGradient& cg, Rectangle<float> area,
 | 
			
		||||
                               bool isCorner, float centreX, float centreY, float edgeX, float edgeY)
 | 
			
		||||
{
 | 
			
		||||
    cg.point1 = area.getRelativePoint (centreX, centreY);
 | 
			
		||||
    cg.point2 = area.getRelativePoint (edgeX, edgeY);
 | 
			
		||||
    cg.isRadial = isCorner;
 | 
			
		||||
 | 
			
		||||
    g.setGradientFill (cg);
 | 
			
		||||
    g.fillRect (area);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DropShadow::drawForRectangle (Graphics& g, const Rectangle<int>& targetArea) const
 | 
			
		||||
{
 | 
			
		||||
    ColourGradient cg (colour, 0, 0, colour.withAlpha (0.0f), 0, 0, false);
 | 
			
		||||
 | 
			
		||||
    for (float i = 0.05f; i < 1.0f; i += 0.1f)
 | 
			
		||||
        cg.addColour (1.0 - i, colour.withMultipliedAlpha (i * i));
 | 
			
		||||
 | 
			
		||||
    const float radiusInset = (float) radius / 2.0f;
 | 
			
		||||
    const float expandedRadius = (float) radius + radiusInset;
 | 
			
		||||
 | 
			
		||||
    auto area = targetArea.toFloat().reduced (radiusInset) + offset.toFloat();
 | 
			
		||||
 | 
			
		||||
    auto r = area.expanded (expandedRadius);
 | 
			
		||||
    auto top = r.removeFromTop (expandedRadius);
 | 
			
		||||
    auto bottom = r.removeFromBottom (expandedRadius);
 | 
			
		||||
 | 
			
		||||
    drawShadowSection (g, cg, top.removeFromLeft  (expandedRadius), true, 1.0f, 1.0f, 0, 1.0f);
 | 
			
		||||
    drawShadowSection (g, cg, top.removeFromRight (expandedRadius), true, 0, 1.0f, 1.0f, 1.0f);
 | 
			
		||||
    drawShadowSection (g, cg, top, false, 0, 1.0f, 0, 0);
 | 
			
		||||
 | 
			
		||||
    drawShadowSection (g, cg, bottom.removeFromLeft  (expandedRadius), true, 1.0f, 0, 0, 0);
 | 
			
		||||
    drawShadowSection (g, cg, bottom.removeFromRight (expandedRadius), true, 0, 0, 1.0f, 0);
 | 
			
		||||
    drawShadowSection (g, cg, bottom, false, 0, 0, 0, 1.0f);
 | 
			
		||||
 | 
			
		||||
    drawShadowSection (g, cg, r.removeFromLeft  (expandedRadius), false, 1.0f, 0, 0, 0);
 | 
			
		||||
    drawShadowSection (g, cg, r.removeFromRight (expandedRadius), false, 0, 0, 1.0f, 0);
 | 
			
		||||
 | 
			
		||||
    g.setColour (colour);
 | 
			
		||||
    g.fillRect (area);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//==============================================================================
 | 
			
		||||
DropShadowEffect::DropShadowEffect() {}
 | 
			
		||||
DropShadowEffect::~DropShadowEffect() {}
 | 
			
		||||
 | 
			
		||||
void DropShadowEffect::setShadowProperties (const DropShadow& newShadow)
 | 
			
		||||
{
 | 
			
		||||
    shadow = newShadow;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DropShadowEffect::applyEffect (Image& image, Graphics& g, float scaleFactor, float alpha)
 | 
			
		||||
{
 | 
			
		||||
    DropShadow s (shadow);
 | 
			
		||||
    s.radius = roundToInt ((float) s.radius * scaleFactor);
 | 
			
		||||
    s.colour = s.colour.withMultipliedAlpha (alpha);
 | 
			
		||||
    s.offset.x = roundToInt ((float) s.offset.x * scaleFactor);
 | 
			
		||||
    s.offset.y = roundToInt ((float) s.offset.y * scaleFactor);
 | 
			
		||||
 | 
			
		||||
    s.drawForImage (g, image);
 | 
			
		||||
 | 
			
		||||
    g.setOpacity (alpha);
 | 
			
		||||
    g.drawImageAt (image, 0, 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace juce
 | 
			
		||||
/*
 | 
			
		||||
  ==============================================================================
 | 
			
		||||
 | 
			
		||||
   This file is part of the JUCE library.
 | 
			
		||||
   Copyright (c) 2022 - Raw Material Software Limited
 | 
			
		||||
 | 
			
		||||
   JUCE is an open source library subject to commercial or open-source
 | 
			
		||||
   licensing.
 | 
			
		||||
 | 
			
		||||
   By using JUCE, you agree to the terms of both the JUCE 7 End-User License
 | 
			
		||||
   Agreement and JUCE Privacy Policy.
 | 
			
		||||
 | 
			
		||||
   End User License Agreement: www.juce.com/juce-7-licence
 | 
			
		||||
   Privacy Policy: www.juce.com/juce-privacy-policy
 | 
			
		||||
 | 
			
		||||
   Or: You may also use this code under the terms of the GPL v3 (see
 | 
			
		||||
   www.gnu.org/licenses).
 | 
			
		||||
 | 
			
		||||
   JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
 | 
			
		||||
   EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
 | 
			
		||||
   DISCLAIMED.
 | 
			
		||||
 | 
			
		||||
  ==============================================================================
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
namespace juce
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
static void blurDataTriplets (uint8* d, int num, const int delta) noexcept
 | 
			
		||||
{
 | 
			
		||||
    uint32 last = d[0];
 | 
			
		||||
    d[0] = (uint8) ((d[0] + d[delta] + 1) / 3);
 | 
			
		||||
    d += delta;
 | 
			
		||||
 | 
			
		||||
    num -= 2;
 | 
			
		||||
 | 
			
		||||
    do
 | 
			
		||||
    {
 | 
			
		||||
        const uint32 newLast = d[0];
 | 
			
		||||
        d[0] = (uint8) ((last + d[0] + d[delta] + 1) / 3);
 | 
			
		||||
        d += delta;
 | 
			
		||||
        last = newLast;
 | 
			
		||||
    }
 | 
			
		||||
    while (--num > 0);
 | 
			
		||||
 | 
			
		||||
    d[0] = (uint8) ((last + d[0] + 1) / 3);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void blurSingleChannelImage (uint8* const data, const int width, const int height,
 | 
			
		||||
                                    const int lineStride, const int repetitions) noexcept
 | 
			
		||||
{
 | 
			
		||||
    jassert (width > 2 && height > 2);
 | 
			
		||||
 | 
			
		||||
    for (int y = 0; y < height; ++y)
 | 
			
		||||
        for (int i = repetitions; --i >= 0;)
 | 
			
		||||
            blurDataTriplets (data + lineStride * y, width, 1);
 | 
			
		||||
 | 
			
		||||
    for (int x = 0; x < width; ++x)
 | 
			
		||||
        for (int i = repetitions; --i >= 0;)
 | 
			
		||||
            blurDataTriplets (data + x, height, lineStride);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void blurSingleChannelImage (Image& image, int radius)
 | 
			
		||||
{
 | 
			
		||||
    const Image::BitmapData bm (image, Image::BitmapData::readWrite);
 | 
			
		||||
    blurSingleChannelImage (bm.data, bm.width, bm.height, bm.lineStride, 2 * radius);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//==============================================================================
 | 
			
		||||
DropShadow::DropShadow (Colour shadowColour, const int r, Point<int> o) noexcept
 | 
			
		||||
    : colour (shadowColour), radius (r), offset (o)
 | 
			
		||||
{
 | 
			
		||||
    jassert (radius > 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DropShadow::drawForImage (Graphics& g, const Image& srcImage) const
 | 
			
		||||
{
 | 
			
		||||
    jassert (radius > 0);
 | 
			
		||||
 | 
			
		||||
    if (srcImage.isValid())
 | 
			
		||||
    {
 | 
			
		||||
        Image shadowImage (srcImage.convertedToFormat (Image::SingleChannel));
 | 
			
		||||
        shadowImage.duplicateIfShared();
 | 
			
		||||
 | 
			
		||||
        blurSingleChannelImage (shadowImage, radius);
 | 
			
		||||
 | 
			
		||||
        g.setColour (colour);
 | 
			
		||||
        g.drawImageAt (shadowImage, offset.x, offset.y, true);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DropShadow::drawForPath (Graphics& g, const Path& path) const
 | 
			
		||||
{
 | 
			
		||||
    jassert (radius > 0);
 | 
			
		||||
 | 
			
		||||
    auto area = (path.getBounds().getSmallestIntegerContainer() + offset)
 | 
			
		||||
                  .expanded (radius + 1)
 | 
			
		||||
                  .getIntersection (g.getClipBounds().expanded (radius + 1));
 | 
			
		||||
 | 
			
		||||
    if (area.getWidth() > 2 && area.getHeight() > 2)
 | 
			
		||||
    {
 | 
			
		||||
        Image renderedPath (Image::SingleChannel, area.getWidth(), area.getHeight(), true);
 | 
			
		||||
 | 
			
		||||
        {
 | 
			
		||||
            Graphics g2 (renderedPath);
 | 
			
		||||
            g2.setColour (Colours::white);
 | 
			
		||||
            g2.fillPath (path, AffineTransform::translation ((float) (offset.x - area.getX()),
 | 
			
		||||
                                                             (float) (offset.y - area.getY())));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        blurSingleChannelImage (renderedPath, radius);
 | 
			
		||||
 | 
			
		||||
        g.setColour (colour);
 | 
			
		||||
        g.drawImageAt (renderedPath, area.getX(), area.getY(), true);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void drawShadowSection (Graphics& g, ColourGradient& cg, Rectangle<float> area,
 | 
			
		||||
                               bool isCorner, float centreX, float centreY, float edgeX, float edgeY)
 | 
			
		||||
{
 | 
			
		||||
    cg.point1 = area.getRelativePoint (centreX, centreY);
 | 
			
		||||
    cg.point2 = area.getRelativePoint (edgeX, edgeY);
 | 
			
		||||
    cg.isRadial = isCorner;
 | 
			
		||||
 | 
			
		||||
    g.setGradientFill (cg);
 | 
			
		||||
    g.fillRect (area);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DropShadow::drawForRectangle (Graphics& g, const Rectangle<int>& targetArea) const
 | 
			
		||||
{
 | 
			
		||||
    ColourGradient cg (colour, 0, 0, colour.withAlpha (0.0f), 0, 0, false);
 | 
			
		||||
 | 
			
		||||
    for (float i = 0.05f; i < 1.0f; i += 0.1f)
 | 
			
		||||
        cg.addColour (1.0 - i, colour.withMultipliedAlpha (i * i));
 | 
			
		||||
 | 
			
		||||
    const float radiusInset = (float) radius / 2.0f;
 | 
			
		||||
    const float expandedRadius = (float) radius + radiusInset;
 | 
			
		||||
 | 
			
		||||
    auto area = targetArea.toFloat().reduced (radiusInset) + offset.toFloat();
 | 
			
		||||
 | 
			
		||||
    auto r = area.expanded (expandedRadius);
 | 
			
		||||
    auto top = r.removeFromTop (expandedRadius);
 | 
			
		||||
    auto bottom = r.removeFromBottom (expandedRadius);
 | 
			
		||||
 | 
			
		||||
    drawShadowSection (g, cg, top.removeFromLeft  (expandedRadius), true, 1.0f, 1.0f, 0, 1.0f);
 | 
			
		||||
    drawShadowSection (g, cg, top.removeFromRight (expandedRadius), true, 0, 1.0f, 1.0f, 1.0f);
 | 
			
		||||
    drawShadowSection (g, cg, top, false, 0, 1.0f, 0, 0);
 | 
			
		||||
 | 
			
		||||
    drawShadowSection (g, cg, bottom.removeFromLeft  (expandedRadius), true, 1.0f, 0, 0, 0);
 | 
			
		||||
    drawShadowSection (g, cg, bottom.removeFromRight (expandedRadius), true, 0, 0, 1.0f, 0);
 | 
			
		||||
    drawShadowSection (g, cg, bottom, false, 0, 0, 0, 1.0f);
 | 
			
		||||
 | 
			
		||||
    drawShadowSection (g, cg, r.removeFromLeft  (expandedRadius), false, 1.0f, 0, 0, 0);
 | 
			
		||||
    drawShadowSection (g, cg, r.removeFromRight (expandedRadius), false, 0, 0, 1.0f, 0);
 | 
			
		||||
 | 
			
		||||
    g.setColour (colour);
 | 
			
		||||
    g.fillRect (area);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//==============================================================================
 | 
			
		||||
DropShadowEffect::DropShadowEffect() {}
 | 
			
		||||
DropShadowEffect::~DropShadowEffect() {}
 | 
			
		||||
 | 
			
		||||
void DropShadowEffect::setShadowProperties (const DropShadow& newShadow)
 | 
			
		||||
{
 | 
			
		||||
    shadow = newShadow;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DropShadowEffect::applyEffect (Image& image, Graphics& g, float scaleFactor, float alpha)
 | 
			
		||||
{
 | 
			
		||||
    DropShadow s (shadow);
 | 
			
		||||
    s.radius = roundToInt ((float) s.radius * scaleFactor);
 | 
			
		||||
    s.colour = s.colour.withMultipliedAlpha (alpha);
 | 
			
		||||
    s.offset.x = roundToInt ((float) s.offset.x * scaleFactor);
 | 
			
		||||
    s.offset.y = roundToInt ((float) s.offset.y * scaleFactor);
 | 
			
		||||
 | 
			
		||||
    s.drawForImage (g, image);
 | 
			
		||||
 | 
			
		||||
    g.setOpacity (alpha);
 | 
			
		||||
    g.drawImageAt (image, 0, 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace juce
 | 
			
		||||
 
 | 
			
		||||
@@ -1,113 +1,113 @@
 | 
			
		||||
/*
 | 
			
		||||
  ==============================================================================
 | 
			
		||||
 | 
			
		||||
   This file is part of the JUCE library.
 | 
			
		||||
   Copyright (c) 2020 - Raw Material Software Limited
 | 
			
		||||
 | 
			
		||||
   JUCE is an open source library subject to commercial or open-source
 | 
			
		||||
   licensing.
 | 
			
		||||
 | 
			
		||||
   By using JUCE, you agree to the terms of both the JUCE 6 End-User License
 | 
			
		||||
   Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
 | 
			
		||||
 | 
			
		||||
   End User License Agreement: www.juce.com/juce-6-licence
 | 
			
		||||
   Privacy Policy: www.juce.com/juce-privacy-policy
 | 
			
		||||
 | 
			
		||||
   Or: You may also use this code under the terms of the GPL v3 (see
 | 
			
		||||
   www.gnu.org/licenses).
 | 
			
		||||
 | 
			
		||||
   JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
 | 
			
		||||
   EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
 | 
			
		||||
   DISCLAIMED.
 | 
			
		||||
 | 
			
		||||
  ==============================================================================
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
namespace juce
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
//==============================================================================
 | 
			
		||||
/**
 | 
			
		||||
    Defines a drop-shadow effect.
 | 
			
		||||
 | 
			
		||||
    @tags{Graphics}
 | 
			
		||||
*/
 | 
			
		||||
struct JUCE_API  DropShadow
 | 
			
		||||
{
 | 
			
		||||
    /** Creates a default drop-shadow effect. */
 | 
			
		||||
    DropShadow() = default;
 | 
			
		||||
 | 
			
		||||
    /** Creates a drop-shadow object with the given parameters. */
 | 
			
		||||
    DropShadow (Colour shadowColour, int radius, Point<int> offset) noexcept;
 | 
			
		||||
 | 
			
		||||
    /** Renders a drop-shadow based on the alpha-channel of the given image. */
 | 
			
		||||
    void drawForImage (Graphics& g, const Image& srcImage) const;
 | 
			
		||||
 | 
			
		||||
    /** Renders a drop-shadow based on the shape of a path. */
 | 
			
		||||
    void drawForPath (Graphics& g, const Path& path) const;
 | 
			
		||||
 | 
			
		||||
    /** Renders a drop-shadow for a rectangle.
 | 
			
		||||
        Note that for speed, this approximates the shadow using gradients.
 | 
			
		||||
    */
 | 
			
		||||
    void drawForRectangle (Graphics& g, const Rectangle<int>& area) const;
 | 
			
		||||
 | 
			
		||||
    /** The colour with which to render the shadow.
 | 
			
		||||
        In most cases you'll probably want to leave this as black with an alpha
 | 
			
		||||
        value of around 0.5
 | 
			
		||||
    */
 | 
			
		||||
    Colour colour { 0x90000000 };
 | 
			
		||||
 | 
			
		||||
    /** The approximate spread of the shadow. */
 | 
			
		||||
    int radius { 4 };
 | 
			
		||||
 | 
			
		||||
    /** The offset of the shadow. */
 | 
			
		||||
    Point<int> offset;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
//==============================================================================
 | 
			
		||||
/**
 | 
			
		||||
    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()
 | 
			
		||||
 | 
			
		||||
    @see Component::setComponentEffect
 | 
			
		||||
 | 
			
		||||
    @tags{Graphics}
 | 
			
		||||
*/
 | 
			
		||||
class JUCE_API  DropShadowEffect  : public ImageEffectFilter
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    //==============================================================================
 | 
			
		||||
    /** Creates a default drop-shadow effect.
 | 
			
		||||
        To customise the shadow's appearance, use the setShadowProperties() method.
 | 
			
		||||
    */
 | 
			
		||||
    DropShadowEffect();
 | 
			
		||||
 | 
			
		||||
    /** Destructor. */
 | 
			
		||||
    ~DropShadowEffect() override;
 | 
			
		||||
 | 
			
		||||
    //==============================================================================
 | 
			
		||||
    /** Sets up parameters affecting the shadow's appearance. */
 | 
			
		||||
    void setShadowProperties (const DropShadow& newShadow);
 | 
			
		||||
 | 
			
		||||
    //==============================================================================
 | 
			
		||||
    /** @internal */
 | 
			
		||||
    void applyEffect (Image& sourceImage, Graphics& destContext, float scaleFactor, float alpha) override;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    //==============================================================================
 | 
			
		||||
    DropShadow shadow;
 | 
			
		||||
 | 
			
		||||
    JUCE_LEAK_DETECTOR (DropShadowEffect)
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
} // namespace juce
 | 
			
		||||
/*
 | 
			
		||||
  ==============================================================================
 | 
			
		||||
 | 
			
		||||
   This file is part of the JUCE library.
 | 
			
		||||
   Copyright (c) 2022 - Raw Material Software Limited
 | 
			
		||||
 | 
			
		||||
   JUCE is an open source library subject to commercial or open-source
 | 
			
		||||
   licensing.
 | 
			
		||||
 | 
			
		||||
   By using JUCE, you agree to the terms of both the JUCE 7 End-User License
 | 
			
		||||
   Agreement and JUCE Privacy Policy.
 | 
			
		||||
 | 
			
		||||
   End User License Agreement: www.juce.com/juce-7-licence
 | 
			
		||||
   Privacy Policy: www.juce.com/juce-privacy-policy
 | 
			
		||||
 | 
			
		||||
   Or: You may also use this code under the terms of the GPL v3 (see
 | 
			
		||||
   www.gnu.org/licenses).
 | 
			
		||||
 | 
			
		||||
   JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
 | 
			
		||||
   EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
 | 
			
		||||
   DISCLAIMED.
 | 
			
		||||
 | 
			
		||||
  ==============================================================================
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
namespace juce
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
//==============================================================================
 | 
			
		||||
/**
 | 
			
		||||
    Defines a drop-shadow effect.
 | 
			
		||||
 | 
			
		||||
    @tags{Graphics}
 | 
			
		||||
*/
 | 
			
		||||
struct JUCE_API  DropShadow
 | 
			
		||||
{
 | 
			
		||||
    /** Creates a default drop-shadow effect. */
 | 
			
		||||
    DropShadow() = default;
 | 
			
		||||
 | 
			
		||||
    /** Creates a drop-shadow object with the given parameters. */
 | 
			
		||||
    DropShadow (Colour shadowColour, int radius, Point<int> offset) noexcept;
 | 
			
		||||
 | 
			
		||||
    /** Renders a drop-shadow based on the alpha-channel of the given image. */
 | 
			
		||||
    void drawForImage (Graphics& g, const Image& srcImage) const;
 | 
			
		||||
 | 
			
		||||
    /** Renders a drop-shadow based on the shape of a path. */
 | 
			
		||||
    void drawForPath (Graphics& g, const Path& path) const;
 | 
			
		||||
 | 
			
		||||
    /** Renders a drop-shadow for a rectangle.
 | 
			
		||||
        Note that for speed, this approximates the shadow using gradients.
 | 
			
		||||
    */
 | 
			
		||||
    void drawForRectangle (Graphics& g, const Rectangle<int>& area) const;
 | 
			
		||||
 | 
			
		||||
    /** The colour with which to render the shadow.
 | 
			
		||||
        In most cases you'll probably want to leave this as black with an alpha
 | 
			
		||||
        value of around 0.5
 | 
			
		||||
    */
 | 
			
		||||
    Colour colour { 0x90000000 };
 | 
			
		||||
 | 
			
		||||
    /** The approximate spread of the shadow. */
 | 
			
		||||
    int radius { 4 };
 | 
			
		||||
 | 
			
		||||
    /** The offset of the shadow. */
 | 
			
		||||
    Point<int> offset;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
//==============================================================================
 | 
			
		||||
/**
 | 
			
		||||
    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()
 | 
			
		||||
 | 
			
		||||
    @see Component::setComponentEffect
 | 
			
		||||
 | 
			
		||||
    @tags{Graphics}
 | 
			
		||||
*/
 | 
			
		||||
class JUCE_API  DropShadowEffect  : public ImageEffectFilter
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    //==============================================================================
 | 
			
		||||
    /** Creates a default drop-shadow effect.
 | 
			
		||||
        To customise the shadow's appearance, use the setShadowProperties() method.
 | 
			
		||||
    */
 | 
			
		||||
    DropShadowEffect();
 | 
			
		||||
 | 
			
		||||
    /** Destructor. */
 | 
			
		||||
    ~DropShadowEffect() override;
 | 
			
		||||
 | 
			
		||||
    //==============================================================================
 | 
			
		||||
    /** Sets up parameters affecting the shadow's appearance. */
 | 
			
		||||
    void setShadowProperties (const DropShadow& newShadow);
 | 
			
		||||
 | 
			
		||||
    //==============================================================================
 | 
			
		||||
    /** @internal */
 | 
			
		||||
    void applyEffect (Image& sourceImage, Graphics& destContext, float scaleFactor, float alpha) override;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    //==============================================================================
 | 
			
		||||
    DropShadow shadow;
 | 
			
		||||
 | 
			
		||||
    JUCE_LEAK_DETECTOR (DropShadowEffect)
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
} // namespace juce
 | 
			
		||||
 
 | 
			
		||||
@@ -1,57 +1,57 @@
 | 
			
		||||
/*
 | 
			
		||||
  ==============================================================================
 | 
			
		||||
 | 
			
		||||
   This file is part of the JUCE library.
 | 
			
		||||
   Copyright (c) 2020 - Raw Material Software Limited
 | 
			
		||||
 | 
			
		||||
   JUCE is an open source library subject to commercial or open-source
 | 
			
		||||
   licensing.
 | 
			
		||||
 | 
			
		||||
   By using JUCE, you agree to the terms of both the JUCE 6 End-User License
 | 
			
		||||
   Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
 | 
			
		||||
 | 
			
		||||
   End User License Agreement: www.juce.com/juce-6-licence
 | 
			
		||||
   Privacy Policy: www.juce.com/juce-privacy-policy
 | 
			
		||||
 | 
			
		||||
   Or: You may also use this code under the terms of the GPL v3 (see
 | 
			
		||||
   www.gnu.org/licenses).
 | 
			
		||||
 | 
			
		||||
   JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
 | 
			
		||||
   EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
 | 
			
		||||
   DISCLAIMED.
 | 
			
		||||
 | 
			
		||||
  ==============================================================================
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
namespace juce
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
GlowEffect::GlowEffect() {}
 | 
			
		||||
GlowEffect::~GlowEffect() {}
 | 
			
		||||
 | 
			
		||||
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)
 | 
			
		||||
{
 | 
			
		||||
    Image temp (image.getFormat(), image.getWidth(), image.getHeight(), true);
 | 
			
		||||
 | 
			
		||||
    ImageConvolutionKernel blurKernel (roundToInt (radius * scaleFactor * 2.0f));
 | 
			
		||||
 | 
			
		||||
    blurKernel.createGaussianBlur (radius);
 | 
			
		||||
    blurKernel.rescaleAllValues (radius);
 | 
			
		||||
 | 
			
		||||
    blurKernel.applyToImage (temp, image, image.getBounds());
 | 
			
		||||
 | 
			
		||||
    g.setColour (colour.withMultipliedAlpha (alpha));
 | 
			
		||||
    g.drawImageAt (temp, offset.x, offset.y, true);
 | 
			
		||||
 | 
			
		||||
    g.setOpacity (alpha);
 | 
			
		||||
    g.drawImageAt (image, offset.x, offset.y, false);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace juce
 | 
			
		||||
/*
 | 
			
		||||
  ==============================================================================
 | 
			
		||||
 | 
			
		||||
   This file is part of the JUCE library.
 | 
			
		||||
   Copyright (c) 2022 - Raw Material Software Limited
 | 
			
		||||
 | 
			
		||||
   JUCE is an open source library subject to commercial or open-source
 | 
			
		||||
   licensing.
 | 
			
		||||
 | 
			
		||||
   By using JUCE, you agree to the terms of both the JUCE 7 End-User License
 | 
			
		||||
   Agreement and JUCE Privacy Policy.
 | 
			
		||||
 | 
			
		||||
   End User License Agreement: www.juce.com/juce-7-licence
 | 
			
		||||
   Privacy Policy: www.juce.com/juce-privacy-policy
 | 
			
		||||
 | 
			
		||||
   Or: You may also use this code under the terms of the GPL v3 (see
 | 
			
		||||
   www.gnu.org/licenses).
 | 
			
		||||
 | 
			
		||||
   JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
 | 
			
		||||
   EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
 | 
			
		||||
   DISCLAIMED.
 | 
			
		||||
 | 
			
		||||
  ==============================================================================
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
namespace juce
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
GlowEffect::GlowEffect() {}
 | 
			
		||||
GlowEffect::~GlowEffect() {}
 | 
			
		||||
 | 
			
		||||
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)
 | 
			
		||||
{
 | 
			
		||||
    Image temp (image.getFormat(), image.getWidth(), image.getHeight(), true);
 | 
			
		||||
 | 
			
		||||
    ImageConvolutionKernel blurKernel (roundToInt (radius * scaleFactor * 2.0f));
 | 
			
		||||
 | 
			
		||||
    blurKernel.createGaussianBlur (radius);
 | 
			
		||||
    blurKernel.rescaleAllValues (radius);
 | 
			
		||||
 | 
			
		||||
    blurKernel.applyToImage (temp, image, image.getBounds());
 | 
			
		||||
 | 
			
		||||
    g.setColour (colour.withMultipliedAlpha (alpha));
 | 
			
		||||
    g.drawImageAt (temp, offset.x, offset.y, true);
 | 
			
		||||
 | 
			
		||||
    g.setOpacity (alpha);
 | 
			
		||||
    g.drawImageAt (image, offset.x, offset.y, false);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace juce
 | 
			
		||||
 
 | 
			
		||||
@@ -1,76 +1,76 @@
 | 
			
		||||
/*
 | 
			
		||||
  ==============================================================================
 | 
			
		||||
 | 
			
		||||
   This file is part of the JUCE library.
 | 
			
		||||
   Copyright (c) 2020 - Raw Material Software Limited
 | 
			
		||||
 | 
			
		||||
   JUCE is an open source library subject to commercial or open-source
 | 
			
		||||
   licensing.
 | 
			
		||||
 | 
			
		||||
   By using JUCE, you agree to the terms of both the JUCE 6 End-User License
 | 
			
		||||
   Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
 | 
			
		||||
 | 
			
		||||
   End User License Agreement: www.juce.com/juce-6-licence
 | 
			
		||||
   Privacy Policy: www.juce.com/juce-privacy-policy
 | 
			
		||||
 | 
			
		||||
   Or: You may also use this code under the terms of the GPL v3 (see
 | 
			
		||||
   www.gnu.org/licenses).
 | 
			
		||||
 | 
			
		||||
   JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
 | 
			
		||||
   EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
 | 
			
		||||
   DISCLAIMED.
 | 
			
		||||
 | 
			
		||||
  ==============================================================================
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
namespace juce
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
//==============================================================================
 | 
			
		||||
/**
 | 
			
		||||
    A component effect that adds a coloured blur around the component's contents.
 | 
			
		||||
 | 
			
		||||
    (This will only work on non-opaque components).
 | 
			
		||||
 | 
			
		||||
    @see Component::setComponentEffect, DropShadowEffect
 | 
			
		||||
 | 
			
		||||
    @tags{Graphics}
 | 
			
		||||
*/
 | 
			
		||||
class JUCE_API  GlowEffect  : public ImageEffectFilter
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    //==============================================================================
 | 
			
		||||
    /** Creates a default 'glow' effect.
 | 
			
		||||
        To customise its appearance, use the setGlowProperties() method.
 | 
			
		||||
    */
 | 
			
		||||
    GlowEffect();
 | 
			
		||||
 | 
			
		||||
    /** Destructor. */
 | 
			
		||||
    ~GlowEffect() override;
 | 
			
		||||
 | 
			
		||||
    //==============================================================================
 | 
			
		||||
    /** Sets the glow's radius and colour.
 | 
			
		||||
 | 
			
		||||
        The radius is how large the blur should be, and the colour is
 | 
			
		||||
        used to render it (for a less intense glow, lower the colour's
 | 
			
		||||
        opacity).
 | 
			
		||||
    */
 | 
			
		||||
    void setGlowProperties (float newRadius,
 | 
			
		||||
                            Colour newColour,
 | 
			
		||||
                            Point<int> offset = {});
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    //==============================================================================
 | 
			
		||||
    /** @internal */
 | 
			
		||||
    void applyEffect (Image&, Graphics&, float scaleFactor, float alpha) override;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    //==============================================================================
 | 
			
		||||
    float radius = 2.0f;
 | 
			
		||||
    Colour colour { Colours::white };
 | 
			
		||||
    Point<int> offset;
 | 
			
		||||
 | 
			
		||||
    JUCE_LEAK_DETECTOR (GlowEffect)
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
} // namespace juce
 | 
			
		||||
/*
 | 
			
		||||
  ==============================================================================
 | 
			
		||||
 | 
			
		||||
   This file is part of the JUCE library.
 | 
			
		||||
   Copyright (c) 2022 - Raw Material Software Limited
 | 
			
		||||
 | 
			
		||||
   JUCE is an open source library subject to commercial or open-source
 | 
			
		||||
   licensing.
 | 
			
		||||
 | 
			
		||||
   By using JUCE, you agree to the terms of both the JUCE 7 End-User License
 | 
			
		||||
   Agreement and JUCE Privacy Policy.
 | 
			
		||||
 | 
			
		||||
   End User License Agreement: www.juce.com/juce-7-licence
 | 
			
		||||
   Privacy Policy: www.juce.com/juce-privacy-policy
 | 
			
		||||
 | 
			
		||||
   Or: You may also use this code under the terms of the GPL v3 (see
 | 
			
		||||
   www.gnu.org/licenses).
 | 
			
		||||
 | 
			
		||||
   JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
 | 
			
		||||
   EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
 | 
			
		||||
   DISCLAIMED.
 | 
			
		||||
 | 
			
		||||
  ==============================================================================
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
namespace juce
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
//==============================================================================
 | 
			
		||||
/**
 | 
			
		||||
    A component effect that adds a coloured blur around the component's contents.
 | 
			
		||||
 | 
			
		||||
    (This will only work on non-opaque components).
 | 
			
		||||
 | 
			
		||||
    @see Component::setComponentEffect, DropShadowEffect
 | 
			
		||||
 | 
			
		||||
    @tags{Graphics}
 | 
			
		||||
*/
 | 
			
		||||
class JUCE_API  GlowEffect  : public ImageEffectFilter
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    //==============================================================================
 | 
			
		||||
    /** Creates a default 'glow' effect.
 | 
			
		||||
        To customise its appearance, use the setGlowProperties() method.
 | 
			
		||||
    */
 | 
			
		||||
    GlowEffect();
 | 
			
		||||
 | 
			
		||||
    /** Destructor. */
 | 
			
		||||
    ~GlowEffect() override;
 | 
			
		||||
 | 
			
		||||
    //==============================================================================
 | 
			
		||||
    /** Sets the glow's radius and colour.
 | 
			
		||||
 | 
			
		||||
        The radius is how large the blur should be, and the colour is
 | 
			
		||||
        used to render it (for a less intense glow, lower the colour's
 | 
			
		||||
        opacity).
 | 
			
		||||
    */
 | 
			
		||||
    void setGlowProperties (float newRadius,
 | 
			
		||||
                            Colour newColour,
 | 
			
		||||
                            Point<int> offset = {});
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    //==============================================================================
 | 
			
		||||
    /** @internal */
 | 
			
		||||
    void applyEffect (Image&, Graphics&, float scaleFactor, float alpha) override;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    //==============================================================================
 | 
			
		||||
    float radius = 2.0f;
 | 
			
		||||
    Colour colour { Colours::white };
 | 
			
		||||
    Point<int> offset;
 | 
			
		||||
 | 
			
		||||
    JUCE_LEAK_DETECTOR (GlowEffect)
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
} // namespace juce
 | 
			
		||||
 
 | 
			
		||||
@@ -1,71 +1,71 @@
 | 
			
		||||
/*
 | 
			
		||||
  ==============================================================================
 | 
			
		||||
 | 
			
		||||
   This file is part of the JUCE library.
 | 
			
		||||
   Copyright (c) 2020 - Raw Material Software Limited
 | 
			
		||||
 | 
			
		||||
   JUCE is an open source library subject to commercial or open-source
 | 
			
		||||
   licensing.
 | 
			
		||||
 | 
			
		||||
   By using JUCE, you agree to the terms of both the JUCE 6 End-User License
 | 
			
		||||
   Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
 | 
			
		||||
 | 
			
		||||
   End User License Agreement: www.juce.com/juce-6-licence
 | 
			
		||||
   Privacy Policy: www.juce.com/juce-privacy-policy
 | 
			
		||||
 | 
			
		||||
   Or: You may also use this code under the terms of the GPL v3 (see
 | 
			
		||||
   www.gnu.org/licenses).
 | 
			
		||||
 | 
			
		||||
   JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
 | 
			
		||||
   EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
 | 
			
		||||
   DISCLAIMED.
 | 
			
		||||
 | 
			
		||||
  ==============================================================================
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
namespace juce
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
//==============================================================================
 | 
			
		||||
/**
 | 
			
		||||
    A graphical effect filter that can be applied to components.
 | 
			
		||||
 | 
			
		||||
    An ImageEffectFilter can be applied to the image that a component
 | 
			
		||||
    paints before it hits the screen.
 | 
			
		||||
 | 
			
		||||
    This is used for adding effects like shadows, blurs, etc.
 | 
			
		||||
 | 
			
		||||
    @see Component::setComponentEffect
 | 
			
		||||
 | 
			
		||||
    @tags{Graphics}
 | 
			
		||||
*/
 | 
			
		||||
class JUCE_API  ImageEffectFilter
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    //==============================================================================
 | 
			
		||||
    /** 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.
 | 
			
		||||
 | 
			
		||||
        @param 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.
 | 
			
		||||
        @param destContext      the graphics context to use to draw the resultant image.
 | 
			
		||||
        @param scaleFactor      a scale factor that has been applied to the image - e.g. if
 | 
			
		||||
                                this is 2, then the image is actually scaled-up to twice the
 | 
			
		||||
                                original resolution
 | 
			
		||||
        @param alpha            the alpha with which to draw the resultant image to the
 | 
			
		||||
                                target context
 | 
			
		||||
    */
 | 
			
		||||
    virtual void applyEffect (Image& sourceImage,
 | 
			
		||||
                              Graphics& destContext,
 | 
			
		||||
                              float scaleFactor,
 | 
			
		||||
                              float alpha) = 0;
 | 
			
		||||
 | 
			
		||||
    /** Destructor. */
 | 
			
		||||
    virtual ~ImageEffectFilter() = default;
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
} // namespace juce
 | 
			
		||||
/*
 | 
			
		||||
  ==============================================================================
 | 
			
		||||
 | 
			
		||||
   This file is part of the JUCE library.
 | 
			
		||||
   Copyright (c) 2022 - Raw Material Software Limited
 | 
			
		||||
 | 
			
		||||
   JUCE is an open source library subject to commercial or open-source
 | 
			
		||||
   licensing.
 | 
			
		||||
 | 
			
		||||
   By using JUCE, you agree to the terms of both the JUCE 7 End-User License
 | 
			
		||||
   Agreement and JUCE Privacy Policy.
 | 
			
		||||
 | 
			
		||||
   End User License Agreement: www.juce.com/juce-7-licence
 | 
			
		||||
   Privacy Policy: www.juce.com/juce-privacy-policy
 | 
			
		||||
 | 
			
		||||
   Or: You may also use this code under the terms of the GPL v3 (see
 | 
			
		||||
   www.gnu.org/licenses).
 | 
			
		||||
 | 
			
		||||
   JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
 | 
			
		||||
   EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
 | 
			
		||||
   DISCLAIMED.
 | 
			
		||||
 | 
			
		||||
  ==============================================================================
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
namespace juce
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
//==============================================================================
 | 
			
		||||
/**
 | 
			
		||||
    A graphical effect filter that can be applied to components.
 | 
			
		||||
 | 
			
		||||
    An ImageEffectFilter can be applied to the image that a component
 | 
			
		||||
    paints before it hits the screen.
 | 
			
		||||
 | 
			
		||||
    This is used for adding effects like shadows, blurs, etc.
 | 
			
		||||
 | 
			
		||||
    @see Component::setComponentEffect
 | 
			
		||||
 | 
			
		||||
    @tags{Graphics}
 | 
			
		||||
*/
 | 
			
		||||
class JUCE_API  ImageEffectFilter
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    //==============================================================================
 | 
			
		||||
    /** 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.
 | 
			
		||||
 | 
			
		||||
        @param 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.
 | 
			
		||||
        @param destContext      the graphics context to use to draw the resultant image.
 | 
			
		||||
        @param scaleFactor      a scale factor that has been applied to the image - e.g. if
 | 
			
		||||
                                this is 2, then the image is actually scaled-up to twice the
 | 
			
		||||
                                original resolution
 | 
			
		||||
        @param alpha            the alpha with which to draw the resultant image to the
 | 
			
		||||
                                target context
 | 
			
		||||
    */
 | 
			
		||||
    virtual void applyEffect (Image& sourceImage,
 | 
			
		||||
                              Graphics& destContext,
 | 
			
		||||
                              float scaleFactor,
 | 
			
		||||
                              float alpha) = 0;
 | 
			
		||||
 | 
			
		||||
    /** Destructor. */
 | 
			
		||||
    virtual ~ImageEffectFilter() = default;
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
} // namespace juce
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user