com.tensegrity.graphics.swt
Class SWTGraphicUtilities

java.lang.Object
  extended bycom.tensegrity.graphics.swt.SWTGraphicUtilities

public class SWTGraphicUtilities
extends java.lang.Object

Class gathering utility methods related to SWT Graphics.

Version:
$Id: SWTGraphicUtilities.java,v 1.12 2005/07/27 07:28:40 SebastienGuyon Exp $
Author:
S�bastien Guyon

Method Summary
static org.eclipse.swt.graphics.ImageData createImageData(Raster raster)
          This method converts a raster to an Swt ImageData.
static int getBlue(int color)
          Returns the blue component in the range 0-255 in the default RGB space.
static org.eclipse.swt.graphics.Color getColor(org.eclipse.swt.graphics.Device swtdevice, int color)
           Creates and returns a Color.
static int getGreen(int color)
          Returns the green component in the range 0-255 in the default RGB space.
static org.eclipse.swt.graphics.Image getImage(org.eclipse.swt.widgets.Display display, java.lang.String path, java.lang.Class referenceClass)
           Routine creating and returning the SWT Image located at path.
static org.eclipse.swt.graphics.ImageData getImageData(int width, int height)
           Returns an ImageData of dimension width*height initialized with a PaletteData of depth 32.
static int getIntValue(org.eclipse.swt.graphics.RGB rgb)
           This method returns the integer representation of the passed RGB value.
static int getRed(int color)
          Returns the red component in the range 0-255 in the default RGB space.
static org.eclipse.swt.graphics.RGB getRGB(int color)
           Returns an RGB object containing the red, green and blue components of the specified color.
static int getRGBIntValue(org.eclipse.swt.graphics.Color color)
           This method returns the integer representation of the passed Color RGB value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getIntValue

public static int getIntValue(org.eclipse.swt.graphics.RGB rgb)

This method returns the integer representation of the passed RGB value.

Parameters:
rgb - the RGB from which the integer representation is requested.
Returns:
the integer representation of the passed RGB value.

getRGBIntValue

public static int getRGBIntValue(org.eclipse.swt.graphics.Color color)

This method returns the integer representation of the passed Color RGB value.

Parameters:
color - the Color from which the RGB int value is requested.
Returns:
the integer representation of the passed Color RGB value.

getRGB

public static org.eclipse.swt.graphics.RGB getRGB(int color)

Returns an RGB object containing the red, green and blue components of the specified color.
NOTE: an RGB object is not a resourced-based object (in the sense of SWT) and therefore needs not to be disposed.

Parameters:
color - int that defines the values for the red, green and blue components as illustrated by the following hexadecimal pattern:
0x00rrggbb
where rr stands for the red component, gg stands for the green component and bb stands for the blue component of the color.
Returns:
RGB object representing the red, green and blue components of the given color value

getRed

public static int getRed(int color)
Returns the red component in the range 0-255 in the default RGB space.

Parameters:
color - int that defines the values for the red, green and blue components as illustrated by the following hexadecimal pattern:
0x00rrggbb
where rr stands for the red component, gg stands for the green component and bb stands for the blue component of the color.
Returns:
the red component.

getColor

public static org.eclipse.swt.graphics.Color getColor(org.eclipse.swt.graphics.Device swtdevice,
                                                      int color)

Creates and returns a Color. It is the callers responsability to dispose the returned value when no longer needed.

Parameters:
swtdevice - the SWT Device
color - an int representation of a Color
Returns:
the corresponding Color object

getGreen

public static int getGreen(int color)
Returns the green component in the range 0-255 in the default RGB space.

Parameters:
color - int that defines the values for the red, green and blue components as illustrated by the following hexadecimal pattern:
0x00rrggbb
where rr stands for the red component, gg stands for the green component and bb stands for the blue component of the color.
Returns:
the green component.

getBlue

public static int getBlue(int color)
Returns the blue component in the range 0-255 in the default RGB space.

Parameters:
color - int that defines the values for the red, green and blue components as illustrated by the following hexadecimal pattern:
0x00rrggbb
where rr stands for the red component, gg stands for the green component and bb stands for the blue component of the color.
Returns:
the blue component.

createImageData

public static final org.eclipse.swt.graphics.ImageData createImageData(Raster raster)
This method converts a raster to an Swt ImageData.

Parameters:
raster - the input raster (not modified)
Returns:
an ImageData that represents the raster.
See Also:
getImageData(int, int)

getImageData

public static org.eclipse.swt.graphics.ImageData getImageData(int width,
                                                              int height)

Returns an ImageData of dimension width*height initialized with a PaletteData of depth 32.

Parameters:
width - the returned ImageData width
height - the returned ImageData height
Returns:
an ImageData initialized with a PaletteData of depth 32.

getImage

public static final org.eclipse.swt.graphics.Image getImage(org.eclipse.swt.widgets.Display display,
                                                            java.lang.String path,
                                                            java.lang.Class referenceClass)

Routine creating and returning the SWT Image located at path.

Parameters:
display - the SWT Display used to create the returned image.
path - location of the image relative to referenceClass.
referenceClass - Class used as reference in order to retrieve the image.
Returns:
the SWT Image located at path


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.