java.lang.Object
org.bzdev.gio.OSGImageProvider
- All Implemented Interfaces:
OSGProvider
OSG Provider for image formats.
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.
The image formats supported are those supported by the
org.bzdev.imageio package, which provides some convenience
methods for using the javax.imageio package.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetMediaType
(String type) Get the media type (MIME type) for an image type supported by this provider.Class<org.bzdev.gio.ImageGraphics>
Get the subclass of OutputStreamGraphics for a provider.String[]
getSuffixes
(String type) Get the file-name suffixes for an image type supported by this provider.String[]
getTypes()
Get the image types this OSGProvider supports.
-
Constructor Details
-
OSGImageProvider
public OSGImageProvider()
-
-
Method Details
-
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 interfaceOSGProvider
- Returns:
- the image types this OSGProvider supports
-
getSuffixes
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 interfaceOSGProvider
- 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
Description copied from interface:OSGProvider
Get the media type (MIME type) for an image type supported by this provider.- Specified by:
getMediaType
in interfaceOSGProvider
- 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
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.
- public static Integer getDefaultWidth(ImageOrientation)
- public static Integer getDefaultHeight(ImageOrientation)
- Specified by:
getOsgClass
in interfaceOSGProvider
- Returns:
- the subclass of OutputStreamGraphics for this provider
-