Bug 313211 [CSS] Optimizing Linear Gradients
bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/GradientBackgroundListener.java
/*
		 * Draw the new background.
		 */
		Image newImage;
		
		
		if (grad.isRadial() && isRadialSupported) {
			List<java.awt.Color> colors = new ArrayList<java.awt.Color>();
			for (Iterator iterator = grad.getRGBs().iterator(); iterator
					.hasNext();) {
				RGB rgb = (RGB) iterator.next();
				java.awt.Color color = new java.awt.Color(rgb.red, rgb.green,
						rgb.blue);
				colors.add(color);
			}
			BufferedImage image = getBufferedImage(size.x, size.y, colors,
					CSSSWTColorHelper.getPercents(grad));
			
			ImageData imagedata = convertToSWT(image);
			
			
			newImage = new Image(control.getDisplay(), imagedata);
		} else {
			newImage = new Image(control.getDisplay(), size.x, size.y);
			GC gc = new GC(newImage);
			List<Color> colors = new ArrayList<Color>();
			for (Iterator iterator = grad.getRGBs().iterator(); iterator
					.hasNext();) {
				RGB rgb = (RGB) iterator.next();
				Color color = new Color(control.getDisplay(), rgb.red,