8d950884ca529f4d10c1b43f11102671392b8989
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / ViewProperty / BackgroundExtraData.cs
1 /*
2  * Copyright(c) 2020 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 namespace Tizen.NUI
19 {
20     /// <summary>
21     /// The class storing Background extra properties such as CornerRadius, ImageBorder.
22     /// </summary>
23     internal class BackgroundExtraData
24     {
25         internal BackgroundExtraData()
26         {
27         }
28
29         internal BackgroundExtraData(BackgroundExtraData other)
30         {
31             BackgroundImageBorder = other.BackgroundImageBorder;
32             CornerRadius = other.CornerRadius;
33         }
34
35         private Rectangle backgroundImageBorder;
36
37         /// <summary></summary>
38         internal Rectangle BackgroundImageBorder
39         {
40             get => backgroundImageBorder;
41             set => backgroundImageBorder = new Rectangle(value);
42         }
43
44         /// <summary></summary>
45         internal float CornerRadius { get; set; }
46
47         /// <summary>
48         /// Whether the CornerRadius value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
49         /// </summary>
50         internal VisualTransformPolicyType CornerRadiusPolicy { get; set; } = VisualTransformPolicyType.Absolute;
51
52         internal bool Empty()
53         {
54             return CornerRadius == 0 && Rectangle.IsNullOrZero(BackgroundImageBorder);
55         }
56     }
57 }
58
59