问题
I need to draw a circle with a radial gradient on the canvas in my custom control (XAML). But Windows::UI::Xaml::Media
contains LinearGradientBrush
only. I know about design guids but my control requires so feature to the user can see the color gamma.
Below that I need to get:
P.S. I ask how to draw it at least programmaticaly without XAML.
P.P.S. I know that I can draw a picture in some editor with radial gradient and after draw it on the canvas but it seems not good solution for the adaptive design.
回答1:
You can check the RenderColorPickerHueRing() method for a sample of how you could do it on a CPU in a WriteableBitmap
. It's not super fast (at least in the C# version), but at least it saves you from packaging another image with your app or from using DirectX, which is a bit more tricky to get set up correctly and stabilize.
来源:https://stackoverflow.com/questions/43376290/how-to-draw-a-circle-with-a-radial-gradient-on-the-canvas