blob: 4e1a6e23c05bd6b52e9b337c01d0b3a868b9a1de [file] [log] [blame]
<article link="graphics-resources.html">
<title>Taking a look at SWT Images</title>
<date>September 10th, 2003</date>
<category>User interface</category>
<name>Joe Winchester</name>
SWT's Image class can be used to display images in a GUI. The
most common source of images is to load from a standard file
format such as GIF, JPEG, PNG, or BMP. Some controls, including
Buttons and TreeItems, are able to display an Image directly
through the setImage(Image) method, but any control's paint
event allows images to be drawn through the callback's graphic
context. SWT's ImageData class represents the raw data making up
an SWT Image and determines the color for each pixel coordinate.
This article shows the correct uses of ImageData and Image,
shows how to load images from files, and how to achieve graphic
effects such as transparency, alpha blending, animation,
scaling, and custom cursors.