Class ImageService
java.lang.Object
org.eclipse.graphiti.ui.internal.services.impl.ImageService
- All Implemented Interfaces:
IImageService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]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(org.eclipse.swt.graphics.Image image, int format) Converts the givenImageinto a byte array in the given format that could be directly saved to a file in that format.org.eclipse.jface.resource.ImageDescriptorgetImageDescriptorForId(String providerId, String imageId) Gets an image descriptor for the given image id.org.eclipse.swt.graphics.ImagegetImageForId(String providerId, String imageId) Gets an image for the given image id.org.eclipse.jface.resource.ImageDescriptorgetPlatformImageDescriptorForId(String imageId) Gets an image descriptor for the given image id.org.eclipse.swt.graphics.ImagegetPlatformImageForId(String imageId) Gets an image for the given image id.voidRemoves the corresponding image entry from the image registry and disposes the corresponding image (if existent).
-
Constructor Details
-
ImageService
public ImageService()
-
-
Method Details
-
getImageDescriptorForId
public org.eclipse.jface.resource.ImageDescriptor getImageDescriptorForId(String providerId, String imageId) Description copied from interface:IImageServiceGets an image descriptor for the given image id. This image id must be supported by an graphiti image provider, and available to the given DiagramTypeProvider. The image registry of the pluginorg.eclipse.graphiti.uiis used. This ensures that the image descriptor will only created once.- Specified by:
getImageDescriptorForIdin interfaceIImageServiceimageId- the image id which is supported by an graphiti image provider- Returns:
- the image descriptor for the id
- See Also:
-
ImageDescriptor
-
getImageForId
Description copied from interface:IImageServiceGets an image for the given image id. This image id must be supported by an graphiti image provider, and available to the given DiagramTypeProvider. The image registry of the pluginorg.eclipse.graphiti.uiis used. This ensures that the image will only created once. The image returned must not be disposed by the caller.- Specified by:
getImageForIdin interfaceIImageServiceimageId- the image id which is supported by an graphiti image provider- Returns:
- the image for the id
- See Also:
-
Image
-
removeImageFromRegistry
Description copied from interface:IImageServiceRemoves the corresponding image entry from the image registry and disposes the corresponding image (if existent). The passed image id must be supported by an graphiti image provider. The image registry of the pluginorg.eclipse.graphiti.uiis used. Only call this method if you can guarantee that the image/image descriptor is no longer in use.- Specified by:
removeImageFromRegistryin interfaceIImageService- Parameters:
key- the image id which is supported by an graphiti image provider- See Also:
-
Image
-
getPlatformImageDescriptorForId
Description copied from interface:IImageServiceGets an image descriptor for the given image id. This image id must be supported by the graphiti platform image provider. The image registry of the pluginorg.eclipse.graphiti.uiis used. This ensures that the image descriptor will only created once.- Specified by:
getPlatformImageDescriptorForIdin interfaceIImageService- Parameters:
imageId- the image id which is supported by the graphiti platform image provider- Returns:
- the image descriptor for the id
- See Also:
-
ImageDescriptor
-
getPlatformImageForId
Description copied from interface:IImageServiceGets an image for the given image id. This image id must be supported by the graphiti platform image provider. The image registry of the pluginorg.eclipse.graphiti.uiis used. This ensures that the image will only created once. The image returned must not be disposed by the caller.- Specified by:
getPlatformImageForIdin interfaceIImageService- Parameters:
imageId- the image id which is supported by the graphiti platform image provider- Returns:
- the image for the id
- See Also:
-
Image
-
convertImageToBytes
public byte[] convertImageToBytes(org.eclipse.swt.graphics.Image image, int format) Description copied from interface:IImageServiceConverts the givenImageinto 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, seeImageLoaderfor details.
In case GIF is the target format this method will check that the image does not contain more than 256 colors (limit for GIF format). In case there are more colors this method will throw anIllegalStateException.- Specified by:
convertImageToBytesin interfaceIImageService- Parameters:
image- The image to convert to a byte arrayformat- The format to use seeImageLoader- Returns:
- A byte array containing the image
-
convertDiagramToBytes
Description copied from interface:IImageServiceConverts 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.- Specified by:
convertDiagramToBytesin interfaceIImageService- Parameters:
diagram- The diagram to convert to a byte arrayformat- The format to use seeImageLoader- Returns:
- A byte array containing the diagram image
-