|
Gin
|
An image and an ImageFilter version of it, blended by an Animated<float> amount: 0 shows the image, 1 the filtered one, e.g. More...
#include <gin_animated.h>
Public Member Functions | |
| AnimatedImageFilter (juce::Component &owner, const juce::String &property="imageFilter") | |
| ~AnimatedImageFilter () | |
| void | setImage (const MipMap &image) |
| Sets the image; the filtered version is built again if it differs. | |
| void | setFilter (const ImageFilter &filter) |
| Sets the filter; the filtered version is built again if it differs. | |
| void | setFilter (const juce::String &spec) |
| void | draw (juce::Graphics &g, juce::Rectangle< float > area, juce::RectanglePlacement placement=0) const |
| Draws the blend at the amount's current value. | |
| const MipMap & | getImage () const |
| const MipMap & | getFilteredImage () const |
Public Attributes | |
| Animated< float > | amount |
| 0 = the image, 1 = the filtered one | |
An image and an ImageFilter version of it, blended by an Animated<float> amount: 0 shows the image, 1 the filtered one, e.g.
a contrast boost while hovered. Only what is drawn through draw() is filtered, never the owner's other painting or its children.
The filter is applied once to the full size image and a second MipMap built from the result; that happens again only when the image or the filter changes, so painting at any size or scale (HiDPI) costs two MipMap::draw calls at most (see drawBlend).
The amount's transition comes from the layout like any Animated's ("imageFilter" by default). The owner's "states" (see States) drive it: a state with an "imageFilter" spec sets the filter and eases the amount to 1 while it is active, back to 0 after:
Without states, set the filter and drive amount yourself.
| AnimatedImageFilter::AnimatedImageFilter | ( | juce::Component & | owner, |
| const juce::String & | property = "imageFilter" ) |
| owner | The component that repaints on every step, whose layout transitions and states apply |
| property | The name the layout's "transition" object knows the amount by |
| AnimatedImageFilter::~AnimatedImageFilter | ( | ) |
| void AnimatedImageFilter::setImage | ( | const MipMap & | image | ) |
Sets the image; the filtered version is built again if it differs.
| void AnimatedImageFilter::setFilter | ( | const ImageFilter & | filter | ) |
Sets the filter; the filtered version is built again if it differs.
An invalid spec asserts and counts as no filter.
| void AnimatedImageFilter::setFilter | ( | const juce::String & | spec | ) |
| void AnimatedImageFilter::draw | ( | juce::Graphics & | g, |
| juce::Rectangle< float > | area, | ||
| juce::RectanglePlacement | placement = 0 ) const |
Draws the blend at the amount's current value.
| const MipMap & AnimatedImageFilter::getImage | ( | ) | const |
| const MipMap & AnimatedImageFilter::getFilteredImage | ( | ) | const |
| Animated<float> AnimatedImageFilter::amount |
0 = the image, 1 = the filtered one