Circular Gradient and WPF

2019-07-13 11:47发布

问题:

I need to replicate a circular (or angle) gradient from a Photoshop comp in WPF; so far I can only find linear and radial. Does anyone know if such a thing exists, or and easy way to get get a circular gradient in WPF?

Note: I'm not asking about a radial gradient. A circular gradient is like taking a rectangle, applying a gradient and then transforming the rectangle into a circle.

回答1:

Check this question for a new and a bit more complete answer to this question.



回答2:

While I've never done this before (so I don't know what's involved) you could implement a type that inherits from GradientBrush. I don't think this is trivial though.

I've also not worked with Photoshop circular gradients, but from your description I can't help but think that you could at least approximate it using a LinearGradientBrush and then transforming the result - perhaps using a MatrixTransform.

Sorry that I can't give you concrete answers, but maybe these suggestions can point you in the right direction.



标签: wpf gradient psd