public.javadoc.org.spincast.plugins.watermarker.SpincastImageWatermarkerDefault.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spincast-website Show documentation
Show all versions of spincast-website Show documentation
Source code for the https://www.spincast.org website.
SpincastImageWatermarkerDefault (org.spincast:spincast-framework 1.0.0 API)
org.spincast.plugins.watermarker
Class SpincastImageWatermarkerDefault
- java.lang.Object
-
- org.spincast.plugins.watermarker.SpincastImageWatermarkerDefault
-
- All Implemented Interfaces:
- SpincastImageWatermarker
public class SpincastImageWatermarkerDefault
extends Object
implements SpincastImageWatermarker
-
-
Constructor Summary
Constructors
Constructor and Description
SpincastImageWatermarkerDefault(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
-
-
Constructor Detail
-
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 Detail
-
getWatermarkerId
protected String getWatermarkerId()
-
getText
public String getText()
-
getTextColor
public Color getTextColor()
-
getBackgroundColor
public Color getBackgroundColor()
-
getTextFont
public Font getTextFont()
-
getImageFilePath
public String getImageFilePath()
-
isImageFileOnClasspath
public boolean isImageFileOnClasspath()
-
getPosition
public net.coobird.thumbnailator.geometry.Position getPosition()
-
getMargin
public Integer getMargin()
-
getOpacity
public float getOpacity()
-
getPercentageWidth
public int getPercentageWidth()
-
getBorderWidth
public Integer getBorderWidth()
-
getBorderColor
public Color getBorderColor()
-
getSpincastUtils
protected SpincastUtils getSpincastUtils()
-
getSpincastConfig
protected SpincastConfig getSpincastConfig()
-
toThumbnailatorPosition
protected net.coobird.thumbnailator.geometry.Position toThumbnailatorPosition(SpincastWatermarkPosition position,
Integer margin)
-
getMainTempDir
protected File getMainTempDir()
-
getWatermarkImagesTempDir
protected File getWatermarkImagesTempDir()
-
isImageWatermark
protected boolean isImageWatermark()
-
getDefaultFont
protected Font getDefaultFont()
-
createTextWatermarkBaseImage
protected BufferedImage createTextWatermarkBaseImage()
-
getFontSizeToCreateTextWatermarkBaseImage
protected float getFontSizeToCreateTextWatermarkBaseImage()
-
getWatermarkOriginalImage
protected BufferedImage getWatermarkOriginalImage()
-
getWatermarkImageForWidth
protected BufferedImage getWatermarkImageForWidth(int width)
-
addBorder
protected BufferedImage addBorder(BufferedImage watermarkImg)
-
getTargetWatermarkImageWidth
protected int getTargetWatermarkImageWidth(BufferedImage originalImage)
-
watermark
public void watermark(String originalImagePath,
File targetFile)
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 interface SpincastImageWatermarker
targetFile
- The file where the watermarked version will
be saved. If this file already exists, it is overwritten.
-
watermark
public void watermark(String originalImagePath,
boolean onClasspath,
File targetFile)
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 interface SpincastImageWatermarker
onClasspath
- If true
, 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.
Copyright © 2019. All rights reserved.