Class 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 a MarkupRenderer.
    Since:
    1.5
    Author:
    Chris Jennings
    • Constructor Detail

      • GraphicStyleFactory

        public GraphicStyleFactory​(double ppi)
    • 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 interface ParametricStyleFactory
      • 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 absolute
        base - 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,
                                     int alignment,
                                     double width,
                                     double height,
                                     float originX,
                                     float originY)
      • fetchImage

        @Deprecated
        public static java.awt.image.BufferedImage fetchImage​(java.lang.String identifier)
        Deprecated.
        Use StrangeImage.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)
        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)
        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.
        Use StrangeImage to load user images and !StrangeImage.isFileIdentifier( identifier ) as a replacement for this call.
        Returns true 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