public class ImageService extends java.lang.Object implements IImageService
Constructor and Description |
---|
ImageService() |
Modifier and Type | Method and Description |
---|---|
byte[] |
convertDiagramToBytes(Diagram diagram,
int format)
Converts the given diagram into an image byte array in the given format.
This allows end users to export diagrams without having to run the associated GEF editor. |
byte[] |
convertImageToBytes(Image image,
int format)
Converts the given
Image into a byte array in the given format
that could be directly saved to a file in that format. |
ImageDescriptor |
getImageDescriptorForId(java.lang.String providerId,
java.lang.String imageId)
Gets an image descriptor for the given image id.
|
Image |
getImageForId(java.lang.String providerId,
java.lang.String imageId)
Gets an image for the given image id.
|
ImageDescriptor |
getPlatformImageDescriptorForId(java.lang.String imageId)
Gets an image descriptor for the given image id.
|
Image |
getPlatformImageForId(java.lang.String imageId)
Gets an image for the given image id.
|
void |
removeImageFromRegistry(java.lang.String key)
Removes the corresponding image entry from the image registry and
disposes the corresponding image (if existent).
|
public ImageDescriptor getImageDescriptorForId(java.lang.String providerId, java.lang.String imageId)
IImageService
org.eclipse.graphiti.ui
is used. This ensures that the image
descriptor will only created once.getImageDescriptorForId
in interface IImageService
imageId
- the image id which is supported by an graphiti image providerImageDescriptor
public Image getImageForId(java.lang.String providerId, java.lang.String imageId)
IImageService
org.eclipse.graphiti.ui
is used. This ensures that the image
will only created once. The image returned must not be disposed by the
caller.getImageForId
in interface IImageService
imageId
- the image id which is supported by an graphiti image providerImage
public void removeImageFromRegistry(java.lang.String key)
IImageService
org.eclipse.graphiti.ui
is used. Only call this
method if you can guarantee that the image/image descriptor is no longer
in use.removeImageFromRegistry
in interface IImageService
key
- the image id which is supported by an graphiti image providerImage
public ImageDescriptor getPlatformImageDescriptorForId(java.lang.String imageId)
IImageService
org.eclipse.graphiti.ui
is used. This ensures
that the image descriptor will only created once.getPlatformImageDescriptorForId
in interface IImageService
imageId
- the image id which is supported by the graphiti platform image
providerImageDescriptor
public Image getPlatformImageForId(java.lang.String imageId)
IImageService
org.eclipse.graphiti.ui
is used. This ensures that the image
will only created once. The image returned must not be disposed by the
caller.getPlatformImageForId
in interface IImageService
imageId
- the image id which is supported by the graphiti platform image
providerImage
public byte[] convertImageToBytes(Image image, int format)
IImageService
Image
into a byte array in the given format
that could be directly saved to a file in that format. Supported formats
are BMP (Windows or OS/2 Bitmap), ICO (Windows Icon), JPEG, GIF, PNG and
TIFF, see ImageLoader
for details.IllegalStateException
.convertImageToBytes
in interface IImageService
image
- The image to convert to a byte arrayformat
- The format to use see ImageLoader
public byte[] convertDiagramToBytes(Diagram diagram, int format)
IImageService
convertDiagramToBytes
in interface IImageService
diagram
- The diagram to convert to a byte arrayformat
- The format to use see ImageLoader