Package ca.cgjennings.layout
Class GraphicStyleFactory
- java.lang.Object
-
- ca.cgjennings.layout.GraphicStyleFactory
-
- All Implemented Interfaces:
ParametricStyleFactory
public final class GraphicStyleFactory extends java.lang.Object implements ParametricStyleFactory
A style factory that creates text styles that replace selections with images. This factory is not normally created directly, but rather is used indirectly from aMarkupRenderer
.- Since:
- 1.5
- Author:
- Chris Jennings
-
-
Constructor Summary
Constructors Constructor Description GraphicStyleFactory(double ppi)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description TextStyle
createStyle(MarkupRenderer renderer, java.lang.String[] parameters)
Create a style based on a list of parameters to be parsed, typically from an <image> tag.TextStyle
createStyle(StrangeImage i)
TextStyle
createStyle(StrangeImage i, int alignment)
TextStyle
createStyle(StrangeImage i, int alignment, double width, double height, float originX, float originY)
static java.awt.image.BufferedImage
fetchImage(java.lang.String identifier)
Deprecated.UseStrangeImage.get(java.lang.String)
to load user images so that you can work with both bitmap and vector images transparently.static java.awt.image.BufferedImage
getMissingImage()
Deprecated.UseStrangeImage
to load user images andResourceKit.getMissingImage()
orStrangeImage.getMissingImage()
to get the missing image as aBufferedImage
orStrangeImage
, respectively.double
getResolution()
static boolean
imageExists(java.lang.String identifier)
Deprecated.static boolean
isURLString(java.lang.String identifier)
Deprecated.UseStrangeImage
to load user images and!StrangeImage.isFileIdentifier( identifier )
as a replacement for this call.void
setResolution(double ppi)
static java.net.URL
translatePathToImageURL(java.lang.String identifier)
Deprecated.static java.lang.String
translateRelativePath(java.lang.String path, java.io.File base)
Returns an absolute path for a file identifier that is relative to a known base file.
-
-
-
Method Detail
-
setResolution
public void setResolution(double ppi)
-
getResolution
public double getResolution()
-
createStyle
public TextStyle createStyle(MarkupRenderer renderer, java.lang.String[] parameters)
Create a style based on a list of parameters to be parsed, typically from an <image> tag. The format of the parameters is as follows:
url [width [height]] [alignment [offset]]
- Specified by:
createStyle
in interfaceParametricStyleFactory
-
translateRelativePath
public static java.lang.String translateRelativePath(java.lang.String path, java.io.File base)
Returns an absolute path for a file identifier that is relative to a known base file.- Parameters:
path
- the path to make absolutebase
- the base folder that the path is relative to- Returns:
- an absolute identifier, or the original identifier if it is already absolute
-
createStyle
public TextStyle createStyle(StrangeImage i)
-
createStyle
public TextStyle createStyle(StrangeImage i, int alignment)
-
createStyle
public TextStyle createStyle(StrangeImage i, int alignment, double width, double height, float originX, float originY)
-
fetchImage
@Deprecated public static java.awt.image.BufferedImage fetchImage(java.lang.String identifier)
Deprecated.UseStrangeImage.get(java.lang.String)
to load user images so that you can work with both bitmap and vector images transparently.- Parameters:
identifier
- the portrait identifier to load- Returns:
- the image as a bitmap
-
imageExists
@Deprecated public static boolean imageExists(java.lang.String identifier)
Deprecated.- Parameters:
identifier
- the portrait identifier to test- Returns:
- true if the image exists
-
translatePathToImageURL
@Deprecated public static java.net.URL translatePathToImageURL(java.lang.String identifier)
Deprecated.- Parameters:
identifier
- an identifier containing a local file path or URL- Returns:
- a URL that can be used to read the identified content
-
isURLString
@Deprecated public static boolean isURLString(java.lang.String identifier)
Deprecated.UseStrangeImage
to load user images and!StrangeImage.isFileIdentifier( identifier )
as a replacement for this call.Returnstrue
if the image identifier appears to refer to a URL rather than a local file.- Parameters:
identifier
- the identifier to check- Returns:
true
if the identifier does not refer to a file on the local file system
-
getMissingImage
@Deprecated public static java.awt.image.BufferedImage getMissingImage()
Deprecated.UseStrangeImage
to load user images andResourceKit.getMissingImage()
orStrangeImage.getMissingImage()
to get the missing image as aBufferedImage
orStrangeImage
, respectively.Returns the shared image that represents a missing image.- Returns:
- the shared missing image
-
-