Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » CompositeImageDescriptor
CompositeImageDescriptor [message #446707] Wed, 01 December 2004 07:03
Michael Henninghaus is currently offline Michael HenninghausFriend
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;
}
Previous Topic:Prepackaged Mozilla
Next Topic:Eclipse 3.1 M3 - Virtual TableViewer
Goto Forum:
  


Current Time: Sun Oct 25 18:11:24 GMT 2020

Powered by FUDForum. Page generated in 0.01990 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top