Gin
Loading...
Searching...
No Matches
Files | Enumerations | Functions

Files

file  gin_imageeffects.h
 Image processing effects and filters.
 

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)
 

Detailed Description

Enumeration Type Documentation

◆ ResizeAlgorirm

Image resize algorithms for high-quality scaling.

Both algorithms provide superior quality compared to basic interpolation, using sinc function-based fractional delay filters.

See also
applyResize
Enumerator
avir 

AVIR algorithm - high quality, balanced speed/quality.

lanczos 

Lanczos algorithm - excellent quality, slightly slower.

◆ 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:

  • Normal: Standard alpha compositing
  • Multiply: Darkens image, useful for shadows
  • Screen: Lightens image, useful for highlights
  • Overlay: Combines Multiply and Screen based on luminance
  • Add: Adds colors together, creates bright effects
See also
applyBlend
Enumerator
Normal 

Standard alpha blending.

Lighten 

Selects lighter of source and destination.

Darken 

Selects darker of source and destination.

Multiply 

Multiplies colors (darkens)

Average 

Averages source and destination.

Add 

Adds colors together (brightens)

Subtract 

Subtracts source from destination.

Difference 

Absolute difference between colors.

Negation 

Inverted difference.

Screen 

Inverse multiply (lightens)

Exclusion 

Similar to Difference but lower contrast.

Overlay 

Combines Multiply and Screen based on destination.

SoftLight 

Subtle lighting effect.

HardLight 

Strong lighting effect.

ColorDodge 

Brightens based on source.

ColorBurn 

Darkens based on source.

LinearDodge 

Same as Add.

LinearBurn 

Linear burn effect.

LinearLight 

Combination of LinearDodge and LinearBurn.

VividLight 

Combination of ColorDodge and ColorBurn.

PinLight 

Replaces colors based on blend color.

HardMix 

Posterizes to limited colors.

Reflect 

Brightening reflect effect.

Glow 

Inverse reflect.

Phoenix 

Similar to glow with different formula.

Function Documentation

◆ applyVignette()

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.

Parameters
imgThe image to modify (modified in-place)
amountDarkness amount [0, 1]. 0 = no darkening, 1 = black edges
radiusVignette size [0, 1]. 1 = full image size, 0 = no vignette
falloffTransition size [0, 1]. Controls softness of vignette edge
threadPoolOptional thread pool for parallel processing

◆ applySepia()

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.

Parameters
imgThe image to modify (modified in-place)
threadPoolOptional thread pool for parallel processing

◆ applyGreyScale()

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.

Parameters
imgThe image to modify (modified in-place)
threadPoolOptional thread pool for parallel processing

◆ applySoften()

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.

Parameters
imgThe image to modify (modified in-place)
threadPoolOptional thread pool for parallel processing

◆ applySharpen()

void applySharpen ( juce::Image &  img,
juce::ThreadPool *  threadPool = nullptr 
)

Sharpens an image by enhancing edges.

Increases image sharpness and edge definition using convolution.

Parameters
imgThe image to modify (modified in-place)
threadPoolOptional thread pool for parallel processing

◆ applyGamma()

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.

Parameters
imgThe image to modify (modified in-place)
gammaGamma value (typically 0.1 to 10.0, 1.0 = no change)
threadPoolOptional thread pool for parallel processing

◆ applyInvert()

void applyInvert ( juce::Image &  img,
juce::ThreadPool *  threadPool = nullptr 
)

Inverts all colors in an image.

Creates a negative/inverse effect by inverting RGB values.

Parameters
imgThe image to modify (modified in-place)
threadPoolOptional thread pool for parallel processing

◆ applyContrast()

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.

Parameters
imgThe image to modify (modified in-place)
contrastContrast adjustment [-100, 100]. Negative = decrease, positive = increase
threadPoolOptional thread pool for parallel processing

◆ applyBrightnessContrast()

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.

Parameters
imgThe image to modify (modified in-place)
brightnessBrightness adjustment [-100, 100]. Negative = darker, positive = brighter
contrastContrast adjustment [-100, 100]. Negative = decrease, positive = increase
threadPoolOptional thread pool for parallel processing

◆ applyHueSaturationLightness()

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).

Parameters
imgThe image to modify (modified in-place)
hueHue shift [-180, 180] degrees. 0 = no change
saturationSaturation adjustment [0, 200]. 100 = no change, 0 = greyscale
lightnessLightness adjustment [-100, 100]. 0 = no change
threadPoolOptional thread pool for parallel processing

◆ applyStackBlur()

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.

Parameters
imgThe image to modify (modified in-place)
radiusBlur radius [2, 254]. Larger values = more blur

◆ applyResize() [1/2]

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.

Parameters
imgThe source image (not modified)
widthTarget width in pixels
heightTarget height in pixels
resizeAlgorirmAlgorithm to use (default: avir)
Returns
New resized image

◆ applyResize() [2/2]

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.

Parameters
imgThe source image (not modified)
factorScale factor (e.g., 0.5 = half size, 2.0 = double size)
resizeAlgorirmAlgorithm to use (default: avir)
Returns
New resized image

◆ applyGradientMap() [1/2]

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.

Parameters
imgThe image to modify (modified in-place)
gradientThe color gradient to map brightness values to
threadPoolOptional thread pool for parallel processing

◆ applyGradientMap() [2/2]

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.

Parameters
imgThe image to modify (modified in-place)
c1Color for black/dark pixels
c2Color for white/bright pixels
threadPoolOptional thread pool for parallel processing

◆ applyColour()

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.

Parameters
imgThe image to modify (modified in-place)
cThe color to fill with
threadPoolOptional thread pool for parallel processing

◆ applyBlend() [1/2]

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.

Parameters
dstDestination image (modified in-place)
srcSource image to blend on top
modeBlending mode to use
alphaOpacity of the blend [0, 1]. 0 = invisible, 1 = fully opaque
positionPosition to place source image (default: 0,0)
threadPoolOptional thread pool for parallel processing

◆ applyBlend() [2/2]

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.

Parameters
dstDestination image (modified in-place)
modeBlending mode to use
cColor to blend with
threadPoolOptional thread pool for parallel processing

◆ channelBlendNormal()

uint8_t channelBlendNormal ( int  A,
int   
)

◆ channelBlendLighten()

uint8_t channelBlendLighten ( int  A,
int  B 
)

Referenced by channelBlendPinLight().

◆ channelBlendDarken()

uint8_t channelBlendDarken ( int  A,
int  B 
)

Referenced by channelBlendPinLight().

◆ channelBlendMultiply()

uint8_t channelBlendMultiply ( int  A,
int  B 
)

◆ channelBlendAverage()

uint8_t channelBlendAverage ( int  A,
int  B 
)

◆ channelBlendAdd()

uint8_t channelBlendAdd ( int  A,
int  B 
)

Referenced by channelBlendLinearDodge().

◆ channelBlendSubtract()

uint8_t channelBlendSubtract ( int  A,
int  B 
)

Referenced by channelBlendLinearBurn().

◆ channelBlendDifference()

uint8_t channelBlendDifference ( int  A,
int  B 
)

◆ channelBlendNegation()

uint8_t channelBlendNegation ( int  A,
int  B 
)

◆ channelBlendScreen()

uint8_t channelBlendScreen ( int  A,
int  B 
)

◆ channelBlendExclusion()

uint8_t channelBlendExclusion ( int  A,
int  B 
)

◆ channelBlendOverlay()

uint8_t channelBlendOverlay ( int  A,
int  B 
)

Referenced by channelBlendHardLight().

◆ channelBlendSoftLight()

uint8_t channelBlendSoftLight ( int  A,
int  B 
)

◆ channelBlendHardLight()

uint8_t channelBlendHardLight ( int  A,
int  B 
)

References channelBlendOverlay().

◆ channelBlendColorDodge()

uint8_t channelBlendColorDodge ( int  A,
int  B 
)

Referenced by channelBlendVividLight().

◆ channelBlendColorBurn()

uint8_t channelBlendColorBurn ( int  A,
int  B 
)

Referenced by channelBlendVividLight().

◆ channelBlendLinearDodge()

uint8_t channelBlendLinearDodge ( int  A,
int  B 
)

References channelBlendAdd().

Referenced by channelBlendLinearLight().

◆ channelBlendLinearBurn()

uint8_t channelBlendLinearBurn ( int  A,
int  B 
)

◆ channelBlendLinearLight()

uint8_t channelBlendLinearLight ( int  A,
int  B 
)

◆ channelBlendVividLight()

uint8_t channelBlendVividLight ( int  A,
int  B 
)

◆ channelBlendPinLight()

uint8_t channelBlendPinLight ( int  A,
int  B 
)

◆ channelBlendHardMix()

uint8_t channelBlendHardMix ( int  A,
int  B 
)

◆ channelBlendReflect()

uint8_t channelBlendReflect ( int  A,
int  B 
)

Referenced by channelBlendGlow().

◆ channelBlendGlow()

uint8_t channelBlendGlow ( int  A,
int  B 
)

References channelBlendReflect().

◆ channelBlendPhoenix()

uint8_t channelBlendPhoenix ( int  A,
int  B 
)

◆ channelBlendAlpha()

uint8_t channelBlendAlpha ( uint8_t  A,
uint8_t  B,
float  O 
)