public void paint(GC gc, int width, int height) {
	if (!example.checkAdvancedGraphics()) return;
	Device device = gc.getDevice();
	
	// array of coordinate points of polygon 1 (region 1)
	int [] polygon1 = new int [] {10, height/2, 9*width/16, 10, 9*width/16, height-10};
	Region region1 = new Region(device);
	region1.add(polygon1);

	// array of coordinate points of polygon 2 (region 2)
	int [] polygon2 = new int [] {
			9*width/16, 10,
			9*width/16, height/8,
			7*width/16, 2*height/8,
			9*width/16, 3*height/8,
			7*width/16, 4*height/8,
			9*width/16, 5*height/8,
			7*width/16, 6*height/8,
			9*width/16, 7*height/8,
			9*width/16, height-10,
			width-10, height/2
	};
	Region region2 = new Region(device);
	region2.add(polygon2);
	
	gc.setAlpha(127);
	
	int clippingIndex = clippingCb.getSelectionIndex();
	
	switch (clippingIndex) {
	case 0:
		// region 1
		gc.setClipping(region1);
		gc.setBackground(colorGB1.getBgColor1());
		gc.fillPolygon(polygon1);
		break;
	case 1:
		// region 2
		gc.setClipping(region2);
		gc.setBackground(colorGB2.getBgColor1());
		gc.fillPolygon(polygon2);
		break;
	case 2:
		// add		
		region1.add(region2);
		break;
	case 3:
		// sub
		region1.subtract(region2);
		break;
	case 4:
		// intersect
		region1.intersect(region2);
		break;		
	}
	
	if (clippingIndex > 1) {
		gc.setClipping(region1);
		
		gc.setBackground(colorGB1.getBgColor1());
		gc.fillPolygon(polygon1);
		
		gc.setBackground(colorGB2.getBgColor1());
	    gc.fillPolygon(polygon2);
	}
	
	region1.dispose();
	region2.dispose();
    }