Hi All,
I am still a bit of a newbie with wx.GraphicsContext, so I
apologize if I am asking stupid questions. I am working on a couple of
new widgets, and I thought I would go with wx.GraphicsContext to
emulate a certain style and to use alpha transparencies in an easier
way. Now, my question is: is there a way to recreate the attached
figure using CreateLinear(Radial)GradientBrush (or a combination of
the two)? I found that with GDI+ this can easily be done using
something like that:
GraphicsPath path2 = this.GetPath(rc2, 20); # Create the path in
another method
PathGradientBrush br2 = new PathGradientBrush(path2);
br2.CenterColor = ControlPaint.DarkDark(Color.Silver);
br2.SurroundColors = new Color[]{Color.White};
I suppose PathGradientBrush doesn't exist in wxWidgets (or I am unable
to find it, which it may well be), so I don't really know how to
convert this part of the code *or* to use another wxWidgets approach
to recreate the figure.
Thank you for your suggestions.
Andrea.
"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

Hi Andrea,
you might be able to do this using 2 radial gradient brushes by drawing 2 rectangles, one of them with the first brush and the second one using a mask with a double triangle shape (think of an hourglass) and a gradient brush with a different radius or end/start color.
I’m away from a wxpython enviroment so this is only theory.
Peter
···
On Nov 22, 2007 9:59 PM, Andrea Gavana <andrea.gavana@gmail.com > wrote:
Hi All,
I am still a bit of a newbie with wx.GraphicsContext, so I
apologize if I am asking stupid questions. I am working on a couple of
new widgets, and I thought I would go with wx.GraphicsContext to
emulate a certain style and to use alpha transparencies in an easier
way. Now, my question is: is there a way to recreate the attached
figure using CreateLinear(Radial)GradientBrush (or a combination of
the two)? I found that with GDI+ this can easily be done using
something like that:
GraphicsPath path2 = this.GetPath(rc2, 20); # Create the path in
another method
PathGradientBrush br2 = new PathGradientBrush(path2);
br2.CenterColor = ControlPaint.DarkDark(Color.Silver);
br2.SurroundColors = new Color{Color.White};
I suppose PathGradientBrush doesn’t exist in wxWidgets (or I am unable
to find it, which it may well be), so I don’t really know how to
convert this part of the code or to use another wxWidgets approach
to recreate the figure.
Thank you for your suggestions.
Andrea.
“Imagination Is The Only Weapon In The War Against Reality.”
http://xoomer.alice.it/infinity77/
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail:
wxPython-users-help@lists.wxwidgets.org
–
There is NO FATE, we are the creators.
That's a solution for the particular case, but not for the general
problem, which is that the wxGC api only supports (fairly limited :()
radial and linear gradients. GDI+ (and possibly others? I'd assume
that cairo at least) support a gradient that's defined by an arbitrary
path.
This is something that I was wanting for my SVG renderer, but I got
pulled away from it before I could really look into implementing it.
Better support for gradient brushes (like ones where you don't have to
pre-caclulate all the pixel sizes by hand) would be nice too.
Patches welcome, I guess - it's something I'd like to do but I'm just
too busy to do it. It would need to be in C++, of course.
···
On Nov 22, 2007 4:05 PM, Peter Damoc <pdamoc@gmail.com> wrote:
Hi Andrea,
you might be able to do this using 2 radial gradient brushes by drawing 2
rectangles, one of them with the first brush and the second one using a mask
with a double triangle shape (think of an hourglass) and a gradient brush
with a different radius or end/start color.
I'm away from a wxpython enviroment so this is only theory.
Peter