简体   繁体   中英

How to draw a circle with a radial gradient on the canvas?

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:
梯度
PS I ask how to draw it at least programmaticaly without XAML.
PPS 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM