Class org. Eclipse. SWT. Graphics. imagedata stores the pixel data of the image.
Imagedata is a class that contains information about the image size, palette, color value, and transparency. We can directly read or write the pixel data of these images,
This means that you can directly read or modify the image data to set or obtain the color values of any pixel or any group of pixels in the image.
We should also know the following fields about imagedata:
Width and height specify the width and height of the image. Depth specifies the color depth of the image. The possible values are 1, 2, 4, 8, 16, 24, or 32, which specifies the number of BITs used to encode the value of each pixel.
Alpha and alphadata define the transparency of the image. Alpha defines the global transparency of the image. The default value is-1. Otherwise, the alphadata domain will be ignored. When Alpha is not equal to-1, alphadata stores the transparency buffer of the image. Each pixel can have a value ranging from 0 ~ The transparency value between 255 and. A greater value indicates the opacity. It is worth noting that only some image formats are transparent, such as GIF and PNG.
A palettedata object that stores information about the color model of an image. The color model of SWT can be indexed or directly specified by its isdirect domain. If the color model is indexed, palettedata contains the color index. You can use getrgbs () to obtain RGB information. If it is direct, it contains the conversion information, indicating how to extract the color RGB component from the integer of the pixel.
Data contains the byte buffer of the pixel value. The Byte encoding method depends on the color depth used. For an 8-bit image, one byte in the array exactly represents the value of one pixel in the image. For a 16-bit image, each pixel value is encoded into two bytes in the buffer zone. These two bytes are stored in the lowest valid byte order. For 24-or 32-bit images, each pixel value is encoded as three or four bytes in the buffer zone in the highest valid byte sequence.
Bytesperline indicates the number of bytes in the buffer zone used to represent all the pixel values of a row of pixels in the image. Because one pixel may have multiple bytes, bytesperline may be several times the field width value.