diff --git a/src/Tizen.NUI/src/devel/Lite/L.Color.cs b/src/Tizen.NUI/src/devel/Lite/L.Color.cs new file mode 100644 index 00000000000..1ed98ff1006 --- /dev/null +++ b/src/Tizen.NUI/src/devel/Lite/L.Color.cs @@ -0,0 +1,97 @@ +/* + * Copyright(c) 2025 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +using System.ComponentModel; + +namespace Tizen.NUI.L +{ + /// + /// Defines a value type of color. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public struct Color + { + public static readonly Color Transparent = new Color(0, 0, 0, 0); + public static readonly Color Black = new Color(0, 0, 0, 1); + public static readonly Color White = new Color(1, 1, 1, 1); + public static readonly Color Red = new Color(1, 0, 0, 1); + public static readonly Color Green = new Color(0, 1, 0, 1); + public static readonly Color Blue = new Color(0, 0, 1, 1); + + /// + /// Initializes a new instance of the struct. + /// + /// The red component. + /// The green component. + /// The blue component. + /// The alpha component. + public Color(float r, float g, float b, float a) + { + R = r; + G = g; + B = b; + A = a; + } + + /// + /// Gets the red component of the color. + /// + public float R + { + get; + } + + /// + /// Gets the green component of the color. + /// + public float G + { + get; + } + + /// + /// Gets the blue component of the color. + /// + public float B + { + get; + } + + /// + /// Gets the alpha component of the color. + /// + public float A + { + get; + } + + /// + /// Multiplies the alpha component of the color by the specified value. + /// + /// The value to multiply the alpha component by. + /// The new color. + public readonly Color MultiplyAlpha(float alpha) => new Color(R, G, B, A * alpha); + + /// + /// Returns a new color object with the specified alpha value. + /// + /// The new alpha value. + /// A new color object with the specified alpha value. + public readonly Color WithAlpha(float alpha) => new Color(R, G, B, alpha); + + internal readonly NUI.Color ToReferenceType() => new NUI.Color(R, G, B, A); + } +} diff --git a/src/Tizen.NUI/src/devel/Lite/L.Shadow.cs b/src/Tizen.NUI/src/devel/Lite/L.Shadow.cs new file mode 100644 index 00000000000..effb550b7a2 --- /dev/null +++ b/src/Tizen.NUI/src/devel/Lite/L.Shadow.cs @@ -0,0 +1,94 @@ +/* + * Copyright(c) 2025 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +using System.ComponentModel; + +namespace Tizen.NUI.L +{ + /// + /// Defines a value type of shadow. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public struct Shadow + { + /// + /// Create a Shadow. + /// + /// The blur radius value for the shadow. Bigger value, much blurry. + public Shadow(float blurRadius) : this(blurRadius, L.Color.Black, Vector2.Zero, Vector2.Zero) + { + } + + /// + /// Create a Shadow. + /// + /// The blur radius value for the shadow. Bigger value, much blurry. + /// The color for the shadow. + /// Optional. The position offset value (x, y) from the top left corner. + /// Optional. The shadow will extend its size by specified amount of length. + public Shadow(float blurRadius, L.Color color, Vector2 offset, Vector2 extents) + { + BlurRadius = blurRadius; + Color = color; + Offset = offset; + Extents = extents; + } + + /// + /// The blur radius value for the shadow. Bigger value, much blurry. + /// + /// + /// Negative value is ignored. (no blur) + /// + public float BlurRadius + { + get; + set; + } + + /// + /// The color for the shadow. + /// + public L.Color Color + { + get; + set; + } + + /// + /// The position offset value (x, y) from the top left corner. + /// + public Vector2 Offset + { + get; + set; + } + + /// + /// The shadow will extend its size by specified amount of length.
+ /// If the value is negative then the shadow will shrink. + /// For example, when View's size is (100, 100) and the Shadow's Extents is (5, -5), + /// the output shadow will have size (105, 95). + ///
+ public Vector2 Extents + { + get; + set; + } + + internal readonly NUI.Shadow ToShadow() => new NUI.Shadow(BlurRadius, Color.ToReferenceType(), Offset.ToReferenceType(), Extents.ToReferenceType()); + } +} diff --git a/src/Tizen.NUI/src/devel/Lite/L.Vector2.cs b/src/Tizen.NUI/src/devel/Lite/L.Vector2.cs new file mode 100644 index 00000000000..f9aba5567c1 --- /dev/null +++ b/src/Tizen.NUI/src/devel/Lite/L.Vector2.cs @@ -0,0 +1,68 @@ +/* + * Copyright(c) 2025 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +using System.ComponentModel; + +namespace Tizen.NUI.L +{ + /// + /// Defines a value type of vector2. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public readonly struct Vector2 + { + public static readonly Vector2 Zero = new Vector2(0.0f, 0.0f); + + /// + /// Initializes a new instance of the struct. + /// + /// The x value. + /// The y value. + public Vector2(float x, float y) + { + X = x; + Y = y; + } + + /// + /// Gets the x component of the vector2. + /// + public float X + { + get; + } + + /// + /// Gets the y component of the vector2. + /// + public float Y + { + get; + } + + /// + /// Gets the width component of the vector2. + /// + public float Width => X; + + /// + /// Gets the height component of the vector2. + /// + public float Height => Y; + + internal readonly NUI.Vector2 ToReferenceType() => new NUI.Vector2(X, Y); + } +}