blob: b1e9af0da46767c702cfbe1cdb195805facf5f0d [file] [log] [blame]
<title>SWT - Image Analyzer Example</title>
<h2>Standard Widget Toolkit (SWT) Standalone Example - Image Analyzer</h2>
<p>The ImageAnalyzer opens image files and displays the visual contents of
the file along with a summary of the data in the image file.&nbsp; The
user can make adjustments to various elements of the image such as scaling
and Alpha blending and can save these changes to a file.
<h3>Running the example</h3>
<p>If the Example Launcher is installed, select the Image Analyzer item from the Standalone category and click Run.&nbsp;
Otherwise, install and run the example manually as per the
<a href="swt_manual_setup.html">Standalone Examples Manual Setup</a> instructions.&nbsp; The executable class is
The ImageAnalyzer will load and display image files of type GIF, JPEG, BMP, ICO, and PNG.&nbsp;
To open a file, use the File->Open... menu item, and select the image file in the FileDialog.
If the file is an interlaced GIF or PNG or a progressive JPEG, and Incremental Display is selected,
then the ImageAnalyzer displays the image increments as they are being loaded.
If the file contains an animated GIF, then the Next, Previous, and Animate buttons become enabled,
and they can be used to cycle through the images in the file, or animate them.&nbsp; If a GIF defines a background color,
as many animated GIFs do, selecting Background will use the GIF's background color.
If the image has transparency (possible with GIF, PNG, or ICO), then selecting Display Mask will draw the image's transparency
mask to the right of the image.&nbsp; You can change the background color of the ImageAnalyzer to see the transparency work.&nbsp;
To turn off the transparency, deselect Display Transparency.
After an image is loaded, it can be scaled or have alpha transparency applied, using the Scale and Alpha-K combos,
and the Alpha menu. File->Reopen restores scaling and Alpha to their default values and reloads the current image file.
File->Save As... can be used to save the currently loaded image to another type of image file.&nbsp; If the image has transparency,
File->Save Mask As... saves the image's transparency mask.
When SWT loads an image file, an instance of is created.&nbsp; (In the case of an ICO file or
multi-image GIF, an array of ImageData instances is created).&nbsp; The ImageAnalyzer displays all of the data stored in the ImageData
instance(s) for the currently loaded image file, including the pixel data.&nbsp; Hovering over a pixel in the image display will show the RGB
color data for that pixel.&nbsp; For certain images (particularly animated GIFs) additional data is stored in the
instance used to load the image.&nbsp; The ImageAnalyzer displays this data as well.
<p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corporation 2000, 2001. All Rights Reserved." BORDER=0 height=12 width=195></a></p>