|
Eclipse Platform Release 3.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.swt.graphics.ImageData
Instances of this class are device-independent descriptions of images. They are typically used as an intermediate format between loading from or writing to streams and creating an Image.
Note that the public fields x, y, disposalMethod and delayTime are typically only used when the image is in a set of images used for animation.
Field Summary | |
int | alpha
The global alpha value to be used for every pixel. |
byte[] | alphaData
The alpha data of the image. |
int | bytesPerLine
The number of bytes per scanline. |
byte[] | data
The pixel data of the image. |
int | delayTime
The time to delay before displaying the next image in an animation (this field corresponds to the GIF89a Delay Time value). |
int | depth
The color depth of the image, in bits per pixel. |
int | disposalMethod
A description of how to dispose of the current image before displaying the next. |
int | height
The height of the image, in pixels. |
byte[] | maskData
An icon-specific field containing the data from the icon mask. |
int | maskPad
An icon-specific field containing the scanline pad of the mask. |
PaletteData | palette
The color table for the image. |
int | scanlinePad
The scanline padding. |
int | transparentPixel
The transparent pixel. |
int | type
The type of file from which the image was read. |
int | width
The width of the image, in pixels. |
int | x
The x coordinate of the top left corner of the image within the logical screen (this field corresponds to the GIF89a Image Left Position value). |
int | y
The y coordinate of the top left corner of the image within the logical screen (this field corresponds to the GIF89a Image Top Position value). |
Constructor Summary | |
ImageData(InputStream stream)
Constructs an ImageData loaded from the specified input stream. | |
ImageData(int width,
int height,
int depth,
PaletteData palette)
Constructs a new, empty ImageData with the given width, height, depth and palette. | |
ImageData(int width,
int height,
int depth,
PaletteData palette,
int scanlinePad,
byte[] data)
Constructs a new, empty ImageData with the given width, height, depth, palette, scanlinePad and data. | |
ImageData(String filename)
Constructs an ImageData loaded from a file with the specified name. |
Method Summary | |
Object | clone()
Returns a new instance of the same class as the receiver, whose slots have been filled in with copies of the values in the slots of the receiver. |
int | getAlpha(int x,
int y)
Returns the alpha value at offset x in scanline y in the receiver's alpha data. |
void | getAlphas(int x,
int y,
int getWidth,
byte[] alphas,
int startIndex)
Returns getWidth alpha values starting at offset x in scanline y in the receiver's alpha data starting at startIndex. |
int | getPixel(int x,
int y)
Returns the pixel value at offset x in scanline y in the receiver's data. |
void | getPixels(int x,
int y,
int getWidth,
byte[] pixels,
int startIndex)
Returns getWidth pixel values starting at offset x in scanline y in the receiver's data starting at startIndex. |
void | getPixels(int x,
int y,
int getWidth,
int[] pixels,
int startIndex)
Returns getWidth pixel values starting at offset x in scanline y in the receiver's data starting at startIndex. |
RGB[] | getRGBs()
Returns an array of RGBs which comprise the indexed color table of the receiver, or null if the receiver has a direct color model. |
ImageData | getTransparencyMask()
Returns an ImageData which specifies the transparency mask information for the receiver, or null if the receiver has no transparency and is not an icon. |
int | getTransparencyType()
Returns the image transparency type. |
static ImageData | internal_new(int width,
int height,
int depth,
PaletteData palette,
int scanlinePad,
byte[] data,
int maskPad,
byte[] maskData,
byte[] alphaData,
int alpha,
int transparentPixel,
int type,
int x,
int y,
int disposalMethod,
int delayTime)
Invokes internal SWT functionality to create a new instance of this class. |
ImageData | scaledTo(int width,
int height)
Returns a copy of the receiver which has been stretched or shrunk to the specified size. |
void | setAlpha(int x,
int y,
int alpha)
Sets the alpha value at offset x in scanline y in the receiver's alpha data. |
void | setAlphas(int x,
int y,
int putWidth,
byte[] alphas,
int startIndex)
Sets the alpha values starting at offset x in scanline y in the receiver's alpha data to the values from the array alphas starting at startIndex. |
void | setPixel(int x,
int y,
int pixelValue)
Sets the pixel value at offset x in scanline y in the receiver's data. |
void | setPixels(int x,
int y,
int putWidth,
byte[] pixels,
int startIndex)
Sets the pixel values starting at offset x in scanline y in the receiver's data to the values from the array pixels starting at startIndex. |
void | setPixels(int x,
int y,
int putWidth,
int[] pixels,
int startIndex)
Sets the pixel values starting at offset x in scanline y in the receiver's data to the values from the array pixels starting at startIndex. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public int width
public int height
public int depth
Note that a depth of 8 or less does not necessarily mean that the image is palette indexed, or conversely that a depth greater than 8 means that the image is direct color. Check the associated PaletteData's isDirect field for such determinations.
public int scanlinePad
If one scanline of the image is not a multiple of this number, it will be padded with zeros until it is.
public int bytesPerLine
This is a multiple of the scanline padding.
public byte[] data
Note that for 16 bit depth images the pixel data is stored in least significant byte order; however, for 24bit and 32bit depth images the pixel data is stored in most significant byte order.
public PaletteData palette
public int transparentPixel
Pixels with this value are transparent.
The default is -1 which means 'no transparent pixel'.
public byte[] maskData
This is a 1 bit bitmap stored with the most significant bit first. The number of bytes per scanline is '((width + 7) / 8 + (maskPad - 1)) / maskPad * maskPad'.
The default is null which means 'no transparency mask'.
public int maskPad
If one scanline of the transparency mask is not a multiple of this number, it will be padded with zeros until it is.
public byte[] alphaData
Every pixel can have an alpha blending value that varies from 0, meaning fully transparent, to 255 meaning fully opaque. The number of bytes per scanline is 'width'.
public int alpha
If this value is set, the alphaData field is ignored and when the image is rendered each pixel will be blended with the background an amount proportional to this value.
The default is -1 which means 'no global alpha value'
public int type
public int x
public int y
public int disposalMethod
public int delayTime
Constructor Detail |
public ImageData(int width, int height, int depth, PaletteData palette)
public ImageData(int width, int height, int depth, PaletteData palette, int scanlinePad, byte[] data)
public ImageData(InputStream stream)
This constructor is provided for convenience when loading a single image only. If the stream contains multiple images, only the first one will be loaded. To load multiple images, use ImageLoader.load().
public ImageData(String filename)
This constructor is provided for convenience when loading a single image only. If the file contains multiple images, only the first one will be loaded. To load multiple images, use ImageLoader.load().
Method Detail |
public static ImageData internal_new(int width, int height, int depth, PaletteData palette, int scanlinePad, byte[] data, int maskPad, byte[] maskData, byte[] alphaData, int alpha, int transparentPixel, int type, int x, int y, int disposalMethod, int delayTime)
IMPORTANT: This method is not part of the public API for ImageData. It is marked public only so that it can be shared within the packages provided by SWT. It is subject to change without notice, and should never be called from application code.
This method is for internal use, and is not described further.
public Object clone()
public int getAlpha(int x, int y)
public void getAlphas(int x, int y, int getWidth, byte[] alphas, int startIndex)
public int getPixel(int x, int y)
public void getPixels(int x, int y, int getWidth, byte[] pixels, int startIndex)
public void getPixels(int x, int y, int getWidth, int[] pixels, int startIndex)
public RGB[] getRGBs()
public ImageData getTransparencyMask()
public int getTransparencyType()
public ImageData scaledTo(int width, int height)
public void setAlpha(int x, int y, int alpha)
public void setAlphas(int x, int y, int putWidth, byte[] alphas, int startIndex)
public void setPixel(int x, int y, int pixelValue)
public void setPixels(int x, int y, int putWidth, byte[] pixels, int startIndex)
public void setPixels(int x, int y, int putWidth, int[] pixels, int startIndex)
|
Eclipse Platform Release 3.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.