Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse Plug-in Developer Guide
Previous Page Home Next Page

SWT standalone example - Image Analyzer

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 Incremental Display is selected, then the ImageAnalyzer will display the image increments as they are loaded. If the file contains an animated GIF, then the Next, Previous, and Animate 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 Background 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 Display Mask 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 Display Transparency. After an image is loaded, it can be scaled with the Scale combo, or have alpha transparency applied to it using the Alpha-K combo and Alpha menu. File > Reopen restores the scaling and alpha attributes to their default values and reloads the current image file. If the image has transparency, File > Save Mask As... can be used to save the image's transparency mask.

When SWT loads an image file, an instance of org.eclipse.swt.graphics.ImageData is created (though in the case of an ICO file or multi-image GIF an array of ImageData instances is created). The ImageAnalyzer displays all of the data stored in the ImageData 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 org.eclipse.swt.graphics.ImageLoader instance that is used to load the image. The ImageAnalyzer displays this data as well.

Running the example

Follow the SWT standalone examples setup instructions to install and run the example from your workspace.

The "Main" class is org.eclipse.swt.examples.imageanalyzer.ImageAnalyzer.

This example can also be run using the Example Launcher. Select the Image Analyzer item from the Standalone category and click Run.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire