|
Gin
|
Files | |
| file | gin_imageeffects.h |
| Image processing effects and filters. | |
Classes | |
| struct | MipMapEnhance |
| Post-processing of a MipMap's reduced levels, off by default. More... | |
| class | MipMap |
| An image with its halved levels down to 16 px, each halving a rounded 2x2 box average, so drawing it smaller picks the nearest larger level and stays sharp without aliasing. More... | |
Enumerations | |
| enum class | ResizeAlgorirm { ResizeAlgorirm::avir , ResizeAlgorirm::lanczos } |
| Image resize algorithms for high-quality scaling. More... | |
| enum | BlendMode { Normal , Lighten , Darken , Multiply , Average , Add , Subtract , Difference , Negation , Screen , Exclusion , Overlay , SoftLight , HardLight , ColorDodge , ColorBurn , LinearDodge , LinearBurn , LinearLight , VividLight , PinLight , HardMix , Reflect , Glow , Phoenix } |
| Blending modes for image compositing. More... | |
Functions | |
| void | applyVignette (juce::Image &img, float amount, float radius, float falloff, juce::ThreadPool *threadPool=nullptr) |
| Applies a vignette effect to an image. | |
| void | applySepia (juce::Image &img, juce::ThreadPool *threadPool=nullptr) |
| Applies a sepia tone effect to an image. | |
| void | applyGreyScale (juce::Image &img, juce::ThreadPool *threadPool=nullptr) |
| Converts an image to greyscale. | |
| void | applySoften (juce::Image &img, juce::ThreadPool *threadPool=nullptr) |
| Softens an image by reducing detail. | |
| void | applySharpen (juce::Image &img, juce::ThreadPool *threadPool=nullptr) |
| Sharpens an image by enhancing edges. | |
| void | applyGamma (juce::Image &img, float gamma, juce::ThreadPool *threadPool=nullptr) |
| Applies gamma correction to an image. | |
| void | applyInvert (juce::Image &img, juce::ThreadPool *threadPool=nullptr) |
| Inverts all colors in an image. | |
| void | applyContrast (juce::Image &img, float contrast, juce::ThreadPool *threadPool=nullptr) |
| Adjusts the contrast of an image. | |
| void | applyBrightnessContrast (juce::Image &img, float brightness, float contrast, juce::ThreadPool *threadPool=nullptr) |
| Adjusts brightness and contrast of an image. | |
| void | applyHueSaturationLightness (juce::Image &img, float hue, float saturation, float lightness, juce::ThreadPool *threadPool=nullptr) |
| Adjusts hue, saturation and lightness of an image. | |
| void | applyStackBlur (juce::Image &img, int radius) |
| Applies a fast, high-quality blur to an image. | |
| juce::Image | applyResize (const juce::Image &img, int width, int height, ResizeAlgorirm resizeAlgorirm=ResizeAlgorirm::avir) |
| Resizes an image to specific dimensions using high-quality algorithm. | |
| juce::Image | applyResize (const juce::Image &img, float factor, ResizeAlgorirm resizeAlgorirm=ResizeAlgorirm::avir) |
| Resizes an image by a scaling factor. | |
| void | applyGradientMap (juce::Image &img, const juce::ColourGradient &gradient, juce::ThreadPool *threadPool=nullptr) |
| Applies a gradient map to an image. | |
| void | applyGradientMap (juce::Image &img, const juce::Colour c1, const juce::Colour c2, juce::ThreadPool *threadPool=nullptr) |
| Applies a two-color gradient map to an image. | |
| void | applyColour (juce::Image &img, juce::Colour c, juce::ThreadPool *threadPool=nullptr) |
| Sets all pixels in an image to a solid color. | |
| void | applyBlend (juce::Image &dst, const juce::Image &src, BlendMode mode, float alpha=1.0f, juce::Point< int > position={}, juce::ThreadPool *threadPool=nullptr) |
| Blends two images using the specified blend mode. | |
| void | applyBlend (juce::Image &dst, BlendMode mode, juce::Colour c, juce::ThreadPool *threadPool=nullptr) |
| Blends a solid color onto an image using the specified blend mode. | |
| uint8_t | channelBlendNormal (int A, int) |
| uint8_t | channelBlendLighten (int A, int B) |
| uint8_t | channelBlendDarken (int A, int B) |
| uint8_t | channelBlendMultiply (int A, int B) |
| uint8_t | channelBlendAverage (int A, int B) |
| uint8_t | channelBlendAdd (int A, int B) |
| uint8_t | channelBlendSubtract (int A, int B) |
| uint8_t | channelBlendDifference (int A, int B) |
| uint8_t | channelBlendNegation (int A, int B) |
| uint8_t | channelBlendScreen (int A, int B) |
| uint8_t | channelBlendExclusion (int A, int B) |
| uint8_t | channelBlendOverlay (int A, int B) |
| uint8_t | channelBlendSoftLight (int A, int B) |
| uint8_t | channelBlendHardLight (int A, int B) |
| uint8_t | channelBlendColorDodge (int A, int B) |
| uint8_t | channelBlendColorBurn (int A, int B) |
| uint8_t | channelBlendLinearDodge (int A, int B) |
| uint8_t | channelBlendLinearBurn (int A, int B) |
| uint8_t | channelBlendLinearLight (int A, int B) |
| uint8_t | channelBlendVividLight (int A, int B) |
| uint8_t | channelBlendPinLight (int A, int B) |
| uint8_t | channelBlendHardMix (int A, int B) |
| uint8_t | channelBlendReflect (int A, int B) |
| uint8_t | channelBlendGlow (int A, int B) |
| uint8_t | channelBlendPhoenix (int A, int B) |
| uint8_t | channelBlendAlpha (uint8_t A, uint8_t B, float O) |
| void | drawBlend (juce::Graphics &g, const MipMap &a, const MipMap &b, float progress, juce::Rectangle< float > rc, juce::RectanglePlacement placement=0) |
| Draws a blend of two MipMaps in the same rectangle, each through MipMap::draw: a at full opacity, then b on top at progress. | |
|
strong |
Image resize algorithms for high-quality scaling.
Both algorithms provide superior quality compared to basic interpolation, using sinc function-based fractional delay filters.
| Enumerator | |
|---|---|
| avir | AVIR algorithm - high quality, balanced speed/quality. |
| lanczos | Lanczos algorithm - excellent quality, slightly slower. |
| enum BlendMode |
Blending modes for image compositing.
Defines how two images are combined when using applyBlend. Each mode produces different visual effects based on how source and destination pixel values interact.
Common modes:
| void applyVignette | ( | juce::Image & | img, |
| float | amount, | ||
| float | radius, | ||
| float | falloff, | ||
| juce::ThreadPool * | threadPool = nullptr ) |
Applies a vignette effect to an image.
Darkens the edges of the image, creating a focus effect towards the center. Commonly used for artistic photography effects.
| img | The image to modify (modified in-place) |
| amount | Darkness amount [0, 1]. 0 = no darkening, 1 = black edges |
| radius | Vignette size [0, 1]. 1 = full image size, 0 = no vignette |
| falloff | Transition size [0, 1]. Controls softness of vignette edge |
| threadPool | Optional thread pool for parallel processing |
| void applySepia | ( | juce::Image & | img, |
| juce::ThreadPool * | threadPool = nullptr ) |
Applies a sepia tone effect to an image.
Converts the image to warm brown tones, creating a vintage/aged photograph look.
| img | The image to modify (modified in-place) |
| threadPool | Optional thread pool for parallel processing |
| void applyGreyScale | ( | juce::Image & | img, |
| juce::ThreadPool * | threadPool = nullptr ) |
Converts an image to greyscale.
Uses weighted RGB conversion with heavier weighting towards green channel, which better matches human luminance perception.
| img | The image to modify (modified in-place) |
| threadPool | Optional thread pool for parallel processing |
| void applySoften | ( | juce::Image & | img, |
| juce::ThreadPool * | threadPool = nullptr ) |
Softens an image by reducing detail.
Applies a subtle blur to reduce image sharpness and detail.
| img | The image to modify (modified in-place) |
| threadPool | Optional thread pool for parallel processing |
| void applySharpen | ( | juce::Image & | img, |
| juce::ThreadPool * | threadPool = nullptr ) |
Sharpens an image by enhancing edges.
Increases image sharpness and edge definition using convolution.
| img | The image to modify (modified in-place) |
| threadPool | Optional thread pool for parallel processing |
| void applyGamma | ( | juce::Image & | img, |
| float | gamma, | ||
| juce::ThreadPool * | threadPool = nullptr ) |
Applies gamma correction to an image.
Adjusts the brightness curve of the image non-linearly. Gamma < 1 brightens, gamma > 1 darkens.
| img | The image to modify (modified in-place) |
| gamma | Gamma value (typically 0.1 to 10.0, 1.0 = no change) |
| threadPool | Optional thread pool for parallel processing |
| void applyInvert | ( | juce::Image & | img, |
| juce::ThreadPool * | threadPool = nullptr ) |
Inverts all colors in an image.
Creates a negative/inverse effect by inverting RGB values.
| img | The image to modify (modified in-place) |
| threadPool | Optional thread pool for parallel processing |
| void applyContrast | ( | juce::Image & | img, |
| float | contrast, | ||
| juce::ThreadPool * | threadPool = nullptr ) |
Adjusts the contrast of an image.
Modifies the difference between light and dark areas.
| img | The image to modify (modified in-place) |
| contrast | Contrast adjustment [-100, 100]. Negative = decrease, positive = increase |
| threadPool | Optional thread pool for parallel processing |
| void applyBrightnessContrast | ( | juce::Image & | img, |
| float | brightness, | ||
| float | contrast, | ||
| juce::ThreadPool * | threadPool = nullptr ) |
Adjusts brightness and contrast of an image.
Combines brightness and contrast adjustments in a single pass.
| img | The image to modify (modified in-place) |
| brightness | Brightness adjustment [-100, 100]. Negative = darker, positive = brighter |
| contrast | Contrast adjustment [-100, 100]. Negative = decrease, positive = increase |
| threadPool | Optional thread pool for parallel processing |
| void applyHueSaturationLightness | ( | juce::Image & | img, |
| float | hue, | ||
| float | saturation, | ||
| float | lightness, | ||
| juce::ThreadPool * | threadPool = nullptr ) |
Adjusts hue, saturation and lightness of an image.
Modifies color properties in HSL color space, allowing independent control of hue (color), saturation (intensity), and lightness (brightness).
| img | The image to modify (modified in-place) |
| hue | Hue shift [-180, 180] degrees. 0 = no change |
| saturation | Saturation adjustment [0, 200]. 100 = no change, 0 = greyscale |
| lightness | Lightness adjustment [-100, 100]. 0 = no change |
| threadPool | Optional thread pool for parallel processing |
| void applyStackBlur | ( | juce::Image & | img, |
| int | radius ) |
Applies a fast, high-quality blur to an image.
Uses stack blur algorithm - a compromise between Gaussian blur quality and box blur speed. Produces much better results than box blur while being ~7x faster than traditional Gaussian blur implementations.
| img | The image to modify (modified in-place) |
| radius | Blur radius [2, 254]. Larger values = more blur |
| juce::Image applyResize | ( | const juce::Image & | img, |
| int | width, | ||
| int | height, | ||
| ResizeAlgorirm | resizeAlgorirm = ResizeAlgorirm::avir ) |
Resizes an image to specific dimensions using high-quality algorithm.
Uses sinc function-based fractional delay filters for superior quality compared to basic bilinear/bicubic interpolation.
| img | The source image (not modified) |
| width | Target width in pixels |
| height | Target height in pixels |
| resizeAlgorirm | Algorithm to use (default: avir) |
References avir.
| juce::Image applyResize | ( | const juce::Image & | img, |
| float | factor, | ||
| ResizeAlgorirm | resizeAlgorirm = ResizeAlgorirm::avir ) |
Resizes an image by a scaling factor.
Convenience overload that scales proportionally by a factor.
| img | The source image (not modified) |
| factor | Scale factor (e.g., 0.5 = half size, 2.0 = double size) |
| resizeAlgorirm | Algorithm to use (default: avir) |
References avir.
| void applyGradientMap | ( | juce::Image & | img, |
| const juce::ColourGradient & | gradient, | ||
| juce::ThreadPool * | threadPool = nullptr ) |
Applies a gradient map to an image.
Remaps the brightness of each pixel to a color from the gradient. Black pixels map to the start of the gradient, white pixels to the end, with smooth interpolation between.
| img | The image to modify (modified in-place) |
| gradient | The color gradient to map brightness values to |
| threadPool | Optional thread pool for parallel processing |
| void applyGradientMap | ( | juce::Image & | img, |
| const juce::Colour | c1, | ||
| const juce::Colour | c2, | ||
| juce::ThreadPool * | threadPool = nullptr ) |
Applies a two-color gradient map to an image.
Convenience overload that creates a linear gradient between two colors.
| img | The image to modify (modified in-place) |
| c1 | Color for black/dark pixels |
| c2 | Color for white/bright pixels |
| threadPool | Optional thread pool for parallel processing |
| void applyColour | ( | juce::Image & | img, |
| juce::Colour | c, | ||
| juce::ThreadPool * | threadPool = nullptr ) |
Sets all pixels in an image to a solid color.
Fills the entire image with the specified color, preserving alpha if present.
| img | The image to modify (modified in-place) |
| c | The color to fill with |
| threadPool | Optional thread pool for parallel processing |
| void applyBlend | ( | juce::Image & | dst, |
| const juce::Image & | src, | ||
| BlendMode | mode, | ||
| float | alpha = 1.0f, | ||
| juce::Point< int > | position = {}, | ||
| juce::ThreadPool * | threadPool = nullptr ) |
Blends two images using the specified blend mode.
Composites a source image onto a destination image using various blending algorithms. The destination image is modified in-place.
| dst | Destination image (modified in-place) |
| src | Source image to blend on top |
| mode | Blending mode to use |
| alpha | Opacity of the blend [0, 1]. 0 = invisible, 1 = fully opaque |
| position | Position to place source image (default: 0,0) |
| threadPool | Optional thread pool for parallel processing |
| void applyBlend | ( | juce::Image & | dst, |
| BlendMode | mode, | ||
| juce::Colour | c, | ||
| juce::ThreadPool * | threadPool = nullptr ) |
Blends a solid color onto an image using the specified blend mode.
Applies a blend mode with a solid color across the entire image.
| dst | Destination image (modified in-place) |
| mode | Blending mode to use |
| c | Color to blend with |
| threadPool | Optional thread pool for parallel processing |
| uint8_t channelBlendNormal | ( | int | A, |
| int | ) |
| uint8_t channelBlendLighten | ( | int | A, |
| int | B ) |
Referenced by channelBlendPinLight().
| uint8_t channelBlendDarken | ( | int | A, |
| int | B ) |
Referenced by channelBlendPinLight().
| uint8_t channelBlendMultiply | ( | int | A, |
| int | B ) |
| uint8_t channelBlendAverage | ( | int | A, |
| int | B ) |
| uint8_t channelBlendAdd | ( | int | A, |
| int | B ) |
Referenced by channelBlendLinearDodge().
| uint8_t channelBlendSubtract | ( | int | A, |
| int | B ) |
Referenced by channelBlendLinearBurn().
| uint8_t channelBlendDifference | ( | int | A, |
| int | B ) |
| uint8_t channelBlendNegation | ( | int | A, |
| int | B ) |
| uint8_t channelBlendScreen | ( | int | A, |
| int | B ) |
| uint8_t channelBlendExclusion | ( | int | A, |
| int | B ) |
| uint8_t channelBlendOverlay | ( | int | A, |
| int | B ) |
Referenced by channelBlendHardLight().
| uint8_t channelBlendSoftLight | ( | int | A, |
| int | B ) |
| uint8_t channelBlendHardLight | ( | int | A, |
| int | B ) |
References channelBlendOverlay().
| uint8_t channelBlendColorDodge | ( | int | A, |
| int | B ) |
Referenced by channelBlendVividLight().
| uint8_t channelBlendColorBurn | ( | int | A, |
| int | B ) |
Referenced by channelBlendVividLight().
| uint8_t channelBlendLinearDodge | ( | int | A, |
| int | B ) |
References channelBlendAdd().
Referenced by channelBlendLinearLight().
| uint8_t channelBlendLinearBurn | ( | int | A, |
| int | B ) |
References channelBlendSubtract().
Referenced by channelBlendLinearLight().
| uint8_t channelBlendLinearLight | ( | int | A, |
| int | B ) |
References channelBlendLinearBurn(), and channelBlendLinearDodge().
| uint8_t channelBlendVividLight | ( | int | A, |
| int | B ) |
References channelBlendColorBurn(), and channelBlendColorDodge().
Referenced by channelBlendHardMix().
| uint8_t channelBlendPinLight | ( | int | A, |
| int | B ) |
References channelBlendDarken(), and channelBlendLighten().
| uint8_t channelBlendHardMix | ( | int | A, |
| int | B ) |
References channelBlendVividLight().
| uint8_t channelBlendReflect | ( | int | A, |
| int | B ) |
Referenced by channelBlendGlow().
| uint8_t channelBlendGlow | ( | int | A, |
| int | B ) |
References channelBlendReflect().
| uint8_t channelBlendPhoenix | ( | int | A, |
| int | B ) |
| uint8_t channelBlendAlpha | ( | uint8_t | A, |
| uint8_t | B, | ||
| float | O ) |
| void drawBlend | ( | juce::Graphics & | g, |
| const MipMap & | a, | ||
| const MipMap & | b, | ||
| float | progress, | ||
| juce::Rectangle< float > | rc, | ||
| juce::RectanglePlacement | placement = 0 ) |
Draws a blend of two MipMaps in the same rectangle, each through MipMap::draw: a at full opacity, then b on top at progress.
0 draws only a, 1 only b. An empty side is skipped.