Understanding the "Center" for RadialGradientBrushes

I am trying to understand what a property does Centerin RadialGradientBrush. MSDN says: "Gets or sets the center of the outermost circumference of a radial gradient." But when I set its value, I get results that do not make sense to me.

For example:

    <Rectangle Margin="10" Width="200" Height="200">
        <Rectangle.Fill>
            <RadialGradientBrush  Center="0.5,0.5">
                <GradientStop Color="Green" Offset="0" />
                <GradientStop Color="Yellow" Offset=".5" />
                <GradientStop Color="DarkRed" Offset=".5" />                        
                <GradientStop Color="Black" Offset="1.2" />
            </RadialGradientBrush>
        </Rectangle.Fill>
    </Rectangle>

Using the default value for Center, it gives me something similar to this:

Default value

This is what I expected. But if I change it to = "0.5.1", I get the following:

After the change of center

MSDN , , "" GradientStop. , , . ( , ), . = "0,5,3", , .

enter image description here

, , . - , ?

+4
1

GradientOrigin, " ". , , , .

. , , 0 .

, , , , , . , , , .

< >
" ", , .

(, , & hellip; - ), , , , - .

, - , RadialGradientBrush, , , , , ( ).

: , , , - , , .. , . - .

, , ( Center, RadiusX RadiusY) GradientOrigin. , , , , .
</ >

API, "undefined". - , , ( , , , ). ID2D1RadialGradientBrush

0.0f , 1.0f . , [0, 1] . , , , ..

, , , , , " " , (. ). , , , . , .:)

, 1. , 1, , .


. , , . , . , .

+2

Source: https://habr.com/ru/post/1625767/


All Articles