int clipping = clippingCb.getSelectionIndex();
switch (clipping) {
case 0: // circles
Path path = new Path(device);
path.addArc((width - width / 5) / 2, (height - height / 5) / 2, width / 5, height / 5, 0, 360);
path.addArc(5 * (width - width / 8) / 12, 4 * (height - height / 8) / 12, width / 8, height / 8, 0, 360);
path.addArc(7 * (width - width / 8) / 12, 8 * (height - height / 8) / 12, width / 8, height / 8, 0, 360);
path
.addArc(6 * (width - width / 12) / 12, 3 * (height - height / 12) / 12, width / 12, height / 12, 0,
360);
path
.addArc(6 * (width - width / 12) / 12, 9 * (height - height / 12) / 12, width / 12, height / 12, 0,
360);
path.addArc(11.5f * (width - width / 18) / 20, 5 * (height - height / 18) / 18, width / 18, height / 18, 0,
360);
path.addArc(8.5f * (width - width / 18) / 20, 13 * (height - height / 18) / 18, width / 18, height / 18, 0,
360);
gc.setClipping(path);
path.dispose();
break;
case 1: // rectangle
path = new Path(device);
path.addRectangle(100, 100, width - 200, height - 200);
path.addRectangle(120, 120, width - 240, height - 240);
path.addRectangle(140, 140, width - 280, height - 280);
gc.setClipping(path);
path.dispose();
break;
case 2: // circle
path = new Path(device);
path.addArc(100, 100, width - 200, height - 200, 0, 360);
path.addArc((width - width / 5) / 2, (height - height / 5) / 2, width / 5, height / 5, 0, 360);
path.addArc(5 * (width - width / 8) / 12, 4 * (height - height / 8) / 12, width / 8, height / 8, 0, 360);
path.addArc(7 * (width - width / 8) / 12, 8 * (height - height / 8) / 12, width / 8, height / 8, 0, 360);
path
.addArc(6 * (width - width / 12) / 12, 3 * (height - height / 12) / 12, width / 12, height / 12, 0,
360);
path
.addArc(6 * (width - width / 12) / 12, 9 * (height - height / 12) / 12, width / 12, height / 12, 0,
360);
path.addArc(11.5f * (width - width / 18) / 20, 5 * (height - height / 18) / 18, width / 18, height / 18, 0,
360);
path.addArc(8.5f * (width - width / 18) / 20, 13 * (height - height / 18) / 18, width / 18, height / 18, 0,
360);
gc.setClipping(path);
path.dispose();
break;
case 3: // word
path = new Path(device);
String text = GraphicsExample.getResourceString("SWT"); //$NON-NLS-1$
Font font = new Font(device, "Times", 200, SWT.NORMAL);
gc.setFont(font);
Point size = gc.stringExtent(text);
path.addString(text, (width - size.x) / 2, (height - size.y) / 2, font);
font.dispose();
gc.setClipping(path);
path.dispose();
break;
case 4: // star
path = new Path(device);
path.lineTo(width / 2, 0);
path.lineTo(5 * width / 8, height / 3);
path.lineTo(width, height / 3);
path.lineTo(3 * width / 4, 10 * height / 16);
path.lineTo(7 * width / 8, height);
path.lineTo(width / 2, 3 * height / 4);
path.lineTo(width / 8, height);
path.lineTo(width / 4, 10 * height / 16);
path.lineTo(0, height / 3);
path.lineTo(3 * width / 8, height / 3);
path.lineTo(width / 2, 0);
Path ovalPath = new Path(device);
ovalPath.addArc(90, 90, width - 180, height - 180, 0, 360);
path.addPath(ovalPath);
gc.setClipping(path);
ovalPath.dispose();
path.dispose();
break;
case 5: // triangles
path = new Path(device);
path.addRectangle(0, 0, width, height);
path.lineTo(width / 4, 0);
path.lineTo(width / 4, height / 2);
path.lineTo(0, height / 2);
path.lineTo(width / 4, 0);
Path path2 = new Path(device);
path2.lineTo(width / 2, 0);
path2.lineTo(width / 4, height / 2);
path2.lineTo(3 * width / 4, height / 2);
path2.lineTo(width / 2, 0);
Path path3 = new Path(device);
path3.lineTo(3 * width / 4, 0);
path3.lineTo(3 * width / 4, height / 2);
path3.lineTo(width, height / 2);
path3.lineTo(3 * width / 4, 0);
Path path4 = new Path(device);
path4.lineTo(0, height);
path4.lineTo(width / 4, height / 2);
path4.lineTo(width / 2, height);
path4.lineTo(0, height);
Path path5 = new Path(device);
path5.lineTo(width / 2, height);
path5.lineTo(3 * width / 4, height / 2);
path5.lineTo(width, height);
path5.lineTo(width / 2, height);
path.addPath(path2);
path.addPath(path3);
path.addPath(path4);
path.addPath(path5);
gc.setClipping(path);
path5.dispose();
path4.dispose();
path3.dispose();
path2.dispose();
path.dispose();
break;