|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jvnet.substance.watermark.SubstanceImageWatermark
public class SubstanceImageWatermark
Implementation of SubstanceWatermark
, drawing specified image as
watermark. This class is part of officially supported API.
Field Summary | |
---|---|
protected java.awt.image.BufferedImage |
origImage
The original image (as read from the disk / HTTP connection). |
protected java.lang.String |
origImageLocation
The original image location. |
protected static java.awt.Image |
watermarkImage
Watermark image (screen-sized). |
Constructor Summary | |
---|---|
SubstanceImageWatermark(java.io.InputStream inputStream)
Creates an instance from the specified input stream. |
|
SubstanceImageWatermark(ParamReader paramReader)
Simple constructor. |
|
SubstanceImageWatermark(java.lang.String imageLocation)
Creates an instance with specified image. |
Method Summary | |
---|---|
void |
dispose()
Disposes the memory associated with this watermark. |
void |
drawWatermarkImage(java.awt.Graphics graphics,
java.awt.Component c,
int x,
int y,
int width,
int height)
Draws the watermark on the specified graphics context in the specified region. |
java.lang.String |
getDisplayName()
Returns the display name of this trait. |
static SubstanceConstants.ImageWatermarkKind |
getKind()
Returns the image watermark kind. |
static java.lang.String |
getName()
Returns the name of all watermarks of this class. |
static float |
getOpacity()
Returns the image watermark opacity. |
java.lang.String |
getOrigImageLocation()
Returns the location of the original image. |
boolean |
isDependingOnTheme()
Returns indication whether this watermark depends on the
current SubstanceTheme . |
void |
previewWatermark(java.awt.Graphics g,
int x,
int y,
int width,
int height)
Draws the preview of the watermark image. |
static void |
setKind(SubstanceConstants.ImageWatermarkKind kind)
Sets image watermark kind. |
static void |
setOpacity(float opacity)
Sets image watermark opacity. |
boolean |
updateWatermarkImage()
Updates the current watermark image. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static java.awt.Image watermarkImage
protected java.awt.image.BufferedImage origImage
protected java.lang.String origImageLocation
Constructor Detail |
---|
public SubstanceImageWatermark(ParamReader paramReader) throws java.security.AccessControlException
ParamReader.getWatermarkImageProperty()
to retrieve the location of the image. Note that this constructor can
throw AccessControlException if this class is used in unsecure JNLP
environment. However, in this case we must have access to local disk in
any case since we need to read the image.
paramReader
- Substance parameter reader instance.
java.security.AccessControlException
- if this class is used in unsecure JNLP environmentpublic SubstanceImageWatermark(java.lang.String imageLocation)
imageLocation
- Image location. Can point to a local file or HTTP URL (needs
to start with http
in the later case).public SubstanceImageWatermark(java.io.InputStream inputStream)
inputStream
- Input stream.Method Detail |
---|
public void drawWatermarkImage(java.awt.Graphics graphics, java.awt.Component c, int x, int y, int width, int height)
SubstanceWatermark
drawWatermarkImage
in interface SubstanceWatermark
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.public void previewWatermark(java.awt.Graphics g, int x, int y, int width, int height)
SubstanceWatermark
previewWatermark
in interface SubstanceWatermark
g
- Graphic context.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.public boolean updateWatermarkImage()
SubstanceWatermark
updateWatermarkImage
in interface SubstanceWatermark
true
if the watermark has been updated
successfully, false
otherwise.public java.lang.String getDisplayName()
SubstanceTrait
this
trait. This method is
part of officially supported API.
getDisplayName
in interface SubstanceTrait
getDisplayName
in interface SubstanceWatermark
this
trait.public static java.lang.String getName()
this
class.
this
class.public boolean isDependingOnTheme()
SubstanceWatermark
this
watermark depends on the
current SubstanceTheme
.
isDependingOnTheme
in interface SubstanceWatermark
true
if this
watermark depends on
the current SubstanceTheme
,
false
otherwise.public void dispose()
SubstanceWatermark
this
watermark.
dispose
in interface SubstanceWatermark
public java.lang.String getOrigImageLocation()
public static void setKind(SubstanceConstants.ImageWatermarkKind kind)
kind
- Image watermark kind.public static SubstanceConstants.ImageWatermarkKind getKind()
public static float getOpacity()
public static void setOpacity(float opacity)
opacity
- Image watermark opacity.
java.lang.IllegalArgumentException
- if the argument is not in 0.0-1.0 range.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |