Class Colorize
- java.lang.Object
-
- net.coobird.thumbnailator.filters.Colorize
-
- All Implemented Interfaces:
ImageFilter
public final class Colorize extends java.lang.Object implements ImageFilter
An image filter which will add a color tint to an image.
-
-
Field Summary
Fields Modifier and Type Field Description private java.awt.ColorcThe color to tint a target image with.
-
Constructor Summary
Constructors Constructor Description Colorize(java.awt.Color c)Instantiates this filter with the color to use to tint the target image with.Colorize(java.awt.Color c, float alpha)Instantiates this filter with the color to use to tint the target image with and the transparency level provided as afloatranging from0.0fto1.0f, where0.0findicates completely transparent, and1.0findicates completely opaque.Colorize(java.awt.Color c, int alpha)Instantiates this filter with the color to use to tint the target image with and the transparency level provided as aintranging from0to255, where0indicates completely transparent, and255indicates completely opaque.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.image.BufferedImageapply(java.awt.image.BufferedImage img)Applies a image filtering operation on an image.
-
-
-
Constructor Detail
-
Colorize
public Colorize(java.awt.Color c)
Instantiates this filter with the color to use to tint the target image with.Note: If the provided
Colordoes not have an alpha channel (transparency channel), then the target image will be painted with an opaque color, resulting in an image with only the specified color.- Parameters:
c- Color to tint with.
-
Colorize
public Colorize(java.awt.Color c, float alpha)Instantiates this filter with the color to use to tint the target image with and the transparency level provided as afloatranging from0.0fto1.0f, where0.0findicates completely transparent, and1.0findicates completely opaque.- Parameters:
c- Color to tint with.alpha- The opacity of the tint.
-
Colorize
public Colorize(java.awt.Color c, int alpha)Instantiates this filter with the color to use to tint the target image with and the transparency level provided as aintranging from0to255, where0indicates completely transparent, and255indicates completely opaque.- Parameters:
c- Color to tint with.alpha- The opacity of the tint.
-
-
Method Detail
-
apply
public java.awt.image.BufferedImage apply(java.awt.image.BufferedImage img)
Description copied from interface:ImageFilterApplies a image filtering operation on an image.- Specified by:
applyin interfaceImageFilter- Parameters:
img- The image to apply the filtering on.- Returns:
- The resulting image after applying this filter.
-
-