diff --git a/src/Tizen.NUI/src/public/Utility/GraphicsTypeExtensions.cs b/src/Tizen.NUI/src/public/Utility/GraphicsTypeExtensions.cs index c47d29e9267..69ae7032af0 100644 --- a/src/Tizen.NUI/src/public/Utility/GraphicsTypeExtensions.cs +++ b/src/Tizen.NUI/src/public/Utility/GraphicsTypeExtensions.cs @@ -15,6 +15,7 @@ * */ +using System; using System.ComponentModel; namespace Tizen.NUI @@ -43,9 +44,21 @@ public static float DpToPx(this float dp) } /// - /// Converter float sp to pixel. + /// Converter float dp to pixel. /// - /// The float sp unit value to be converted pixel unit. + /// The float dp unit value to be converted pixel unit. + /// The float pixel unit value. + /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static float Dp(this float dp) + { + return GraphicsTypeManager.Instance.Dp.ConvertToPixel(dp); + } + + /// + /// Converter float scaled dp to pixel. + /// + /// The float scaled dp unit value to be converted pixel unit. /// The float pixel unit value. /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] @@ -54,6 +67,18 @@ public static float SpToPx(this float sp) return GraphicsTypeManager.Instance.Sp.ConvertToPixel(sp); } + /// + /// Converter float scaled dp to pixel. + /// + /// The float scaled dp unit value to be converted pixel unit. + /// The float pixel unit value. + /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static float Sp(this float sp) + { + return GraphicsTypeManager.Instance.Sp.ConvertToPixel(sp); + } + /// /// Converter float pixel to dp. /// @@ -90,6 +115,18 @@ public static int DpToPx(this int dp) return (int)GraphicsTypeManager.Instance.Dp.ConvertToPixel(dp); } + /// + /// Converter int dp to pixel. + /// + /// The int dp unit value to be converted pixel unit. + /// The int pixel unit value. + /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static int Dp(this int dp) + { + return (int)GraphicsTypeManager.Instance.Dp.ConvertToPixel(dp); + } + /// /// Converter int dp to pixel. /// @@ -102,6 +139,18 @@ public static int SpToPx(this int sp) return (int)GraphicsTypeManager.Instance.Sp.ConvertToPixel(sp); } + /// + /// Converter int dp to pixel. + /// + /// The int sp unit value to be converted pixel unit. + /// The int pixel unit value. + /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static int Sp(this int sp) + { + return (int)GraphicsTypeManager.Instance.Sp.ConvertToPixel(sp); + } + /// /// Converter int pixel to dp. /// @@ -126,7 +175,6 @@ public static int PxToSp(this int pixel) return (int)GraphicsTypeManager.Instance.Sp.ConvertFromPixel(pixel); } - /// /// Converter Size pixel to dp. /// @@ -552,5 +600,30 @@ public static float PtToSp(this float pt) { return GraphicsTypeManager.Instance.Point.ConvertPointToSp(pt); } + + /// + /// Converter float pixel to scaled pixel. + /// + /// The float pixel value to be scaled. + /// The float scaled pixel unit value. + /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static float Scale(this float px) + { + return px * GraphicsTypeManager.Instance.ScalingFactor; + } + + /// + /// Converter int pixel to scaled pixel. + /// + /// The int pixel value to be scaled. + /// The int scaled pixel unit value. + /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static int Scale(this int px) + { + return (int)(px * GraphicsTypeManager.Instance.ScalingFactor); + } + } } diff --git a/src/Tizen.NUI/src/public/Utility/SpTypeConverter.cs b/src/Tizen.NUI/src/public/Utility/SpTypeConverter.cs index d815fa2e0b7..097309bf382 100755 --- a/src/Tizen.NUI/src/public/Utility/SpTypeConverter.cs +++ b/src/Tizen.NUI/src/public/Utility/SpTypeConverter.cs @@ -83,7 +83,7 @@ public override float ConvertScriptToPixel(string scriptValue) [EditorBrowsable(EditorBrowsableState.Never)] public override float ConvertToPixel(float value) { - return value * (GraphicsTypeManager.Instance.ScaledDpi / (float)GraphicsTypeManager.Instance.BaselineDpi); + return value * ((float)(GraphicsTypeManager.Instance.Dpi * GraphicsTypeManager.Instance.ScalingFactor) / GraphicsTypeManager.Instance.BaselineDpi); } /// @@ -94,7 +94,7 @@ public override float ConvertToPixel(float value) [EditorBrowsable(EditorBrowsableState.Never)] public override float ConvertFromPixel(float value) { - return value * (GraphicsTypeManager.Instance.BaselineDpi / (float)GraphicsTypeManager.Instance.ScaledDpi); + return value * (GraphicsTypeManager.Instance.BaselineDpi / (float)(GraphicsTypeManager.Instance.Dpi * GraphicsTypeManager.Instance.ScalingFactor)); } } }