blob: 2f173f4c47a37fa17afd54f1b3a1316fe9cc4527 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2013. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="../../../book.css" charset="ISO-8859-1" type="text/css">
<title>SWT - Image Analyzer Example</title>
<h2>SWT standalone example - Image Analyzer</h2>
The ImageAnalyzer example opens image files and displays their visual contents and
an image data summary.
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.
The ImageAnalyzer can load and display image files of type GIF, JPEG, BMP, ICO, and PNG.
If a loaded file is an interlaced GIF or PNG, or a progressive JPEG, and <strong>Incremental Display</strong> is selected,
then the ImageAnalyzer will display the image increments as they are loaded.
If the file contains an animated GIF, then the <strong>Next</strong>, <strong>Previous</strong>, and <strong>Animate</strong> buttons become enabled,
and can be used to cycle through and animate the images in the file. If a GIF defines a background color,
as many animated GIFs do, then selecting <strong>Background</strong> will use the GIF's background color.
If the image has transparency, which is possible with images of type GIF, PNG, and ICO, then selecting <strong>Display Mask</strong> will draw the image's transparency
mask to the right of the image. You can change the background color of the ImageAnalyzer in order to see the transparency work.
To turn off transparency, deselect <strong>Display Transparency</strong>.
After an image is loaded, it can be scaled with the <strong>Scale</strong> combo, or have alpha transparency applied to it using the <strong>Alpha-K</strong> combo
and <strong>Alpha</strong> menu. <strong>File</strong> &gt; <strong>Reopen</strong> restores the scaling and alpha attributes to their default values and reloads the current image file.
If the image has transparency,
<strong>File</strong> &gt; <strong>Save Mask As...</strong> can be used to save the image's transparency mask.
When SWT loads an image file, an instance of <code></code> is created (though in the case of an ICO file or
multi-image GIF an array of <code>ImageData</code> instances is created). The ImageAnalyzer displays all of the data stored in the <code>ImageData</code>
instance(s) for the currently loaded image file, including the pixel data. Hovering over a pixel in the image display will show the RGB
color data for that pixel. For certain images, particularly animated GIFs, additional data is stored in the <code></code>
instance that is used to load the image. The ImageAnalyzer displays this data as well.
<h3>Running the example</h3>
Follow the <a href="swt_manual_setup.html">SWT standalone examples setup</a>
instructions to install and run the example from your workspace.
The "Main" class is <code>org.eclipse.swt.examples.imageanalyzer.ImageAnalyzer</code>.
This example can also be run using the <a href="swt_launcher_ex.html">Example Launcher</a>.
Select the <strong>Image Analyzer</strong> item from the <strong>Standalone</strong> category and click <strong>Run</strong>.