|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.day.cq.wcm.foundation.ImageHelper
public class ImageHelper
ImageHelper...
| Constructor Summary | |
|---|---|
ImageHelper()
|
|
| Method Summary | |
|---|---|
static com.day.image.Layer |
createLayer(Item item)
Creates a layer of the given item. |
static com.day.image.Layer |
createLayer(Node node,
String imageName,
String refName)
Creates a layer either by the node addressed by imageName or
the referenced image addressed by the refName property. |
static com.day.image.Layer |
createLayer(org.apache.sling.api.resource.Resource resource)
Creates a layer from the given resource. |
static com.day.image.Layer |
createLayer(Session session,
String path)
Creates a layer of the given item addressed by the path. |
static Rectangle |
getCropRect(String rectCSV,
String path)
Parses a CSV string of the form "x1,y1,x2,y2" and returns the respective rectangle. |
static Color |
parseColor(String s)
Converts a String to an integer and returns the
specified Color. |
static Color |
parseColor(String s,
int alpha)
Converts a String to an integer and returns the
specified Color. |
static int |
parseFontStyle(String... styles)
Parses the font style from the given string(s). |
static com.day.image.Layer |
resize(com.day.image.Layer layer,
Dimension d,
Dimension min,
Dimension max)
Resizes the given layer according to the given dimensions. |
static Node |
saveLayer(com.day.image.Layer layer,
String type,
double quality,
Node parent,
String filename,
boolean replace)
Saves the layer as nt:file below the given node. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ImageHelper()
| Method Detail |
|---|
public static Rectangle getCropRect(String rectCSV,
String path)
null is
returned.
rectCSV - the rectangle coordinatespath - optional path for debugging
null
public static com.day.image.Layer createLayer(Node node,
String imageName,
String refName)
throws RepositoryException,
IOException
imageName or
the referenced image addressed by the refName property.
node - the current nodeimageName - the name of the image noderefName - the name of the reference property
null
RepositoryException - if a repository error occurs
IOException - if a I/O error occurs
public static com.day.image.Layer createLayer(Session session,
String path)
throws RepositoryException,
IOException
session - to use for retrieving the itempath - to the item
null
RepositoryException - if a repository error occurs
IOException - if a I/O error occurspublic static com.day.image.Layer createLayer(org.apache.sling.api.resource.Resource resource)
InputStream null is returned.
resource - resource
null
public static com.day.image.Layer createLayer(Item item)
throws RepositoryException,
IOException
item - the item
null
RepositoryException - if a repository error occurs
IOException - if a I/O error occurspublic static int parseFontStyle(String... styles)
| style string | return |
|---|---|
| bold | AbstractFont.BOLD |
| italic | AbstractFont.ITALIC |
| underline | AbstractFont.UNDERLINE |
| strikeout | AbstractFont.STRIKEOUT |
| all other | AbstractFont.PLAIN |
styles - the styles
public static com.day.image.Layer resize(com.day.image.Layer layer,
Dimension d,
Dimension min,
Dimension max)
null
is returned.
Examples:
layer - layer to resize.d - dimensionmin - minimal dimension constraintsmax - maximal dimension constraints
null if untouched.public static Color parseColor(String s)
String to an integer and returns the
specified Color. This method handles string
formats that are used to represent octal and hexadecimal numbers.
If the string cannot be converted an transparent black is returned.
s - a String that represents an RGBA color as a 32-bit integer
Color object.Integer.decode(java.lang.String)
public static Color parseColor(String s,
int alpha)
String to an integer and returns the
specified Color. This method handles string
formats that are used to represent octal and hexadecimal numbers.
If the string cannot be converted an transparent black is returned.
s - a String that represents an RGB color as a 24-bit integeralpha - override the alpha setting
Color object.Integer.decode(java.lang.String)
public static Node saveLayer(com.day.image.Layer layer,
String type,
double quality,
Node parent,
String filename,
boolean replace)
throws RepositoryException,
IOException
layer - the layer to savetype - image type. eg "image/png"quality - image quality. eg 1.0parent - parent nodefilename - file namereplace - if true existing node are replaced rather than updated.
RepositoryException - if a repository error occurrs
IOException - if an I/O error occurrs
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||