Class SubstanceImageWatermark
java.lang.Object
org.pushingpixels.substance.api.watermark.SubstanceImageWatermark
- All Implemented Interfaces:
SubstanceTrait,SubstanceWatermark
Implementation of
SubstanceWatermark, drawing specified image as
watermark. This class is part of officially supported API.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BufferedImageThe original image (as read from the disk / HTTP connection).protected StringThe original image location.protected ImageWatermark image (screen-sized). -
Constructor Summary
ConstructorsConstructorDescriptionSubstanceImageWatermark(InputStream inputStream) Creates an instance from the specified input stream.SubstanceImageWatermark(String imageLocation) Creates an instance with specified image. -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()Disposes the memory associated withthiswatermark.voiddrawWatermarkImage(Graphics graphics, Component c, int x, int y, int width, int height) Draws the watermark on the specified graphics context in the specified region.Returns the display name ofthistrait.getKind()Returns the image watermark kind.floatReturns the image watermark opacity.Returns the location of the original image.voidpreviewWatermark(Graphics g, SubstanceSkin skin, int x, int y, int width, int height) Draws the preview of the watermark image.voidSets image watermark kind.voidsetOpacity(float opacity) Sets image watermark opacity.booleanUpdates the current watermark image.
-
Field Details
-
watermarkImage
Watermark image (screen-sized). -
origImage
The original image (as read from the disk / HTTP connection). -
origImageLocation
The original image location.
-
-
Constructor Details
-
SubstanceImageWatermark
Creates an instance with specified image.- Parameters:
imageLocation- Image location. Can point to a local file or HTTP URL (needs to start withhttpin the later case).
-
SubstanceImageWatermark
Creates an instance from the specified input stream.- Parameters:
inputStream- Input stream.
-
-
Method Details
-
drawWatermarkImage
Description copied from interface:SubstanceWatermarkDraws the watermark on the specified graphics context in the specified region.- Specified by:
drawWatermarkImagein interfaceSubstanceWatermark- Parameters:
graphics- Graphics context.c- Component that is painted.x- Left X of the region.y- Top Y of the region.width- Region width.height- Region height.
-
previewWatermark
Description copied from interface:SubstanceWatermarkDraws the preview of the watermark image.- Specified by:
previewWatermarkin interfaceSubstanceWatermark- Parameters:
g- Graphic context.skin- Optional skin to use for the preview. Can be ignored by the implementation.x- the x coordinate of the watermark to be drawn.y- The y coordinate of the watermark to be drawn.width- The width of the watermark to be drawn.height- The height of the watermark to be drawn.
-
updateWatermarkImage
Description copied from interface:SubstanceWatermarkUpdates the current watermark image.- Specified by:
updateWatermarkImagein interfaceSubstanceWatermark- Parameters:
skin- Skin for the watermark.- Returns:
trueif the watermark has been updated successfully,falseotherwise.
-
getDisplayName
Description copied from interface:SubstanceTraitReturns the display name ofthistrait. This method is part of officially supported API.- Specified by:
getDisplayNamein interfaceSubstanceTrait- Returns:
- The display name of
thistrait.
-
dispose
public void dispose()Description copied from interface:SubstanceWatermarkDisposes the memory associated withthiswatermark.- Specified by:
disposein interfaceSubstanceWatermark
-
getOrigImageLocation
Returns the location of the original image.- Returns:
- The location of the original image.
-
setKind
Sets image watermark kind.- Parameters:
kind- Image watermark kind.
-
getKind
Returns the image watermark kind.- Returns:
- Image watermark kind.
-
getOpacity
public float getOpacity()Returns the image watermark opacity.- Returns:
- Image watermark opacity.
-
setOpacity
public void setOpacity(float opacity) Sets image watermark opacity.- Parameters:
opacity- Image watermark opacity.- Throws:
IllegalArgumentException- if the argument is not in 0.0-1.0 range.
-