@@ -13,11 +13,12 @@ namespace winrt::Microsoft::UI::Xaml::Media
13
13
14
14
#include " RadialGradientBrush.g.cpp"
15
15
16
- GlobalDependencyProperty RadialGradientBrushProperties::s_EllipseCenterProperty{ nullptr };
17
- GlobalDependencyProperty RadialGradientBrushProperties::s_EllipseRadiusProperty{ nullptr };
16
+ GlobalDependencyProperty RadialGradientBrushProperties::s_CenterProperty{ nullptr };
18
17
GlobalDependencyProperty RadialGradientBrushProperties::s_GradientOriginProperty{ nullptr };
19
18
GlobalDependencyProperty RadialGradientBrushProperties::s_InterpolationSpaceProperty{ nullptr };
20
19
GlobalDependencyProperty RadialGradientBrushProperties::s_MappingModeProperty{ nullptr };
20
+ GlobalDependencyProperty RadialGradientBrushProperties::s_RadiusXProperty{ nullptr };
21
+ GlobalDependencyProperty RadialGradientBrushProperties::s_RadiusYProperty{ nullptr };
21
22
GlobalDependencyProperty RadialGradientBrushProperties::s_SpreadMethodProperty{ nullptr };
22
23
23
24
RadialGradientBrushProperties::RadialGradientBrushProperties ()
@@ -27,27 +28,16 @@ RadialGradientBrushProperties::RadialGradientBrushProperties()
27
28
28
29
void RadialGradientBrushProperties::EnsureProperties ()
29
30
{
30
- if (!s_EllipseCenterProperty )
31
+ if (!s_CenterProperty )
31
32
{
32
- s_EllipseCenterProperty =
33
+ s_CenterProperty =
33
34
InitializeDependencyProperty (
34
- L" EllipseCenter " ,
35
+ L" Center " ,
35
36
winrt::name_of<winrt::Point >(),
36
37
winrt::name_of<winrt::RadialGradientBrush>(),
37
38
false /* isAttached */ ,
38
39
ValueHelper<winrt::Point >::BoxValueIfNecessary (winrt::Point (0.5 ,0.5 )),
39
- winrt::PropertyChangedCallback (&OnEllipseCenterPropertyChanged));
40
- }
41
- if (!s_EllipseRadiusProperty)
42
- {
43
- s_EllipseRadiusProperty =
44
- InitializeDependencyProperty (
45
- L" EllipseRadius" ,
46
- winrt::name_of<winrt::Point >(),
47
- winrt::name_of<winrt::RadialGradientBrush>(),
48
- false /* isAttached */ ,
49
- ValueHelper<winrt::Point >::BoxValueIfNecessary (winrt::Point (0.5 ,0.5 )),
50
- winrt::PropertyChangedCallback (&OnEllipseRadiusPropertyChanged));
40
+ winrt::PropertyChangedCallback (&OnCenterPropertyChanged));
51
41
}
52
42
if (!s_GradientOriginProperty)
53
43
{
@@ -82,6 +72,28 @@ void RadialGradientBrushProperties::EnsureProperties()
82
72
ValueHelper<winrt::BrushMappingMode>::BoxValueIfNecessary (winrt::BrushMappingMode::RelativeToBoundingBox),
83
73
winrt::PropertyChangedCallback (&OnMappingModePropertyChanged));
84
74
}
75
+ if (!s_RadiusXProperty)
76
+ {
77
+ s_RadiusXProperty =
78
+ InitializeDependencyProperty (
79
+ L" RadiusX" ,
80
+ winrt::name_of<double >(),
81
+ winrt::name_of<winrt::RadialGradientBrush>(),
82
+ false /* isAttached */ ,
83
+ ValueHelper<double >::BoxValueIfNecessary (0.5 ),
84
+ winrt::PropertyChangedCallback (&OnRadiusXPropertyChanged));
85
+ }
86
+ if (!s_RadiusYProperty)
87
+ {
88
+ s_RadiusYProperty =
89
+ InitializeDependencyProperty (
90
+ L" RadiusY" ,
91
+ winrt::name_of<double >(),
92
+ winrt::name_of<winrt::RadialGradientBrush>(),
93
+ false /* isAttached */ ,
94
+ ValueHelper<double >::BoxValueIfNecessary (0.5 ),
95
+ winrt::PropertyChangedCallback (&OnRadiusYPropertyChanged));
96
+ }
85
97
if (!s_SpreadMethodProperty)
86
98
{
87
99
s_SpreadMethodProperty =
@@ -97,28 +109,21 @@ void RadialGradientBrushProperties::EnsureProperties()
97
109
98
110
void RadialGradientBrushProperties::ClearProperties ()
99
111
{
100
- s_EllipseCenterProperty = nullptr ;
101
- s_EllipseRadiusProperty = nullptr ;
112
+ s_CenterProperty = nullptr ;
102
113
s_GradientOriginProperty = nullptr ;
103
114
s_InterpolationSpaceProperty = nullptr ;
104
115
s_MappingModeProperty = nullptr ;
116
+ s_RadiusXProperty = nullptr ;
117
+ s_RadiusYProperty = nullptr ;
105
118
s_SpreadMethodProperty = nullptr ;
106
119
}
107
120
108
- void RadialGradientBrushProperties::OnEllipseCenterPropertyChanged (
109
- winrt::DependencyObject const & sender,
110
- winrt::DependencyPropertyChangedEventArgs const & args)
111
- {
112
- auto owner = sender.as <winrt::RadialGradientBrush>();
113
- winrt::get_self<RadialGradientBrush>(owner)->OnEllipseCenterPropertyChanged (args);
114
- }
115
-
116
- void RadialGradientBrushProperties::OnEllipseRadiusPropertyChanged (
121
+ void RadialGradientBrushProperties::OnCenterPropertyChanged (
117
122
winrt::DependencyObject const & sender,
118
123
winrt::DependencyPropertyChangedEventArgs const & args)
119
124
{
120
125
auto owner = sender.as <winrt::RadialGradientBrush>();
121
- winrt::get_self<RadialGradientBrush>(owner)->OnEllipseRadiusPropertyChanged (args);
126
+ winrt::get_self<RadialGradientBrush>(owner)->OnCenterPropertyChanged (args);
122
127
}
123
128
124
129
void RadialGradientBrushProperties::OnGradientOriginPropertyChanged (
@@ -145,32 +150,38 @@ void RadialGradientBrushProperties::OnMappingModePropertyChanged(
145
150
winrt::get_self<RadialGradientBrush>(owner)->OnMappingModePropertyChanged (args);
146
151
}
147
152
148
- void RadialGradientBrushProperties::OnSpreadMethodPropertyChanged (
153
+ void RadialGradientBrushProperties::OnRadiusXPropertyChanged (
149
154
winrt::DependencyObject const & sender,
150
155
winrt::DependencyPropertyChangedEventArgs const & args)
151
156
{
152
157
auto owner = sender.as <winrt::RadialGradientBrush>();
153
- winrt::get_self<RadialGradientBrush>(owner)->OnSpreadMethodPropertyChanged (args);
158
+ winrt::get_self<RadialGradientBrush>(owner)->OnRadiusXPropertyChanged (args);
154
159
}
155
160
156
- void RadialGradientBrushProperties::EllipseCenter (winrt::Point const & value)
161
+ void RadialGradientBrushProperties::OnRadiusYPropertyChanged (
162
+ winrt::DependencyObject const & sender,
163
+ winrt::DependencyPropertyChangedEventArgs const & args)
157
164
{
158
- static_cast <RadialGradientBrush*>(this )->SetValue (s_EllipseCenterProperty, ValueHelper<winrt::Point >::BoxValueIfNecessary (value));
165
+ auto owner = sender.as <winrt::RadialGradientBrush>();
166
+ winrt::get_self<RadialGradientBrush>(owner)->OnRadiusYPropertyChanged (args);
159
167
}
160
168
161
- winrt::Point RadialGradientBrushProperties::EllipseCenter ()
169
+ void RadialGradientBrushProperties::OnSpreadMethodPropertyChanged (
170
+ winrt::DependencyObject const & sender,
171
+ winrt::DependencyPropertyChangedEventArgs const & args)
162
172
{
163
- return ValueHelper<winrt::Point >::CastOrUnbox (static_cast <RadialGradientBrush*>(this )->GetValue (s_EllipseCenterProperty));
173
+ auto owner = sender.as <winrt::RadialGradientBrush>();
174
+ winrt::get_self<RadialGradientBrush>(owner)->OnSpreadMethodPropertyChanged (args);
164
175
}
165
176
166
- void RadialGradientBrushProperties::EllipseRadius (winrt::Point const & value)
177
+ void RadialGradientBrushProperties::Center (winrt::Point const & value)
167
178
{
168
- static_cast <RadialGradientBrush*>(this )->SetValue (s_EllipseRadiusProperty , ValueHelper<winrt::Point >::BoxValueIfNecessary (value));
179
+ static_cast <RadialGradientBrush*>(this )->SetValue (s_CenterProperty , ValueHelper<winrt::Point >::BoxValueIfNecessary (value));
169
180
}
170
181
171
- winrt::Point RadialGradientBrushProperties::EllipseRadius ()
182
+ winrt::Point RadialGradientBrushProperties::Center ()
172
183
{
173
- return ValueHelper<winrt::Point >::CastOrUnbox (static_cast <RadialGradientBrush*>(this )->GetValue (s_EllipseRadiusProperty ));
184
+ return ValueHelper<winrt::Point >::CastOrUnbox (static_cast <RadialGradientBrush*>(this )->GetValue (s_CenterProperty ));
174
185
}
175
186
176
187
void RadialGradientBrushProperties::GradientOrigin (winrt::Point const & value)
@@ -203,6 +214,26 @@ winrt::BrushMappingMode RadialGradientBrushProperties::MappingMode()
203
214
return ValueHelper<winrt::BrushMappingMode>::CastOrUnbox (static_cast <RadialGradientBrush*>(this )->GetValue (s_MappingModeProperty));
204
215
}
205
216
217
+ void RadialGradientBrushProperties::RadiusX (double value)
218
+ {
219
+ static_cast <RadialGradientBrush*>(this )->SetValue (s_RadiusXProperty, ValueHelper<double >::BoxValueIfNecessary (value));
220
+ }
221
+
222
+ double RadialGradientBrushProperties::RadiusX ()
223
+ {
224
+ return ValueHelper<double >::CastOrUnbox (static_cast <RadialGradientBrush*>(this )->GetValue (s_RadiusXProperty));
225
+ }
226
+
227
+ void RadialGradientBrushProperties::RadiusY (double value)
228
+ {
229
+ static_cast <RadialGradientBrush*>(this )->SetValue (s_RadiusYProperty, ValueHelper<double >::BoxValueIfNecessary (value));
230
+ }
231
+
232
+ double RadialGradientBrushProperties::RadiusY ()
233
+ {
234
+ return ValueHelper<double >::CastOrUnbox (static_cast <RadialGradientBrush*>(this )->GetValue (s_RadiusYProperty));
235
+ }
236
+
206
237
void RadialGradientBrushProperties::SpreadMethod (winrt::GradientSpreadMethod const & value)
207
238
{
208
239
static_cast <RadialGradientBrush*>(this )->SetValue (s_SpreadMethodProperty, ValueHelper<winrt::GradientSpreadMethod>::BoxValueIfNecessary (value));
0 commit comments