dsto.dfc.swt.icons
Class Images

java.lang.Object
  extended by dsto.dfc.swt.icons.Images

public final class Images
extends Object

Author:
mpp

Field Summary
static String DFC_ICONS_PATH
          The base path of DFC icons.
 
Method Summary
static void addSearchPath(String path)
          Add a path to the front of the list of paths searched for relative image resources.
static void blit(org.eclipse.swt.graphics.ImageData trg, org.eclipse.swt.graphics.ImageData src, int ox, int oy)
          Modified version of CompositeImageDescriptor.blit () from 3.0M6 that actually works.
static org.eclipse.swt.graphics.ImageData createBlankImageData(int width, int height)
          Create an 8-bit blank image data block.
static org.eclipse.swt.graphics.ImageData createBlankImageData(int width, int height, int depth, org.eclipse.swt.graphics.PaletteData palette)
          Create a blank image data block with a given depth and palette.
static org.eclipse.jface.resource.ImageDescriptor createDescriptor(String resourceName)
           
static Icon createIcon(String resource)
           
static org.eclipse.swt.graphics.Image createImage(org.eclipse.swt.graphics.Device device, org.eclipse.swt.graphics.ImageData data)
           
static org.eclipse.swt.graphics.Image createImage(org.eclipse.swt.graphics.Device device, String resource)
          Create an image from a resource.
static org.eclipse.swt.graphics.Image createImage(org.eclipse.swt.graphics.Device device, URL url)
          Create an image from a URL.
static org.eclipse.swt.graphics.Image createImage(String resource)
          Create an image from a resource.
static org.eclipse.swt.graphics.Image createImage(URL url)
          Create an image from a URL.
static void finalizePalette(org.eclipse.swt.graphics.PaletteData palette)
          Finalize an indexed palette by filling unused (null) entries with black pixels.
static URL findResource(String resource)
          Find a resource, searching the image path if the resource is relative.
static org.eclipse.swt.graphics.ImageData[] loadImageData(String resource)
          Load image data from a resource.
static org.eclipse.swt.graphics.ImageData[] loadImageData(URL url)
          Load image data from a URL.
static void mergeIcons(org.eclipse.swt.graphics.ImageData trg, org.eclipse.swt.graphics.ImageData src, int x, int y)
          Merge a source icon image into a target, handling transparency masks.
static void orMasks(org.eclipse.swt.graphics.ImageData trg, org.eclipse.swt.graphics.ImageData src, int ox, int oy)
          Logically OR two transparency masks together to form a union mask.
static void removeSearchPath(String path)
          Undo the effect of addSearchPath ()
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DFC_ICONS_PATH

public static final String DFC_ICONS_PATH
The base path of DFC icons.

See Also:
Constant Field Values
Method Detail

addSearchPath

public static void addSearchPath(String path)
Add a path to the front of the list of paths searched for relative image resources. The same path may be added more than once: re-adding has the same effect as a remove/add.


removeSearchPath

public static void removeSearchPath(String path)
Undo the effect of addSearchPath ()


createIcon

public static Icon createIcon(String resource)

createImage

public static org.eclipse.swt.graphics.Image createImage(String resource)
Create an image from a resource.

Parameters:
resource - The resource name. If relative (does not begin with "/") the resource is searched for in the current search path (see addSearchPath(String)).
Returns:
The new image.
See Also:
loadImageData(URL), addSearchPath(String)

createImage

public static org.eclipse.swt.graphics.Image createImage(URL url)
Create an image from a URL.

Parameters:
url - The URL.
Returns:
The new image.
See Also:
loadImageData(String), addSearchPath(String)

createImage

public static org.eclipse.swt.graphics.Image createImage(org.eclipse.swt.graphics.Device device,
                                                         String resource)
Create an image from a resource.

Parameters:
device - The image device.
resource - The resource name. If relative (does not begin with "/") the resource is searched for in the current search path (see addSearchPath(String)).
Returns:
The new image.
See Also:
loadImageData(URL), addSearchPath(String)

createImage

public static org.eclipse.swt.graphics.Image createImage(org.eclipse.swt.graphics.Device device,
                                                         URL url)
Create an image from a URL.

Parameters:
device - The image device.
url - The URL.
Returns:
The new image.
See Also:
loadImageData(URL), addSearchPath(String)

createImage

public static org.eclipse.swt.graphics.Image createImage(org.eclipse.swt.graphics.Device device,
                                                         org.eclipse.swt.graphics.ImageData data)

loadImageData

public static org.eclipse.swt.graphics.ImageData[] loadImageData(String resource)
                                                          throws IllegalArgumentException
Load image data from a resource.

Parameters:
resource - The resource name. If relative (does not begin with "/") the resource is searched for in the current search path (see addSearchPath(String)).
Returns:
The image data.
Throws:
IllegalArgumentException - if the image resource is not found.
See Also:
loadImageData(URL)

loadImageData

public static org.eclipse.swt.graphics.ImageData[] loadImageData(URL url)
                                                          throws IllegalArgumentException
Load image data from a URL.

Parameters:
url - The URL to load from.
Returns:
The image data.
Throws:
IllegalArgumentException - if the image resource is not found.

findResource

public static URL findResource(String resource)
Find a resource, searching the image path if the resource is relative.


createDescriptor

public static org.eclipse.jface.resource.ImageDescriptor createDescriptor(String resourceName)

createBlankImageData

public static org.eclipse.swt.graphics.ImageData createBlankImageData(int width,
                                                                      int height)
Create an 8-bit blank image data block. This is usually used to create new icon data. The palette of this block must be finalized before before being used to create an Image with finalizePalette(PaletteData).

See Also:
createBlankImageData(int, int, int, PaletteData)

createBlankImageData

public static org.eclipse.swt.graphics.ImageData createBlankImageData(int width,
                                                                      int height,
                                                                      int depth,
                                                                      org.eclipse.swt.graphics.PaletteData palette)
Create a blank image data block with a given depth and palette.

See Also:
createBlankImageData(int, int)

finalizePalette

public static void finalizePalette(org.eclipse.swt.graphics.PaletteData palette)
Finalize an indexed palette by filling unused (null) entries with black pixels.


mergeIcons

public static void mergeIcons(org.eclipse.swt.graphics.ImageData trg,
                              org.eclipse.swt.graphics.ImageData src,
                              int x,
                              int y)
Merge a source icon image into a target, handling transparency masks.

Parameters:
trg - The target to be modified.
src - The source image.
x - Start x coord inside trg.
y - Start y coord inside trg.

blit

public static void blit(org.eclipse.swt.graphics.ImageData trg,
                        org.eclipse.swt.graphics.ImageData src,
                        int ox,
                        int oy)
Modified version of CompositeImageDescriptor.blit () from 3.0M6 that actually works.


orMasks

public static void orMasks(org.eclipse.swt.graphics.ImageData trg,
                           org.eclipse.swt.graphics.ImageData src,
                           int ox,
                           int oy)
Logically OR two transparency masks together to form a union mask.



Copyright © 2008 Commonwealth of Australia