public class ImageResource extends DownloadResource
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
PN_ALT
name of the alt name property
|
static java.lang.String |
PN_HEIGHT
name of the height property
|
static java.lang.String |
PN_HTML_HEIGHT
name of the html height property
|
static java.lang.String |
PN_HTML_WIDTH
name of the html width property
|
static java.lang.String |
PN_IMAGE_CROP
name of the image crop property
|
static java.lang.String |
PN_IMAGE_ROTATE
name of the image rotation property
|
static java.lang.String |
PN_LINK_URL
name of the link URL property
|
static java.lang.String |
PN_MAX_HEIGHT
name of the maximal height property.
|
static java.lang.String |
PN_MAX_WIDTH
name of the maximal width property.
|
static java.lang.String |
PN_MIN_HEIGHT
name of the minimal height property.
|
static java.lang.String |
PN_MIN_WIDTH
name of the minimal width property.
|
static java.lang.String |
PN_WIDTH
name of the width property
|
NN_FILE, PN_DESCRIPTION, PN_FILE_NAME, PN_REFERENCE, PN_TITLE| Constructor and Description |
|---|
ImageResource(Node node)
Creates a new image based on the given resource.
|
ImageResource(Node resource,
java.lang.String imageName)
Creates a new image based on the given resource.
|
| Modifier and Type | Method and Description |
|---|---|
Layer |
crop(Layer layer)
Crops the layer using the internal crop rectangle.
|
void |
draw(java.io.Writer w)
Writes this image as tag to the given writer by invoking
doDraw(PrintWriter) if canDraw() returns true. |
java.lang.String |
getAlt()
Returns the image alt name as defined by the "alt"
or overridden by
setAlt(String). |
java.awt.Rectangle |
getCropRect()
Returns the cropping rectangle as defined by the "imageCrop".
|
java.lang.String |
getExtension()
Tries to calculate the extension from the mime-type of the underlying
image.
|
Layer |
getLayer(boolean cropped,
boolean resized,
boolean rotated)
Returns the layer addressed by this image.
|
int |
getRotation()
Returns the rotation angle as defined by the "imageRotate".
|
java.lang.String |
getSrc()
Returns the source attribute of this image.
|
Layer |
resize(Layer layer)
Resizes the given layer according to the dimensions defined in this image.
|
Layer |
rotate(Layer layer)
Rotates the layer using the internal rotation angle.
|
void |
setAlt(java.lang.String alt)
Sets the alt name.
|
void |
setExtension(java.lang.String extension)
Sets the extension.
|
void |
setSrc(java.lang.String src)
Sets the source attribute
|
addAttribute, addCssClass, get, get, getAttributes, getData, getDescription, getDescription, getFileName, getFileNodePath, getFileReference, getHref, getIconPath, getIconType, getInnerHtml, getItemName, getLastModified, getMimeType, getPath, getSelector, getString, getSuffix, getTitle, getTitle, hasContent, init, set, setDescription, setFileName, setFileNodePath, setFileReference, setHref, setInnerHtml, setItemName, setSelector, setSuffix, setTitlepublic static final java.lang.String PN_HTML_WIDTH
public static final java.lang.String PN_HTML_HEIGHT
public static final java.lang.String PN_WIDTH
public static final java.lang.String PN_HEIGHT
public static final java.lang.String PN_MIN_WIDTH
public static final java.lang.String PN_MIN_HEIGHT
public static final java.lang.String PN_MAX_WIDTH
public static final java.lang.String PN_MAX_HEIGHT
public static final java.lang.String PN_ALT
public static final java.lang.String PN_IMAGE_CROP
public static final java.lang.String PN_IMAGE_ROTATE
public static final java.lang.String PN_LINK_URL
public ImageResource(Node node)
node - resource of the imagejava.lang.IllegalArgumentException - if the given resource is not adaptable to node.public ImageResource(Node resource,
java.lang.String imageName)
imageName
is specified. then the respective child resource holds the image
properties.resource - current resourceimageName - name of the image resourcejava.lang.IllegalArgumentException - if the given resource is not adaptable to node.public java.lang.String getAlt()
setAlt(String).PN_ALTpublic void setAlt(java.lang.String alt)
alt - the alt name.public java.lang.String getSrc()
public java.lang.String getExtension()
getExtension in class DownloadResourcepublic void setExtension(java.lang.String extension)
DownloadResourcesetExtension in class DownloadResourceextension - the extension.public void setSrc(java.lang.String src)
src - the source attributepublic void draw(java.io.Writer w)
throws java.io.IOException
doDraw(PrintWriter) if canDraw() returns true.draw in class DownloadResourcew - the writerjava.io.IOException - if an I/O error occurspublic java.awt.Rectangle getCropRect()
nullpublic int getRotation()
public Layer resize(Layer layer)
ImageHelper.resize(Layer, Dimension, Dimension, Dimension)
for more details about the resizing algorithm.layer - the layer to resizenull if the layer is untouchedpublic Layer crop(Layer layer)
null is returned.layer - the layernullpublic Layer rotate(Layer layer)
null is returned.layer - the layernullpublic Layer getLayer(boolean cropped, boolean resized, boolean rotated) throws java.io.IOException, RepositoryException
cropped - apply cropping if trueresized - apply resizing if truerotated - apply rotation if truejava.io.IOException - if an I/O error occurs.RepositoryException - if a repository error occurs."Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"