Class Watermark
- java.lang.Object
-
- net.coobird.thumbnailator.filters.Watermark
-
- All Implemented Interfaces:
ImageFilter
public class Watermark extends java.lang.Object implements ImageFilter
This class applies a watermark to an image.
-
-
Field Summary
Fields Modifier and Type Field Description private intinsetsThe insets for the watermark.private floatopacityThe opacity of the watermark.private PositionpositionThe position of the watermark.private java.awt.image.BufferedImagewatermarkImgThe watermark image.
-
Constructor Summary
Constructors Constructor Description Watermark(Position position, java.awt.image.BufferedImage watermarkImg, float opacity)Instantiates a filter which applies a watermark to an image.Watermark(Position position, java.awt.image.BufferedImage watermarkImg, float opacity, int insets)Instantiates a filter which applies a watermark to an image.
-
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.
-
-
-
Field Detail
-
position
private final Position position
The position of the watermark.
-
watermarkImg
private final java.awt.image.BufferedImage watermarkImg
The watermark image.
-
opacity
private final float opacity
The opacity of the watermark.
-
insets
private final int insets
The insets for the watermark.
-
-
Constructor Detail
-
Watermark
public Watermark(Position position, java.awt.image.BufferedImage watermarkImg, float opacity, int insets)
Instantiates a filter which applies a watermark to an image.- Parameters:
position- The position of the watermark.watermarkImg- The watermark image.opacity- The opacity of the watermark.The value should be between
0.0fand1.0f, where0.0fis completely transparent, and1.0fis completely opaque.insets- Inset size around the watermark. Cannot be negative.
-
Watermark
public Watermark(Position position, java.awt.image.BufferedImage watermarkImg, float opacity)
Instantiates a filter which applies a watermark to an image.- Parameters:
position- The position of the watermark.watermarkImg- The watermark image.opacity- The opacity of the watermark.The value should be between
0.0fand1.0f, where0.0fis completely transparent, and1.0fis completely opaque.
-
-
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.
-
-