*/
public DimensionInfo getPreferredDimension(int width, int height) {
if (width <= 0 && height <= 0) {
// we are free, so use image size
org.eclipse.swt.graphics.Rectangle a = _image.getBounds();
return new DimensionInfo(a.width, a.height, -1);
} else if (width > 0 && height > 0) {
return new DimensionInfo(width, height, -1);
} else if (height > 0) {
width = (int) ((double) _imageWidth * height / _imageHeight);
return new DimensionInfo(width, height, -1);
} else {
height = (int) ((double) _imageHeight * width / _imageWidth);
return new DimensionInfo(width, height, -1);
}
}