Package org.bzdev.gio

Class OSGPostscriptProvider

java.lang.Object
org.bzdev.gio.OSGPostscriptProvider
All Implemented Interfaces:
OSGProvider

public class OSGPostscriptProvider extends Object implements OSGProvider
OSG Provider for Postscript. This class is needed by a service loader (and hence has to be declared to be public) and should not be used for other purposes: the method getOsgClass(), for example, returns a class that is a member of the current package but that is not a public class.
  • Constructor Details

    • OSGPostscriptProvider

      public OSGPostscriptProvider()
  • Method Details

    • getTypes

      public String[] getTypes()
      Description copied from interface: OSGProvider
      Get the image types this OSGProvider supports. The image type is name for the image format such as "ps", or "jpeg", not a media type (MIME type), and is intended for use within a java application, not elsewhere.
      Specified by:
      getTypes in interface OSGProvider
      Returns:
      the image types this OSGProvider supports
    • getSuffixes

      public String[] getSuffixes(String type)
      Description copied from interface: OSGProvider
      Get the file-name suffixes for an image type supported by this provider. Suffixes are the same as file-name extensions.
      Specified by:
      getSuffixes in interface OSGProvider
      Parameters:
      type - the name of a format for an image
      Returns:
      a list of file name suffixes; null if this provider does not support an image type.
    • getMediaType

      public String getMediaType(String type)
      Description copied from interface: OSGProvider
      Get the media type (MIME type) for an image type supported by this provider.
      Specified by:
      getMediaType in interface OSGProvider
      Parameters:
      type - the name of a format for an image
      Returns:
      the media type; null if the image type is not supported by this provider.
    • getOsgClass

      public Class<org.bzdev.gio.PostscriptGraphics> getOsgClass()
      Description copied from interface: OSGProvider
      Get the subclass of OutputStreamGraphics for a provider. The subclass of OutputStreamGraphics returned must include a public constructor with five arguments:
      • the output stream (java.io.OutputStream).
      • the image width (int) in user-space coordinates.
      • the image height (int) in user-space coordinates.
      • the image type (String).
      • the preferAlpha flag (boolean). When true, an alpha channel is requested; otherwise the value is false. Whether or not an alpha channel can be used depends on the image type - some image formats do not support alpha channels.
      This constructor must call its superclass' constructor with the first four arguments that match those listed above. Each subclass of OutputStreamGraphics must also provide two public static methods
      • public static Integer getDefaultWidth(ImageOrientation)
      • public static Integer getDefaultHeight(ImageOrientation)
      that return the default width and height of an image in units of points. The value may or may not be dependent on the image orientation. For many image formats (e.g., PNG and JPEG) the default sizes are not dependent on an orientation. For Postscript, they are because Java handles Postscript as a printing function in which the values that can be printed are constrained to fit on a page of a specific size.
      Specified by:
      getOsgClass in interface OSGProvider
      Returns:
      the subclass of OutputStreamGraphics for this provider