2 * Copyright(c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 using Tizen.NUI.BaseComponents;
18 using Tizen.NUI.Components;
21 namespace NUITizenGallery
23 public partial class BrushComponentsTestPage : View
25 public BrushComponentsTestPage()
27 InitializeComponent();
29 LinearLayout pageLayout = new LinearLayout();
30 pageLayout.LinearOrientation = LinearLayout.Orientation.Vertical;
31 pageLayout.CellPadding = new Size2D(10, 10);
32 pageLayout.Padding = new Extents(10, 10, 10, 10);
33 this.Layout = pageLayout;
35 ButtonSolid.Clicked += OnClickedSolid;
36 ButtonGradientLinear.Clicked += OnClickedLinear;
37 ButtonGradientRadial.Clicked += OnClickedRadial;
40 public void OnClickedSolid(object sender, ClickedEventArgs args)
42 ViewTest1.BackgroundColor = Color.Red;
43 ViewTest2.BackgroundColor = Color.Red;
44 ViewTest3.BackgroundColor = Color.Red;
47 public void OnClickedLinear(object sender, ClickedEventArgs args)
49 PropertyArray stopColor = new PropertyArray();
50 stopColor.Add(new PropertyValue(new Vector4(255.0f, 0.0f, 0.0f, 255.0f) / 255.0f));
51 stopColor.Add(new PropertyValue(new Vector4(0.0f, 255.0f, 0.0f, 255.0f) / 255.0f));
53 GradientVisual linearGradient = new GradientVisual();
54 linearGradient.StopColor = stopColor;
55 linearGradient.StartPosition = new Vector2(0.0f, 0.0f);
56 linearGradient.EndPosition = new Vector2(0.3f, 0.3f);
57 linearGradient.Origin = Visual.AlignType.TopBegin;
59 ViewTest1.Background = linearGradient.OutputVisualMap;
60 ViewTest2.Background = linearGradient.OutputVisualMap;
61 ViewTest3.Background = linearGradient.OutputVisualMap;
64 public void OnClickedRadial(object sender, ClickedEventArgs args)
66 PropertyArray stopColor = new PropertyArray();
67 stopColor.Add(new PropertyValue(new Vector4(255.0f, 0.0f, 0.0f, 255.0f) / 255.0f));
68 stopColor.Add(new PropertyValue(new Vector4(0.0f, 255.0f, 0.0f, 255.0f) / 255.0f));
70 GradientVisual radialGradient = new GradientVisual();
71 radialGradient.Center = new Vector2(0.0f, 0.0f);
72 radialGradient.Radius = 0.5f;
73 radialGradient.StopColor = stopColor;
74 radialGradient.Origin = Visual.AlignType.TopBegin;
76 ViewTest1.Background = radialGradient.OutputVisualMap;
77 ViewTest2.Background = radialGradient.OutputVisualMap;
78 ViewTest3.Background = radialGradient.OutputVisualMap;