CompositeImageDescriptor [message #446707] |
Wed, 01 December 2004 07:03 |
Michael Henninghaus Messages: 4 Registered: July 2009 |
Junior Member |
|
|
Hello together.
I have the following problem:
When I try to overlay two images with this framework it works fine until
the
method getSize() get the point of 200, 200. (see example below)
When i specifie a larger size, the overlayImage will be displayed in the
backgroundColor, it has lost its colourInformation !!
Example:
public class OverlayImage extends CompositeImageDescriptor {
private Image baseImage;
private ImageDescriptor overlayImageDescriptor;
Point pt;
public OverlayImage(Image baseImage, ImageDescriptor
overlayImageDescriptor) {
this.baseImage = baseImage;
this.overlayImageDescriptor = overlayImageDescriptor;
}
/* (non-Javadoc)
* @see
org.eclipse.jface.resource.CompositeImageDescriptor#drawComp ositeImage(int,
int)
*/
protected void drawCompositeImage(int width, int height) {
// To draw a composite image, the base image should be
// drawn first (first layer) and then the overlay image
// (second layer)
// Draw the base image using the base image's image data
drawImage(baseImage.getImageData(), 0, 0);
// Method to create the overlay image data
// Get the image data from the Image store or by other means
ImageData overlayImageData = overlayImageDescriptor.getImageData();
// Overlaying the icon in the top left corner i.e. x and y
// coordinates are both zero
int xValue = 0;
int yValue = 0;
drawImage(overlayImageData, xValue, yValue);
}
/* (non-Javadoc)
* @see org.eclipse.jface.resource.CompositeImageDescriptor#getSize( )
*/
protected Point getSize() {
System.err.println("Width = " + baseImage.getBounds().width );
System.err.println("Height = " + baseImage.getBounds().height);
// pt = new Point(baseImage.getBounds().width , baseImage.getBounds
().height );
pt = new Point(200, 200); Important !!!!!!!!!
return pt;
}
|
|
|
Powered by
FUDForum. Page generated in 0.03265 seconds