Page 1 of 1

SetOpacity documentation

Posted: 28 Nov 2018, 18:18
by matejr5
Hi!
I had quite a problem with this function: void Brush::SetOpacity(float opacity);

I think that the implementation of this is quite different form what average person would guess. At least I would guess that SetOpacity(0.5f) would set opacity to ~0x7F, SetOpacity(1.0f) would set it to ~0xFF etc... The actual behavior is SetOpacity(0.5f) sets opacity to "xaml defined opacity" * 0.5

I would say it deserves better documentation (the current description "Gets/Sets Opacity" leaves me quite confused).

cheers,
matejr5

Re: SetOpacity documentation

Posted: 03 Dec 2018, 14:31
by sfernandez
Yes, we wil improve the documentation text of Brush properties to better explain their meaning.

The Brush.Opacity property is used to control opacity of the brush in a generic way, no matter which kind of brush you are using: SolidColorBrush, LinearGradientBrush, RadialGradientBrush, ImageBrush... That opacity value is used during rendering, it doesn't modify other brush properties.