Image image = new Image(Display.getCurrent(), width, height);
// Paints the figure on it
GC gc = new GC(image);
Graphics graphics = new SWTGraphics(gc);
figure.paint(graphics);
// Get the image data back
ImageData data = image.getImageData();
ImageDescriptor id = ImageDescriptor.createFromImageData(data);