Community
Participate
Working Groups
The SWT GC currently provides a very basic support for vertical and horizontal backgrounds. For e4 (styling) it is very important that SWT supports more sophisticated gradients. While I don't have a suggestion for an API yet, I would like the discussion here. A good starting point for the possible capabilities could be the WebKit gradients based on css: http://webkit.org/blog/175/introducing-css-gradients/ Here is a list of possible features: - radial and linear gradients - list of color stops - for linear gradients: free direction (start point/end point based) - for radial gradients: lists of start points with radius and color-stops
There is already some API for this (see Pattern.java). It supports linear gradients with two color stops.
Yes, I mentioned that in my original post, but this is way too basic for today's modern UIs.
Silenio, would it be possible/easy to add radial gradients? Do the platforms support this, or would we have to emulate anything?
Cairo/Gtk and the Quartz/Mac support radial gradients. There API is similar: the radial gradient is defined by two center points and two radius. GDI+ has PathGradientBrush, which seems powerful, but I believe it is not possible to implement the same kind of API of Cairo/Quartz. It may be possible to implement an API with one center point, one focal point and a radius. I will investigate.
Silenio, any news on this. I the light of the new CTabFolder stuff I've been experimenting renderers using SVG which provides the following features http://www.w3.org/TR/SVG11/pservers.html
Sorry, I spent some time trying to come with a common API for radial gradients, but I was not very successful. Given that we are so close to API freeze, I believe this is not going to happen for 3.6.
Any chance to see this in 3.7?
I will have to say sorry again. This API is not going to happen in 3.7.
Well - here's my proposal instead of inventing an API for this why does SWT not simply provided a setStyle(String) method which allows to set an radial/linear/... gradient. I think this should be the solution for more advanced stuff, the current implementation of CSS stuff like gradient is more like a hack and other stuff like padding is not even implementable with it.
I'd like to help get this bug closed out with the next release (3.9/4.3) and have taken a stab at it here: https://github.com/jeremy-dowdall/eclipse.platform.swt The API and functionality follow SVG (http://www.w3.org/TR/SVG11/pservers.html - as mentioned earlier by Tom): // linear gradient Pattern pattern = new Pattern(device, x1, y1, x2, y2); pattern.setSpreadMethod(Pattern.REFLECT); pattern.addStop(color1, 0.0f, 255); pattern.addStop(color2, 0.6f, 128); // color, offset, alpha pattern.addStop(color3, 1.0f, 0); gc.setBackgroundPattern(pattern); gc.fillRoundRectangle(0, 0, 100,100, 10,10); // a radial gradient just takes an extra parameter: Pattern pattern = new Pattern(device, cx, cy, fx, fy, r); The fork works on Cairo(32), Quartz(64), and GDI+(32). I've tried to make sure 32/64bit conversions are handled, but may have missed something as I don't have all environments up and running.
Silenio, any update on this? Let me know how I can help.
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.