On 2017-10-03 11:24+0100 Phil Rosenberg wrote:
Hi Alan
It may be possible to do as you said with a clip region and an affine
transform. I did consider this but I am not sure if the gradient gets
transformed or just the polygon shape. I would have to check.
Regarding inheritance, you have the correct syntax. wxDC and
wxGraphicsContext are pretty close to top level classes so only
inherit from wxObject, which many wxWidgets classes inherit from and I
think it basically allows conversion between classes and strings which
specify the class name. If you look in the docs,
e.g.http://docs.wxwidgets.org/3.1/classwx_d_c.html, there is usually
an inheritance diagram. You have access to all the functions towards
the base of the tree, but the magic of C++ is that the behaviour of
some of the functions can be redefined towards the branches of a tree
by using the virtual specifier. So for example wxDC has a virtual
function DrawLines. So if I have a pointer to a wxDC I can always call
myDcPointer->DrawLines(/*params*/). But then if that pointer actually
points to an inherited class then the inherited class's version of
that function is called, so a wxPostscriptDC would write the vector to
the file, a wxMemoryDC would work out which pixels need shading and
shade them, etc.
Hi Phil:
I don't claim to understand everything you have said above in your
second paragraph, but if the upshot is there are C++ ways to give us
access to all wxWidget library methods regardless of the class they
are in, then I suggest the most promising way forward (since the
documentation does not mention any limitations on this brush) is
likely to be to use wxGraphicsContext::CreateLinearGradientBrush
rather than wxDC::GradientFillLinear (which does have many documented
limitations).
(Note, this speculation jibes with the [now ancient] advice at
<http://wxwidgets.10942.n7.nabble.com/Gradient-Fill-for-Rounded-Rectangle-td28295.html>
that filling a non-rectangular area with a gradient can only be done
with wxGraphicsContext.)
To follow up my speculation above, would you be willing to check with
your wxWidgets contacts if
wxGraphicsContext::CreateLinearGradientBrush can be used in the way I
describe to paint a native gradient at any angle for any
non-rectangular area?
Alan
__________________________
Alan W. Irwin
Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).
Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________
Linux-powered Science
__________________________
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel