Package org.spincast.plugins.watermarker
Class SpincastImageWatermarkerDefault
java.lang.Object
org.spincast.plugins.watermarker.SpincastImageWatermarkerDefault
- All Implemented Interfaces:
SpincastImageWatermarker
-
Constructor Summary
ConstructorDescriptionSpincastImageWatermarkerDefault
(String text, Color textColor, Color backgroundColor, Font textFont, String imageFilePath, boolean imageFileOnClasspath, SpincastWatermarkPosition position, Integer margin, Float opacity, Integer percentageWidth, Integer borderWidth, Color borderColor, SpincastUtils spincastUtils, SpincastConfig spincastConfig) -
Method Summary
Modifier and TypeMethodDescriptionprotected BufferedImage
addBorder
(BufferedImage watermarkImg) protected BufferedImage
protected Font
protected float
protected File
float
protected String
getOutputType
(File targetFile) int
net.coobird.thumbnailator.geometry.Position
protected SpincastConfig
protected SpincastUtils
protected int
getTargetWatermarkImageWidth
(BufferedImage originalImage) getText()
protected String
protected BufferedImage
getWatermarkImageForWidth
(int width) protected File
protected BufferedImage
boolean
protected boolean
protected net.coobird.thumbnailator.geometry.Position
toThumbnailatorPosition
(SpincastWatermarkPosition position, Integer margin) void
Watermark an image.void
Watermark an image.
-
Constructor Details
-
SpincastImageWatermarkerDefault
public SpincastImageWatermarkerDefault(@Nullable String text, @Nullable Color textColor, @Nullable Color backgroundColor, @Nullable Font textFont, @Nullable String imageFilePath, boolean imageFileOnClasspath, @Nullable SpincastWatermarkPosition position, @Nullable Integer margin, @Nullable Float opacity, @Nullable Integer percentageWidth, @Nullable Integer borderWidth, @Nullable Color borderColor, SpincastUtils spincastUtils, SpincastConfig spincastConfig)
-
-
Method Details
-
getWatermarkerId
-
getText
-
getTextColor
-
getBackgroundColor
-
getTextFont
-
getImageFilePath
-
isImageFileOnClasspath
public boolean isImageFileOnClasspath() -
getPosition
public net.coobird.thumbnailator.geometry.Position getPosition() -
getMargin
-
getOpacity
public float getOpacity() -
getPercentageWidth
public int getPercentageWidth() -
getBorderWidth
-
getBorderColor
-
getSpincastUtils
-
getSpincastConfig
-
toThumbnailatorPosition
protected net.coobird.thumbnailator.geometry.Position toThumbnailatorPosition(SpincastWatermarkPosition position, Integer margin) -
getMainTempDir
-
getWatermarkImagesTempDir
-
isImageWatermark
protected boolean isImageWatermark() -
getDefaultFont
-
createTextWatermarkBaseImage
-
getFontSizeToCreateTextWatermarkBaseImage
protected float getFontSizeToCreateTextWatermarkBaseImage() -
getWatermarkOriginalImage
-
getWatermarkImageForWidth
-
addBorder
-
getTargetWatermarkImageWidth
-
watermark
Description copied from interface:SpincastImageWatermarker
Watermark an image.The format of the watermaked image is determined by the extension of the
targetFile
(case-insensitive):- .jpg or .jpeg => JPEG
- .gif => GIF
- .png => PNG
If the target file doesn't have any extension, PNG is used.
- Specified by:
watermark
in interfaceSpincastImageWatermarker
targetFile
- The file where the watermarked version will be saved. If this file already exists, it is overwritten.
-
watermark
Description copied from interface:SpincastImageWatermarker
Watermark an image.The format of the watermaked image is determined by the extension of the
targetFile
(case-insensitive):- .jpg or .jpeg => JPEG
- .gif => GIF
- .png => PNG
If the target file doesn't have any extension, PNG is used.
- Specified by:
watermark
in interfaceSpincastImageWatermarker
onClasspath
- Iftrue
, the original image will be taken from the classpath. Otherwise its path must be a path on the file system.targetFile
- The file where the watermarked version will be saved. If this file already exists, it is overwritten.
-
getOutputType
-