public void paint(GC gc, int width, int height) {
	if (!example.checkAdvancedGraphics()) return;
	Device device = gc.getDevice();

	float scaleX = 10f;
	float scaleY = 10f;
	Image image = null;
	switch (imageCb.getSelectionIndex()) {
	
	case 0:
		image = GraphicsExample.loadImage(device, GraphicsExample.class, "home_nav.gif");
		break;
	case 1:
		image = GraphicsExample.loadImage(device, GraphicsExample.class, "help.gif");
		break;
	case 2:
		image = GraphicsExample.loadImage(device, GraphicsExample.class, "task.gif");
		break;
	case 3:
		image = GraphicsExample.loadImage(device, GraphicsExample.class, "font.gif");
		break;
	case 4:
		image = GraphicsExample.loadImage(device, GraphicsExample.class, "cube.png");
		scaleX = 0.75f;
		scaleY = 0.5f;
		break;
	case 5:
		image = GraphicsExample.loadImage(device, GraphicsExample.class, "swt.png");
		scaleX = 0.4f;
		scaleY = 0.8f;
		break;
	case 6:
		image = GraphicsExample.loadImage(device, GraphicsExample.class, "ovals.png");
		scaleX = 1.1f;
		scaleY = 0.5f;
		break;
	}
	
	Rectangle bounds = image.getBounds();
	
	// draw the original image
	gc.drawImage(image, (width-bounds.width)/2, 20);	
	
	Font font = new Font(device, getPlatformFont(), 20, SWT.NORMAL);
	gc.setFont(font);
	
	// write some text below the original image
	String text = GraphicsExample.getResourceString("OriginalImg"); //$NON-NLS-1$
	Point size = gc.stringExtent(text);	
	gc.drawString(text, (width-size.x)/2, 25 + bounds.height, true);
	
	Transform transform = new Transform(device);
	transform.translate((width - (bounds.width * scaleX + 10) * 4) / 2, 25 + bounds.height + size.y +
				(height - (25 + bounds.height + size.y + bounds.height*scaleY)) / 2);
	transform.scale(scaleX, scaleY);

	// --- draw strings ---
	float[] point = new float[2];
	text = GraphicsExample.getResourceString("None"); //$NON-NLS-1$
	size = gc.stringExtent(text);	
	point[0] = (scaleX*bounds.width + 5 - size.x)/(2*scaleX);
	point[1] = bounds.height;
	transform.transform(point);
	gc.drawString(text, (int)point[0], (int)point[1], true);
	
	text = GraphicsExample.getResourceString("Low"); //$NON-NLS-1$
	size = gc.stringExtent(text);
	point[0] = (scaleX*bounds.width + 5 - size.x)/(2*scaleX) + bounds.width;
	point[1] = bounds.height;
	transform.transform(point);
	gc.drawString(text, (int)point[0], (int)point[1], true);
	
	text = GraphicsExample.getResourceString("Default"); //$NON-NLS-1$
	size = gc.stringExtent(text);
	point[0] = (scaleX*bounds.width + 5 - size.x)/(2*scaleX) + 2*bounds.width;
	point[1] = bounds.height;
	transform.transform(point);
	gc.drawString(text, (int)point[0], (int)point[1], true);
	
	text = GraphicsExample.getResourceString("High"); //$NON-NLS-1$
	size = gc.stringExtent(text);
	point[0] = (scaleX*bounds.width + 5 - size.x)/(2*scaleX) + 3*bounds.width;
	point[1] = bounds.height;
	transform.transform(point);
	gc.drawString(text, (int)point[0], (int)point[1], true);

	gc.setTransform(transform);
	transform.dispose();

	// --- draw images ---
	
	// no interpolation
	gc.setInterpolation(SWT.NONE);
	gc.drawImage(image, 0, 0);
	
	// low interpolation
	gc.setInterpolation(SWT.LOW);
	gc.drawImage(image, bounds.width, 0);

	// default interpolation
	gc.setInterpolation(SWT.DEFAULT);
	gc.drawImage(image, 2*bounds.width, 0);
	
	// high interpolation
	gc.setInterpolation(SWT.HIGH);
	gc.drawImage(image, 3*bounds.width, 0);

	font.dispose();
	if (image != null) image.dispose();
}