| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| <html> |
| <head> |
| <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> |
| </head> |
| <body> |
| |
| <h2>SWT standalone example - Image Analyzer</h2> |
| |
| <p> |
| 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. |
| </p> |
| <p> |
| 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> > <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> > <strong>Save Mask As...</strong> can be used to save the image's transparency mask. |
| </p> |
| <p> |
| When SWT loads an image file, an instance of <code>org.eclipse.swt.graphics.ImageData</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>org.eclipse.swt.graphics.ImageLoader</code> |
| instance that is used to load the image. The ImageAnalyzer displays this data as well. |
| </p> |
| |
| <h3>Running the example</h3> |
| |
| <p> |
| Follow the <a href="swt_manual_setup.html">SWT standalone examples setup</a> |
| instructions to install and run the example from your workspace. |
| </p> |
| <p> |
| The "Main" class is <code>org.eclipse.swt.examples.imageanalyzer.ImageAnalyzer</code>. |
| </p> |
| <p> |
| 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>. |
| </p> |
| |
| </body> |
| </html> |