From a2ff95334e696dbf9de2ab2756d3fae25900e057 Mon Sep 17 00:00:00 2001 From: Jiyun Yang Date: Wed, 8 Jan 2025 21:04:16 +0900 Subject: [PATCH] [NUI] Add markup for some view properties using value type This also includes PropertyMap optimizations to prevent value type being conveted to reference type again. Signed-off-by: Jiyun Yang --- src/Tizen.NUI/src/devel/Lite/L.Color.cs | 78 ++++- src/Tizen.NUI/src/devel/Lite/L.Corner.cs | 92 ++++++ src/Tizen.NUI/src/devel/Lite/L.Shadow.cs | 106 ++++++- src/Tizen.NUI/src/devel/Lite/L.Vector2.cs | 7 +- .../src/devel/Markup/ViewExtensions.cs | 266 ++++++++++++++++++ src/Tizen.NUI/src/internal/Common/Object.cs | 42 +++ .../src/internal/Common/ReusablePool.cs | 189 +++++++++++++ .../src/internal/Interop/Interop.Actor.cs | 3 + .../internal/Interop/Interop.PropertyMap.cs | 38 +++ .../src/internal/Interop/Interop.Vector4.cs | 4 + .../public/BaseComponents/ViewLiteProperty.cs | 64 +++++ .../src/public/Common/PropertyMap.cs | 196 +++++++++++++ src/Tizen.NUI/src/public/Common/Vector4.cs | 36 ++- 13 files changed, 1087 insertions(+), 34 deletions(-) create mode 100644 src/Tizen.NUI/src/devel/Lite/L.Corner.cs create mode 100644 src/Tizen.NUI/src/devel/Markup/ViewExtensions.cs create mode 100644 src/Tizen.NUI/src/internal/Common/ReusablePool.cs create mode 100755 src/Tizen.NUI/src/public/BaseComponents/ViewLiteProperty.cs diff --git a/src/Tizen.NUI/src/devel/Lite/L.Color.cs b/src/Tizen.NUI/src/devel/Lite/L.Color.cs index 1ed98ff1006..6de76adf1ae 100644 --- a/src/Tizen.NUI/src/devel/Lite/L.Color.cs +++ b/src/Tizen.NUI/src/devel/Lite/L.Color.cs @@ -24,12 +24,40 @@ namespace Tizen.NUI.L [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); + /// + /// The default color. (This is to distinguish from zero corners) + /// + public static readonly Color Default = new (-1, -1, -1, -1); + + /// + /// The transparent color. + /// + public static readonly Color Transparent = new (0, 0, 0, 0); + + /// + /// The transparent color. + /// + public static readonly Color Black = new (0, 0, 0, 1); + + /// + /// The white color. + /// + public static readonly Color White = new (1, 1, 1, 1); + + /// + /// The red color. + /// + public static readonly Color Red = new (1, 0, 0, 1); + + /// + /// The green color. + /// + public static readonly Color Green = new (0, 1, 0, 1); + + /// + /// The blue color. + /// + public static readonly Color Blue = new (0, 0, 1, 1); /// /// Initializes a new instance of the struct. @@ -46,6 +74,39 @@ public Color(float r, float g, float b, float a) A = a; } + /// + /// Initializes a new instance of the struct. + /// + /// The value of 0xRRGGBB format. + /// The alpha value between 0.0 and 1.0. + /// + /// + /// new L.Color(0xFF0000, 1f); // Solid red + /// new L.Color(0x00FF00, 0.5f) // Half transparent green + /// + /// + public Color(uint value, float alpha) + { + R = ((value >> 16) & 0xff) / 255.0f; + G = ((value >> 8) & 0xff) / 255.0f; + B = (value & 0xff) / 255.0f; + A = alpha; + } + + internal Color(NUI.Vector4 vector4) : this(vector4.X, vector4.Y, vector4.Z, vector4.W) + { + } + + /// + /// Gets a value indicating whether this is default. + /// + public readonly bool IsDefault => R == -1 && G == -1 && B == -1 && A == -1; + + /// + /// Gets a value indicating whether this is zero. + /// + public readonly bool IsZero => R == 0 && G == 0 && B == 0 && A == 0; + /// /// Gets the red component of the color. /// @@ -85,12 +146,15 @@ public float A /// The new color. public readonly Color MultiplyAlpha(float alpha) => new Color(R, G, B, A * alpha); + /// + public override string ToString() => $"R:{R}, G:{G}, B:{B}, A:{A}"; + /// /// 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); + public readonly Color WithAlpha(float alpha) => new (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.Corner.cs b/src/Tizen.NUI/src/devel/Lite/L.Corner.cs new file mode 100644 index 00000000000..8a26c4c8747 --- /dev/null +++ b/src/Tizen.NUI/src/devel/Lite/L.Corner.cs @@ -0,0 +1,92 @@ +/* + * 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 corner radius. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public struct Corner + { + /// + /// The default corner. (This is to distinguish from zero corners) + /// + public static readonly Corner Default = new (-1, -1, -1, -1); + + /// + /// The zero corner. + /// + public static readonly Corner Zero = new (0.0f, 0.0f, 0.0f, 0.0f); + + /// + /// Initializes a new instance of the struct. + /// + /// The uniform corner value. + public Corner(float uniform) : this(uniform, uniform, uniform, uniform) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The top-left value. + /// The top-right value. + /// The bottom-right value. + /// The bottom-left value. + public Corner(float topLeft, float topRight, float bottomRight, float bottomLeft) + { + TopLeft = topLeft; + TopRight = topRight; + BottomRight = bottomRight; + BottomLeft = bottomLeft; + } + + /// + /// Gets a value indicating whether this is default. + /// + public readonly bool IsDefault => TopLeft == -1 && TopRight == -1 && BottomRight == -1 && BottomLeft == -1; + + /// + /// Gets a value indicating whether this is zero. + /// + public readonly bool IsZero => TopLeft == 0 && TopRight == 0 && BottomRight == 0 && BottomLeft == 0; + + /// + /// The radius of the top left corner of the rectangle. + /// + public float TopLeft { get; } + + /// + /// The radius of the top right corner of the rectangle. + /// + public float TopRight { get; } + + /// + /// The radius of the bottom right corner of the rectangle. + /// + public float BottomRight { get; } + + /// + /// The radius of the bottom left corner of the rectangle. + /// + public float BottomLeft { get; } + + internal readonly NUI.Vector4 ToReferenceType() => new NUI.Vector4(TopLeft, TopRight, BottomRight, BottomLeft); + } +} diff --git a/src/Tizen.NUI/src/devel/Lite/L.Shadow.cs b/src/Tizen.NUI/src/devel/Lite/L.Shadow.cs index effb550b7a2..cc565ad2005 100644 --- a/src/Tizen.NUI/src/devel/Lite/L.Shadow.cs +++ b/src/Tizen.NUI/src/devel/Lite/L.Shadow.cs @@ -15,6 +15,7 @@ * */ using System.ComponentModel; +using Tizen.NUI.BaseComponents; namespace Tizen.NUI.L { @@ -28,7 +29,13 @@ 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) + /// Optional. The x offset value from the top left corner. The default is 0. + /// Optional. The y offset value from the top left corner. The default is 0. + /// Optional. The shadow will extend its size by specified amount of length. The default is 0. + /// Optional. The shadow will extend its size by specified amount of length. The default is 0. + /// The policy of the shadow cutout. The default is . + public Shadow(float blurRadius, float offsetX = 0, float offsetY = 0, float extraWidth = 0, float extraHeight = 0, ColorVisualCutoutPolicyType cutoutPolicy = ColorVisualCutoutPolicyType.None) + : this(blurRadius, L.Color.Black, offsetX, offsetY, extraWidth, extraHeight, cutoutPolicy) { } @@ -37,14 +44,20 @@ public Shadow(float blurRadius) : this(blurRadius, L.Color.Black, Vector2.Zero, /// /// 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) + /// Optional. The x offset value from the top left corner. The default is 0. + /// Optional. The y offset value from the top left corner. The default is 0. + /// Optional. The shadow will extend its size by specified amount of length. The default is 0. + /// Optional. The shadow will extend its size by specified amount of length. The default is 0. + /// The policy of the shadow cutout. The default is . + public Shadow(float blurRadius, L.Color color, float offsetX = 0, float offsetY = 0, float extraWidth = 0, float extraHeight = 0, ColorVisualCutoutPolicyType cutoutPolicy = ColorVisualCutoutPolicyType.None) { BlurRadius = blurRadius; Color = color; - Offset = offset; - Extents = extents; + OffsetX = offsetX; + OffsetY = offsetY; + ExtraWidth = extraWidth; + ExtraHeight = extraHeight; + CutoutPolicy = cutoutPolicy; } /// @@ -56,7 +69,7 @@ public Shadow(float blurRadius, L.Color color, Vector2 offset, Vector2 extents) public float BlurRadius { get; - set; + init; } /// @@ -65,30 +78,95 @@ public float BlurRadius public L.Color Color { get; - set; + init; } /// /// The position offset value (x, y) from the top left corner. /// - public Vector2 Offset + public float OffsetX { get; - set; + init; + } + + /// + /// The position offset value (x, y) from the top left corner. + /// + public float OffsetY + { + get; + init; + } + + /// + /// 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 extra size are 5 and -5 respectively, + /// the output shadow will have size (105, 95). + ///
+ public float ExtraWidth + { + get; + init; } /// /// 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), + /// For example, when View's size is (100, 100) and the Shadow's extra size are 5 and -5 respectively, /// the output shadow will have size (105, 95). ///
- public Vector2 Extents + public float ExtraHeight { get; - set; + init; } - internal readonly NUI.Shadow ToShadow() => new NUI.Shadow(BlurRadius, Color.ToReferenceType(), Offset.ToReferenceType(), Extents.ToReferenceType()); + /// + /// The Cutout policy for this shadow. + /// + /// + /// ColorVisualCutoutPolicyType.None = Fully render the shadow color (Default)
+ /// ColorVisualCutoutPolicyType.CutoutView = Do not render inside bounding box of view
+ /// ColorVisualCutoutPolicyType.CutoutViewWithCornerRadius = Do not render inside view, consider corner radius value
+ ///
+ public ColorVisualCutoutPolicyType CutoutPolicy + { + get; + init; + } + + internal readonly NUI.Shadow ToShadow() => new NUI.Shadow(BlurRadius, Color.ToReferenceType(), new (OffsetX, OffsetY), new (ExtraWidth, ExtraHeight)); + + internal readonly PropertyMap BuildMap(View attachedView) + { + using var transform = new PropertyMap() + .Append((int)VisualTransformPropertyType.Offset, new L.Vector2(OffsetX, OffsetY)) + .Append((int)VisualTransformPropertyType.OffsetPolicy, new L.Vector2((int)VisualTransformPolicyType.Absolute, (int)VisualTransformPolicyType.Absolute)) + .Append((int)VisualTransformPropertyType.ExtraSize, new L.Vector2(ExtraWidth, ExtraHeight)) + .Append((int)VisualTransformPropertyType.Origin, (int)Visual.AlignType.Center) + .Append((int)VisualTransformPropertyType.AnchorPoint, (int)Visual.AlignType.Center); + + PropertyMap map = new PropertyMap() + .Append(Visual.Property.Type, (int)Visual.Type.Color) + .Append(ColorVisualProperty.MixColor, Color) + .Append(ColorVisualProperty.BlurRadius, BlurRadius < 0 ? 0 : BlurRadius) + .Append(ColorVisualProperty.CutoutPolicy, (int)CutoutPolicy) + .Append(Visual.Property.Transform, transform); + + if (attachedView.CornerRadius != null || attachedView.CornerRadius != Vector4.Zero) + { + map.Append(Visual.Property.CornerRadius, attachedView.CornerRadius); + map.Append(Visual.Property.CornerRadiusPolicy, (int)attachedView.CornerRadiusPolicy); + } + + if (attachedView.CornerSquareness != null || attachedView.CornerSquareness != Vector4.Zero) + { + map.Append(Visual.Property.CornerSquareness, attachedView.CornerSquareness); + } + + return map; + } } } diff --git a/src/Tizen.NUI/src/devel/Lite/L.Vector2.cs b/src/Tizen.NUI/src/devel/Lite/L.Vector2.cs index f9aba5567c1..0d4ac7c96de 100644 --- a/src/Tizen.NUI/src/devel/Lite/L.Vector2.cs +++ b/src/Tizen.NUI/src/devel/Lite/L.Vector2.cs @@ -24,7 +24,10 @@ namespace Tizen.NUI.L [EditorBrowsable(EditorBrowsableState.Never)] public readonly struct Vector2 { - public static readonly Vector2 Zero = new Vector2(0.0f, 0.0f); + /// + /// The zero vector2. + /// + public static readonly Vector2 Zero = new (0.0f, 0.0f); /// /// Initializes a new instance of the struct. @@ -53,6 +56,8 @@ public float Y get; } + public readonly bool IsZero => X == 0 && Y == 0; + /// /// Gets the width component of the vector2. /// diff --git a/src/Tizen.NUI/src/devel/Markup/ViewExtensions.cs b/src/Tizen.NUI/src/devel/Markup/ViewExtensions.cs new file mode 100644 index 00000000000..6ead5056b72 --- /dev/null +++ b/src/Tizen.NUI/src/devel/Markup/ViewExtensions.cs @@ -0,0 +1,266 @@ +/* + * 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; +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI.Markup +{ + /// + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public static class ViewExtensions + { + /// + /// Assign this view reference to the given variable. + /// + /// The type of the view. + /// The extension target. + /// The variable to save the reference to. + /// The view itself. + public static T Self(this T view, out T self) where T : View + { + self = view; + return view; + } + + /// + /// Sets the background color of the view. + /// + /// The type of the view. + /// The extension target. + /// The red component. + /// The green component. + /// The blue component. + /// The alpha component. + /// The view itself. + public static T BackgroundColor(this T view, float r, float g, float b, float a = 1f) where T : View + { + return view.BackgroundColor(new L.Color(r, g, b, a)); + } + + /// + /// Sets the background color of the view. + /// + /// The type of the view. + /// The extension target. + /// The value of 0xRRGGBB format. + /// The alpha value between 0.0 and 1.0. + /// The view itself. + public static T BackgroundColor(this T view, uint value, float alpha) where T : View + { + return view.BackgroundColor(new L.Color(value, alpha)); + } + + /// + /// Sets the background color of the view. + /// + /// The type of the view. + /// The extension target. + /// The color value. + /// The view itself. + public static T BackgroundColor(this T view, L.Color color) where T : View + { + view.SetBackgroundColor(color); + return view; + } + + /// + /// Experimental getter for background color + /// + /// The extension target. + /// The background color value. + public static L.Color BackgroundColor(this View view) + { + return Object.InternalRetrievingVisualPropertyColor(view.SwigCPtr, View.Property.BACKGROUND, ColorVisualProperty.MixColor); + } + + /// + /// Sets the size of the view. + /// + /// The type of the view. + /// The extension target. + /// The width value. + /// The height value. + /// The view itself. + public static T Size(this T view, float width, float height) where T : View + { + view.SizeWidth = width; + view.SizeHeight = height; + return view; + } + + /// + /// Sets the size width of the view. + /// + /// The type of the view. + /// The extension target. + /// The width value. + /// The view itself. + public static T SizeWidth(this T view, float width) where T : View + { + view.SizeWidth = width; + return view; + } + + /// + /// Sets the size height of the view. + /// + /// The type of the view. + /// The extension target. + /// The width value. + /// The view itself. + public static T SizeHeight(this T view, float height) where T : View + { + view.SizeHeight = height; + return view; + } + + /// + /// Sets the position of the view. + /// + /// The type of the view. + /// The extension target. + /// The x value. + /// The y value. + /// The view itself. + public static T Position(this T view, float x, float y) where T : View + { + view.PositionX = x; + view.PositionY = y; + return view; + } + + /// + /// Sets the position x of the view. + /// + /// The type of the view. + /// The extension target. + /// The x value. + /// The view itself. + public static T PositionX(this T view, float x) where T : View + { + view.PositionX = x; + return view; + } + + /// + /// Sets the position y of the view. + /// + /// The type of the view. + /// The extension target. + /// The y value. + /// The view itself. + public static T PositionY(this T view, float y) where T : View + { + view.PositionY = y; + return view; + } + + /// + /// Sets the corner radius of the view. + /// + /// The type of the view. + /// The extension target. + /// The uniform corner value. + /// Sets the corner radius policy to relative. The default is false. + /// The view itself. + public static T CornerRadius(this T view, float uniform, bool isRelative = false) where T : View + { + return view.CornerRadius(new L.Corner(uniform, uniform, uniform, uniform), isRelative); + } + + /// + /// Sets the corner radius of the view. + /// + /// The type of the view. + /// The extension target. + /// The top-left value. + /// The top-right value. + /// The bottom-right value. + /// The bottom-left value. + /// Sets the corner radius policy to relative. The default is false. + /// The view itself. + public static T CornerRadius(this T view, float topLeft, float topRight, float bottomRight, float bottomLeft, bool isRelative = false) where T : View + { + return view.CornerRadius(new L.Corner(topLeft, topRight, bottomRight, bottomLeft), isRelative); + } + + /// + /// Sets the corner radius of the view. + /// + /// The type of the view. + /// The extension target. + /// The corner value. + /// Sets the corner radius policy to relative. The default is false. + /// The view itself. + public static T CornerRadius(this T view, L.Corner corner, bool isRelative = false) where T : View + { + // TODO Do not create Vector4 here + view.CornerRadius = corner.ToReferenceType(); + view.CornerRadiusPolicy = isRelative ? VisualTransformPolicyType.Relative : VisualTransformPolicyType.Absolute; + return view; + } + + /// + /// Sets the box shadow of the view. + /// + /// The type of the view. + /// The extension target. + /// The blur radius value for the shadow. Bigger value, much blurry. + /// Optional. The x offset value from the top left corner. The default is 0. + /// Optional. The y offset value from the top left corner. The default is 0. + /// Optional. The shadow will extend its size by specified amount of length. The default is 0. + /// Optional. The shadow will extend its size by specified amount of length. The default is 0. + /// The policy of the shadow cutout. The default is . + /// The view itself. + public static T BoxShadow(this T view, float blurRadius, float offsetX = 0, float offsetY = 0, float extraWidth = 0, float extraHeight = 0, ColorVisualCutoutPolicyType cutoutPolicy = ColorVisualCutoutPolicyType.None) where T : View + { + return view.BoxShadow(new L.Shadow(blurRadius, offsetX, offsetY, extraWidth, extraHeight, cutoutPolicy)); + } + + /// + /// Sets the box shadow of the view. + /// + /// The type of the view. + /// The extension target. + /// The blur radius value for the shadow. Bigger value, much blurry. + /// The color for the shadow. + /// Optional. The x offset value from the top left corner. The default is 0. + /// Optional. The y offset value from the top left corner. The default is 0. + /// Optional. The shadow will extend its size by specified amount of length. The default is 0. + /// Optional. The shadow will extend its size by specified amount of length. The default is 0. + /// The policy of the shadow cutout. The default is . + /// The view itself. + public static T BoxShadow(this T view, float blurRadius, L.Color color, float offsetX = 0, float offsetY = 0, float extraWidth = 0, float extraHeight = 0, ColorVisualCutoutPolicyType cutoutPolicy = ColorVisualCutoutPolicyType.None) where T : View + { + return view.BoxShadow(new L.Shadow(blurRadius, color, offsetX, offsetY, extraWidth, extraHeight, cutoutPolicy)); + } + + /// + /// Sets the box shadow of the view. + /// + /// The type of the view. + /// The extension target. + /// The shadow value. + /// The view itself. + public static T BoxShadow(this T view, L.Shadow shadow) where T : View + { + view.SetBoxShadow(shadow); + return view; + } + } +} diff --git a/src/Tizen.NUI/src/internal/Common/Object.cs b/src/Tizen.NUI/src/internal/Common/Object.cs index 43528ca5afa..4d40e73fb17 100755 --- a/src/Tizen.NUI/src/internal/Common/Object.cs +++ b/src/Tizen.NUI/src/internal/Common/Object.cs @@ -16,6 +16,7 @@ */ using global::System.Runtime.InteropServices; +using Tizen.NUI.L; namespace Tizen.NUI { @@ -321,5 +322,46 @@ internal static int InternalRetrievingVisualPropertyVector4(HandleRef actor, int NDalicPINVOKE.ThrowExceptionIfExists(); return ret; } + + internal static void InternalSetPropertyColor(HandleRef actor, int propertyType, L.Color color) + { + if (actor.Handle == System.IntPtr.Zero) + { + throw new System.InvalidOperationException("Error! NUI's native dali object is already disposed. OR the native dali object handle of NUI becomes null!"); + } + + ReusablePool.GetOne((vector4, actor, propertyType, color) => + { + vector4.Reset(color); + _ = Interop.Actor.InternalSetPropertyVector4(actor, propertyType, vector4.SwigCPtr); + NDalicPINVOKE.ThrowExceptionIfExists(); + }, actor, propertyType, color); + } + + internal static L.Color InternalRetrievingVisualPropertyColor(HandleRef actor, int visualIndex, int visualPropertyIndex) + { + if (actor.Handle == System.IntPtr.Zero) + { + throw new System.InvalidOperationException("Error! NUI's native dali object is already disposed. OR the native dali object handle of NUI becomes null!"); + } + + return ReusablePool.GetOne((vector4, actor, visualIndex, visualPropertyIndex) => + { + vector4.Reset(); + _ = Interop.View.InternalRetrievingVisualPropertyVector4(actor, visualIndex, visualPropertyIndex, vector4.SwigCPtr); + NDalicPINVOKE.ThrowExceptionIfExists(); + return new L.Color(vector4); + }, actor, visualIndex, visualPropertyIndex); + } + + internal static void InternalSetPropertyMap(HandleRef actor, int propertyType, HandleRef map) + { + if (actor.Handle == System.IntPtr.Zero) + { + throw new System.InvalidOperationException("Error! NUI's native dali object is already disposed. OR the native dali object handle of NUI becomes null!"); + } + _ = Interop.Actor.InternalSetPropertyMap(actor, propertyType, map); + NDalicPINVOKE.ThrowExceptionIfExists(); + } } } diff --git a/src/Tizen.NUI/src/internal/Common/ReusablePool.cs b/src/Tizen.NUI/src/internal/Common/ReusablePool.cs new file mode 100644 index 00000000000..6d643a01e3f --- /dev/null +++ b/src/Tizen.NUI/src/internal/Common/ReusablePool.cs @@ -0,0 +1,189 @@ +/* + * 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; +using System.Collections.Generic; + +namespace Tizen.NUI +{ + /// + /// Provide methods to reuse `Disposable` primitive data such as Color and Size. + /// Please be aware that this class is not thread-safe. + /// + internal static class ReusablePool where T : Disposable, new() + { + private const int MaxPoolSize = 3; + private static readonly Stack pool = new (); + + /// + /// Get available instance from pool or create new one. + /// The passed instance only valid in action scope. + /// + public static void GetOne(Action action) + { + if (!pool.TryPop(out T value)) + { + value = new T(); + } + action(value); + Push(value); + } + + /// + /// Get available instance from pool or create new one. + /// The passed instance only valid in action scope. + /// + /// + /// This method is to avoid generating closure and action instance every time when using lambda expression. + /// It's better to use this method when possible. + /// + public static void GetOne(Action action, TArg arg) + { + if (!pool.TryPop(out T value)) + { + value = new T(); + } + action(value, arg); + Push(value); + } + + /// + /// Get available instance from pool or create new one. + /// The passed instance only valid in action scope. + /// + /// + /// This method is to avoid generating closure and action instance every time when using lambda expression. + /// It's better to use this method when possible. + /// + public static void GetOne(Action action, TArg1 arg1, TArg2 arg2) + { + if (!pool.TryPop(out T value)) + { + value = new T(); + } + action(value, arg1, arg2); + Push(value); + } + + /// + /// Get available instance from pool or create new one. + /// The passed instance only valid in action scope. + /// + /// + /// This method is to avoid generating closure and action instance every time when using lambda expression. + /// It's better to use this method when possible. + /// + public static void GetOne(Action action, TArg1 arg1, TArg2 arg2, TArg3 arg3) + { + if (!pool.TryPop(out T value)) + { + value = new T(); + } + action(value, arg1, arg2, arg3); + Push(value); + } + + /// + /// Get available instance from pool or create new one. + /// The passed instance only valid in action scope. + /// + public static R GetOne(Func action) + { + if (!pool.TryPop(out T value)) + { + value = new T(); + } + R result = action(value); + Push(value); + return result; + } + + /// + /// Get available instance from pool or create new one. + /// The passed instance only valid in action scope. + /// + /// + /// This method is to avoid generating closure and action instance every time when using lambda expression. + /// It's better to use this method when possible. + /// + public static R GetOne(Func action, TArg arg) + { + if (!pool.TryPop(out T value)) + { + value = new T(); + } + R result = action(value, arg); + Push(value); + return result; + } + + /// + /// Get available instance from pool or create new one. + /// The passed instance only valid in action scope. + /// + /// + /// This method is to avoid generating closure and action instance every time when using lambda expression. + /// It's better to use this method when possible. + /// + public static R GetOne(Func action, TArg1 arg1, TArg2 arg2) + { + if (!pool.TryPop(out T value)) + { + value = new T(); + } + R result = action(value, arg1, arg2); + Push(value); + return result; + } + + /// + /// Get available instance from pool or create new one. + /// The passed instance only valid in action scope. + /// + /// + /// This method is to avoid generating closure and action instance every time when using lambda expression. + /// It's better to use this method when possible. + /// + public static R GetOne(Func action, TArg1 arg1, TArg2 arg2, TArg3 arg3) + { + if (!pool.TryPop(out T value)) + { + value = new T(); + } + R result = action(value, arg1, arg2, arg3); + Push(value); + return result; + } + + static void Push(T value) + { + if (value == null || value.IsDisposeQueued) + { + return; + } + + if (pool.Count < MaxPoolSize) + { + pool.Push(value); + } + else + { + value.Dispose(); + } + } + } +} diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.Actor.cs b/src/Tizen.NUI/src/internal/Interop/Interop.Actor.cs index 0f29b9f361c..4105364122f 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.Actor.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.Actor.cs @@ -188,6 +188,9 @@ internal static partial class Actor [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Actor_InternalSetPropertyInt")] public static extern int InternalSetPropertyInt(HandleRef actor, int propertyType, int valInt); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Actor_InternalSetPropertyMap")] + public static extern int InternalSetPropertyMap(HandleRef actor, int propertyType, HandleRef valInt); } } } diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.PropertyMap.cs b/src/Tizen.NUI/src/internal/Interop/Interop.PropertyMap.cs index 9268f58a66c..7ee9ed1090e 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.PropertyMap.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.PropertyMap.cs @@ -14,6 +14,8 @@ * limitations under the License. * */ +using System; +using System.Runtime.InteropServices; namespace Tizen.NUI { @@ -89,6 +91,42 @@ internal static partial class PropertyMap [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Property_Map_SetValue_IntKey")] public static extern void SetValueIntKey(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Property_Map_Add_Int_None")] + public static extern IntPtr AddNone(HandleRef propertyMap, int key); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Property_Map_Add_Int_Bool")] + public static extern IntPtr AddBool(HandleRef propertyMap, int key, bool value); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Property_Map_Add_Int_Int")] + public static extern IntPtr AddInt(HandleRef propertyMap, int key, int value); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Property_Map_Add_Int_Float")] + public static extern IntPtr AddFloat(HandleRef propertyMap, int key, float value); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Property_Map_Add_Int_Str")] + public static extern IntPtr AddString(HandleRef propertyMap, int key, string value); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Property_Map_Add_Int_Vector2")] + public static extern IntPtr AddVector2(HandleRef propertyMap, int key, HandleRef value); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Property_Map_Add_Int_NVector2")] + public static extern IntPtr AddVector2(HandleRef propertyMap, int key, float x, float y); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Property_Map_Add_Int_Vector3")] + public static extern IntPtr AddVector3(HandleRef propertyMap, int key, HandleRef value); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Property_Map_Add_Int_Vector4")] + public static extern IntPtr AddVector4(HandleRef propertyMap, int key, HandleRef value); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Property_Map_Add_Int_NVector4")] + public static extern IntPtr AddVector4(HandleRef propertyMap, int key, float x, float y, float z, float w); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Property_Map_Add_Int_Rectangle")] + public static extern IntPtr AddRectangle(HandleRef propertyMap, int key, HandleRef value); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Property_Map_Add_Int_Map")] + public static extern IntPtr AddPropertyMap(HandleRef propertyMap, int key, HandleRef value); } } } diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.Vector4.cs b/src/Tizen.NUI/src/internal/Interop/Interop.Vector4.cs index 6e2fd83abc5..44edf543ffe 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.Vector4.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.Vector4.cs @@ -14,6 +14,7 @@ * limitations under the License. * */ +using System.Runtime.InteropServices; namespace Tizen.NUI { @@ -187,6 +188,9 @@ internal static partial class Vector4 [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_Vector4")] public static extern void DeleteVector4(global::System.Runtime.InteropServices.HandleRef jarg1); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Vector4_set_all")] + public static extern void SetAll(HandleRef jarg1, float jarg2, float jarg3, float jarg4, float jarg5); } } } diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewLiteProperty.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewLiteProperty.cs new file mode 100755 index 00000000000..f85087a267b --- /dev/null +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewLiteProperty.cs @@ -0,0 +1,64 @@ +/* + * Copyright(c) 2019-2022 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. + * + */ + +namespace Tizen.NUI.BaseComponents +{ + public partial class View + { + /// NOTE This can replace SetBackgroundColor(NUI.Color) after sufficient verification + internal void SetBackgroundColor(L.Color color) + { + themeData?.selectorData?.ClearBackground(this); + + // Background property will be Color after now. Remove background image url information. + backgroundImageUrl = null; + + if (backgroundExtraData == null) + { + Object.InternalSetPropertyColor(SwigCPtr, Property.BACKGROUND, color); + } + else + { + using var map = new PropertyMap() + .Append(Visual.Property.Type, (int)Visual.Type.Color) + .Append(ColorVisualProperty.MixColor, color) + .Append(Visual.Property.CornerRadius, backgroundExtraData.CornerRadius) + .Append(Visual.Property.CornerSquareness, backgroundExtraData.CornerSquareness) + .Append(Visual.Property.CornerRadiusPolicy, (int)backgroundExtraData.CornerRadiusPolicy) + .Append(Visual.Property.BorderlineWidth, backgroundExtraData.BorderlineWidth) + .Append(Visual.Property.BorderlineColor, backgroundExtraData.BorderlineColor ?? Color.Black) + .Append(Visual.Property.BorderlineOffset, backgroundExtraData.BorderlineOffset); + + backgroundExtraDataUpdatedFlag &= ~BackgroundExtraDataUpdatedFlag.Background; + + Object.InternalSetPropertyMap(SwigCPtr, Property.BACKGROUND, map.SwigCPtr); + } + } + + /// NOTE This can replace SetInternalBoxShadowProperty() after sufficient verification + internal void SetBoxShadow(L.Shadow shadow) + { + themeData?.selectorData?.ClearShadow(this); + + backgroundExtraDataUpdatedFlag &= ~BackgroundExtraDataUpdatedFlag.Shadow; + + using var map = shadow.BuildMap(this); + + Object.InternalSetPropertyMap(SwigCPtr, Property.SHADOW, map.SwigCPtr); + } + } +} diff --git a/src/Tizen.NUI/src/public/Common/PropertyMap.cs b/src/Tizen.NUI/src/public/Common/PropertyMap.cs index bd96e0ddd7f..e18a864b776 100755 --- a/src/Tizen.NUI/src/public/Common/PropertyMap.cs +++ b/src/Tizen.NUI/src/public/Common/PropertyMap.cs @@ -247,6 +247,192 @@ public PropertyMap Add(KeyValue keyValue) return this; } + /// + /// Append the key-value pair to the map. + /// Does not check for duplicates. + /// + /// The key to insert. + /// The value to insert. + /// Returns a reference to this object. + [EditorBrowsable(EditorBrowsableState.Never)] + public PropertyMap Append(int key, bool value) + { + Interop.PropertyMap.AddBool(SwigCPtr, key, value); + NDalicPINVOKE.ThrowExceptionIfExists(); + return this; + } + + /// + /// Append the key-value pair to the map. + /// Does not check for duplicates. + /// + /// The key to insert. + /// The value to insert. + /// Returns a reference to this object. + [EditorBrowsable(EditorBrowsableState.Never)] + public PropertyMap Append(int key, int value) + { + Interop.PropertyMap.AddInt(SwigCPtr, key, value); + NDalicPINVOKE.ThrowExceptionIfExists(); + return this; + } + + /// + /// Append the key-value pair to the map. + /// Does not check for duplicates. + /// + /// The key to insert. + /// The value to insert. + /// Returns a reference to this object. + [EditorBrowsable(EditorBrowsableState.Never)] + public PropertyMap Append(int key, float value) + { + Interop.PropertyMap.AddFloat(SwigCPtr, key, value); + NDalicPINVOKE.ThrowExceptionIfExists(); + return this; + } + + /// + /// Append the key-value pair to the map. + /// Does not check for duplicates. + /// + /// The key to insert. + /// The value to insert. + /// Returns a reference to this object. + [EditorBrowsable(EditorBrowsableState.Never)] + public PropertyMap Append(int key, string value) + { + if (AppendNoneIfNull(key, value)) + { + return this; + } + Interop.PropertyMap.AddString(SwigCPtr, key, value); + NDalicPINVOKE.ThrowExceptionIfExists(); + return this; + } + + /// + /// Append the key-value pair to the map. + /// Does not check for duplicates. + /// + /// The key to insert. + /// The value to insert. + /// Returns a reference to this object. + [EditorBrowsable(EditorBrowsableState.Never)] + public PropertyMap Append(int key, Vector2 value) + { + if (AppendNoneIfNull(key, value)) + { + return this; + } + Interop.PropertyMap.AddVector2(SwigCPtr, key, getCPtr(value)); + NDalicPINVOKE.ThrowExceptionIfExists(); + return this; + } + + /// + /// Append the key-value pair to the map. + /// Does not check for duplicates. + /// + /// The key to insert. + /// The value to insert. + /// Returns a reference to this object. + [EditorBrowsable(EditorBrowsableState.Never)] + public PropertyMap Append(int key, L.Vector2 value) + { + Interop.PropertyMap.AddVector2(SwigCPtr, key, value.X, value.Y); + NDalicPINVOKE.ThrowExceptionIfExists(); + return this; + } + + /// + /// Append the key-value pair to the map. + /// Does not check for duplicates. + /// + /// The key to insert. + /// The value to insert. + /// Returns a reference to this object. + [EditorBrowsable(EditorBrowsableState.Never)] + public PropertyMap Append(int key, Vector3 value) + { + if (AppendNoneIfNull(key, value)) + { + return this; + } + Interop.PropertyMap.AddVector3(SwigCPtr, key, getCPtr(value)); + NDalicPINVOKE.ThrowExceptionIfExists(); + return this; + } + + /// + /// Append the key-value pair to the map. + /// Does not check for duplicates. + /// + /// The key to insert. + /// The value to insert. + /// Returns a reference to this object. + [EditorBrowsable(EditorBrowsableState.Never)] + public PropertyMap Append(int key, Vector4 value) + { + if (AppendNoneIfNull(key, value)) + { + return this; + } + Interop.PropertyMap.AddVector4(SwigCPtr, key, getCPtr(value)); + NDalicPINVOKE.ThrowExceptionIfExists(); + return this; + } + + /// + /// Append the key-value pair to the map. + /// Does not check for duplicates. + /// + /// The key to insert. + /// The value to insert. + /// Returns a reference to this object. + [EditorBrowsable(EditorBrowsableState.Never)] + public PropertyMap Append(int key, L.Color value) + { + Interop.PropertyMap.AddVector4(SwigCPtr, key, value.R, value.G, value.B, value.A); + NDalicPINVOKE.ThrowExceptionIfExists(); + return this; + } + + /// + /// Append the key-value pair to the map. + /// Does not check for duplicates. + /// + /// The key to insert. + /// The value to insert. + /// Returns a reference to this object. + [EditorBrowsable(EditorBrowsableState.Never)] + public PropertyMap Append(int key, L.Corner value) + { + Interop.PropertyMap.AddVector4(SwigCPtr, key, value.TopLeft, value.TopRight, value.BottomRight, value.BottomLeft); + NDalicPINVOKE.ThrowExceptionIfExists(); + return this; + } + + /// + /// Append the key-value pair to the map. + /// Does not check for duplicates. + /// + /// The key to insert. + /// The value to insert. + /// Returns a reference to this object. + [EditorBrowsable(EditorBrowsableState.Never)] + public PropertyMap Append(int key, PropertyMap value) + { + if (AppendNoneIfNull(key, value)) + { + return this; + } + Interop.PropertyMap.AddPropertyMap(SwigCPtr, key, getCPtr(value)); + NDalicPINVOKE.ThrowExceptionIfExists(); + return this; + } + + /// /// Removes the element by the specified key. /// @@ -443,6 +629,16 @@ protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef { Interop.PropertyMap.DeletePropertyMap(swigCPtr); } + + private bool AppendNoneIfNull(int key, object value) + { + if (value == null) + { + Interop.PropertyMap.AddNone(SwigCPtr, key); + return true; + } + return false; + } } internal static class PropertyMapSetterHelper diff --git a/src/Tizen.NUI/src/public/Common/Vector4.cs b/src/Tizen.NUI/src/public/Common/Vector4.cs index e9b78718d12..54267ebb9f6 100755 --- a/src/Tizen.NUI/src/public/Common/Vector4.cs +++ b/src/Tizen.NUI/src/public/Common/Vector4.cs @@ -141,7 +141,7 @@ internal Vector4(Vector4ChangedCallback cb, float x, float y, float z, float w) /// /// // DO NOT use like the followings! /// Vector4 vector4 = new Vector4(); - /// vector4.X = 0.1f; + /// vector4.X = 0.1f; /// // USE like this /// float x = 0.1f, y = 0.5f, z = 0.9f, w = 1.0f; /// Vector4 vector4 = new Vector4(x, y, z, w); @@ -174,7 +174,7 @@ public float X /// /// // DO NOT use like the followings! /// Vector4 vector4 = new Vector4(); - /// vector4.R = 0.1f; + /// vector4.R = 0.1f; /// // USE like this /// float r = 0.1f, g = 0.5f, b = 0.9f, a = 1.0f; /// Vector4 vector4 = new Vector4(r, g, b, a); @@ -207,7 +207,7 @@ public float R /// /// // DO NOT use like the followings! /// Vector4 vector4 = new Vector4(); - /// vector4.S = 0.1f; + /// vector4.S = 0.1f; /// // USE like this /// float s = 0.1f, t = 0.5f, p = 0.9f, q = 1.0f; /// Vector4 vector4 = new Vector4(s, t, p, q); @@ -240,7 +240,7 @@ public float S /// /// // DO NOT use like the followings! /// Vector4 vector4 = new Vector4(); - /// vector4.Y = 0.5f; + /// vector4.Y = 0.5f; /// // USE like this /// float x = 0.1f, y = 0.5f, z = 0.9f, w = 1.0f; /// Vector4 vector4 = new Vector4(x, y, z, w); @@ -273,7 +273,7 @@ public float Y /// /// // DO NOT use like the followings! /// Vector4 vector4 = new Vector4(); - /// vector4.G = 0.5f; + /// vector4.G = 0.5f; /// // USE like this /// float r = 0.1f, g = 0.5f, b = 0.9f, a = 1.0f; /// Vector4 vector4 = new Vector4(r, g, b, a); @@ -306,7 +306,7 @@ public float G /// /// // DO NOT use like the followings! /// Vector4 vector4 = new Vector4(); - /// vector4.T = 0.5f; + /// vector4.T = 0.5f; /// // USE like this /// float s = 0.1f, t = 0.5f, p = 0.9f, q = 1.0f; /// Vector4 vector4 = new Vector4(s, t, p, q); @@ -339,7 +339,7 @@ public float T /// /// // DO NOT use like the followings! /// Vector4 vector4 = new Vector4(); - /// vector4.Z = 0.9f; + /// vector4.Z = 0.9f; /// // USE like this /// float x = 0.1f, y = 0.5f, z = 0.9f, w = 1.0f; /// Vector4 vector4 = new Vector4(x, y, z, w); @@ -372,7 +372,7 @@ public float Z /// /// // DO NOT use like the followings! /// Vector4 vector4 = new Vector4(); - /// vector4.B = 0.9f; + /// vector4.B = 0.9f; /// // USE like this /// float r = 0.1f, g = 0.5f, b = 0.9f, a = 1.0f; /// Vector4 vector4 = new Vector4(r, g, b, a); @@ -405,7 +405,7 @@ public float B /// /// // DO NOT use like the followings! /// Vector4 vector4 = new Vector4(); - /// vector4.P = 0.9f; + /// vector4.P = 0.9f; /// // USE like this /// float s = 0.1f, t = 0.5f, p = 0.9f, q = 1.0f; /// Vector4 vector4 = new Vector4(s, t, p, q); @@ -438,7 +438,7 @@ public float P /// /// // DO NOT use like the followings! /// Vector4 vector4 = new Vector4(); - /// vector4.W = 1.0f; + /// vector4.W = 1.0f; /// // USE like this /// float x = 0.1f, y = 0.5f, z = 0.9f, w = 1.0f; /// Vector4 vector4 = new Vector4(x, y, z, w); @@ -471,7 +471,7 @@ public float W /// /// // DO NOT use like the followings! /// Vector4 vector4 = new Vector4(); - /// vector4.A = 1.0f; + /// vector4.A = 1.0f; /// // USE like this /// float r = 0.1f, g = 0.5f, b = 0.9f, a = 1.0f; /// Vector4 vector4 = new Vector4(r, g, b, a); @@ -504,7 +504,7 @@ public float A /// /// // DO NOT use like the followings! /// Vector4 vector4 = new Vector4(); - /// vector4.Q = 1.0f; + /// vector4.Q = 1.0f; /// // USE like this /// float s = 0.1f, t = 0.5f, p = 0.9f, q = 1.0f; /// Vector4 vector4 = new Vector4(s, t, p, q); @@ -715,6 +715,18 @@ public void Clamp(Vector4 min, Vector4 max) [EditorBrowsable(EditorBrowsableState.Never)] public object Clone() => new Vector4(X, Y, Z, W); + internal void Reset() => Reset(0, 0, 0, 0); + + internal void Reset(L.Color color) => Reset(color.R, color.G, color.B, color.A); + + internal void Reset(L.Corner corner) => Reset(corner.TopLeft, corner.TopRight, corner.BottomRight, corner.BottomLeft); + + internal void Reset(float x, float y, float z, float w) + { + Interop.Vector4.SetAll(SwigCPtr, x, y, z, w); + NDalicPINVOKE.ThrowExceptionIfExists(); + } + internal static Vector4 GetVector4FromPtr(global::System.IntPtr cPtr) { Vector4 ret = new Vector4(cPtr, false);