Package ca.cgjennings.graphics.filters
Class BloomFilter
- java.lang.Object
-
- ca.cgjennings.graphics.filters.AbstractImageFilter
-
- ca.cgjennings.graphics.filters.BlurFilter
-
- ca.cgjennings.graphics.filters.BloomFilter
-
- All Implemented Interfaces:
java.awt.image.BufferedImageOp
public class BloomFilter extends BlurFilter
An image filter that applies a bloom effect to images. Bloom adds bright, blurry fringes around the bright areas of an image.In-place filtering: This class supports in-place filtering (the source and destination images can be the same).
- Since:
- 3.0
- Author:
- Chris Jennings
-
-
Constructor Summary
Constructors Constructor Description BloomFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.image.BufferedImage
filter(java.awt.image.BufferedImage src, java.awt.image.BufferedImage dst)
Applies the bloom filter to an image, storing the result in the specified destination.float
getStrength()
Returns the strength of the bloom effect, between 0 and 1.float
getThreshold()
Returns the brightness threshold for applying bloom effect.void
setStrength(float strength)
Sets the strength of the bloom effect.void
setThreshold(float threshold)
Sets the brightness threshold for applying bloom effect.-
Methods inherited from class ca.cgjennings.graphics.filters.BlurFilter
getHorizontalRadius, getIterations, getVerticalRadius, isPremultiplied, setHorizontalRadius, setIterations, setPremultiplied, setRadius, setVerticalRadius
-
Methods inherited from class ca.cgjennings.graphics.filters.AbstractImageFilter
clamp, clamp, clamp, clampBoth, createCompatibleDestImage, fA, fB, fG, fR, getARGB, getARGB, getARGBSynch, getBounds2D, getPoint2D, getRenderingHints, iA, iB, iG, iR, setARGB, setARGB, setARGBSynch
-
-
-
-
Method Detail
-
getStrength
public float getStrength()
Returns the strength of the bloom effect, between 0 and 1.- Returns:
- the strength of the bloom glow
-
setStrength
public void setStrength(float strength)
Sets the strength of the bloom effect. The bloom strength must be between 0 and 1 inclusive. The higher the value, the brighter the glow caused by the bloom.- Parameters:
strength
- the bloom strength, between 0 to 1
-
getThreshold
public float getThreshold()
Returns the brightness threshold for applying bloom effect. This is a value between 0 and 1 that defines the minimum brightness of a pixel before the bloom effect will show through.- Returns:
- the brightness threshold, from 0 to 1
-
setThreshold
public void setThreshold(float threshold)
Sets the brightness threshold for applying bloom effect. This is a value between 0 and 1 that defines the minimum brightness of a pixel before the bloom effect will show through. For pixels above the threshold, the strength of the bloom effect is proportional to the amount that the brightness exceeds the threshold.- Parameters:
threshold
- the brightness threshold, from 0 to 1
-
filter
public java.awt.image.BufferedImage filter(java.awt.image.BufferedImage src, java.awt.image.BufferedImage dst)
Applies the bloom filter to an image, storing the result in the specified destination.- Specified by:
filter
in interfacejava.awt.image.BufferedImageOp
- Overrides:
filter
in classBlurFilter
- Parameters:
src
- the source image to blurdst
- the destination image to copy the result to, ornull
- Returns:
- the destination image
-
-