[NUI] Scalability : Refactoring GraphicsTypeManager and Converter, Extensions. (...
authorSangHyeon Jade Lee <sh10233.lee@samsung.com>
Thu, 16 Sep 2021 05:45:51 +0000 (22:45 -0700)
committerSangHyeon Jade Lee <dltkdgus1764@gmail.com>
Fri, 17 Sep 2021 13:10:44 +0000 (06:10 -0700)
* Refactoring GraphicsTypeManager for Scalability supports
* Add GraphicsTypeExtensions class.
* Add DpTypeConverter and PointTypeConverter.

src/Tizen.NUI/src/public/Utility/DpTypeConverter.cs [new file with mode: 0755]
src/Tizen.NUI/src/public/Utility/GraphicsTypeConverter.cs
src/Tizen.NUI/src/public/Utility/GraphicsTypeExtensions.cs [new file with mode: 0644]
src/Tizen.NUI/src/public/Utility/GraphicsTypeManager.cs
src/Tizen.NUI/src/public/Utility/PointTypeConverter.cs [new file with mode: 0755]
test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/GraphicsTypeTest.cs [new file with mode: 0755]

diff --git a/src/Tizen.NUI/src/public/Utility/DpTypeConverter.cs b/src/Tizen.NUI/src/public/Utility/DpTypeConverter.cs
new file mode 100755 (executable)
index 0000000..d59eeef
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ * Copyright(c) 2021 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 System.Globalization;
+
+namespace Tizen.NUI
+{
+    /// <summary>
+    /// Default DpTypeConverter class to convert dp types.
+    /// </summary>
+    /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public sealed class DpTypeConverter : GraphicsTypeConverter
+    {
+        private volatile static DpTypeConverter dpTypeConverter;
+
+        /// <summary>
+        /// An unique Singleton Instance of DpTypeConverter
+        /// </summary>
+        /// <value>Singleton instance of DpTypeConverter</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 DpTypeConverter Instance
+        {
+            get
+            {
+                if (dpTypeConverter == null)
+                {
+                    dpTypeConverter = new DpTypeConverter();
+                }
+
+                return dpTypeConverter;
+            }
+        }
+
+        /// <summary>
+        /// Converts script to px
+        /// </summary>
+        /// <returns>Pixel value that is converted from input string</returns>
+        /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public override float ConvertScriptToPixel(string scriptValue)
+        {
+            float convertedValue = 0;
+            if (scriptValue != null)
+            {
+                if (scriptValue.EndsWith("dp"))
+                {
+                    convertedValue = ConvertToPixel(float.Parse(scriptValue.Substring(0, scriptValue.LastIndexOf("dp")), CultureInfo.InvariantCulture));
+                }
+                else if (scriptValue.EndsWith("px"))
+                {
+                    convertedValue = float.Parse(scriptValue.Substring(0, scriptValue.LastIndexOf("px")), CultureInfo.InvariantCulture);
+                }
+                else
+                {
+                    if (!float.TryParse(scriptValue, NumberStyles.Any, CultureInfo.InvariantCulture, out convertedValue))
+                    {
+                        NUILog.Error("Cannot convert the script {scriptValue}\n");
+                        convertedValue = 0;
+                    }
+                }
+            }
+            return convertedValue;
+        }
+
+        /// <summary>
+        /// Converts dp type to px
+        /// </summary>
+        /// <returns>Pixel value that is converted by the the display matric</returns>
+        /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public override float ConvertToPixel(float value)
+        {
+            return value * (GraphicsTypeManager.Instance.ScaledDpi / (float)GraphicsTypeManager.Instance.BaselineDpi);
+        }
+
+        /// <summary>
+        /// Converts px to dp type
+        /// </summary>
+        /// <returns>An converted value from pixel</returns>
+        /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public override float ConvertFromPixel(float value)
+        {
+            return value * (GraphicsTypeManager.Instance.BaselineDpi / (float)GraphicsTypeManager.Instance.ScaledDpi);
+        }
+    }
+}
index c9a80be..9a6e07e 100755 (executable)
@@ -25,11 +25,8 @@ namespace Tizen.NUI
     /// </summary>
     /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
     [EditorBrowsable(EditorBrowsableState.Never)]
-    public class GraphicsTypeConverter
+    public abstract class GraphicsTypeConverter
     {
-
-        private const float defaultDpi = 160.0f;
-
         /// <summary>
         /// Converts script to px
         /// </summary>
@@ -41,21 +38,10 @@ namespace Tizen.NUI
             float convertedValue = 0;
             if (scriptValue != null)
             {
-                if (scriptValue.EndsWith("dp"))
-                {
-                    convertedValue = ConvertToPixel(float.Parse(scriptValue.Substring(0, scriptValue.LastIndexOf("dp")), CultureInfo.InvariantCulture));
-                }
-                else if (scriptValue.EndsWith("px"))
-                {
-                    convertedValue = float.Parse(scriptValue.Substring(0, scriptValue.LastIndexOf("px")), CultureInfo.InvariantCulture);
-                }
-                else
+                if (!float.TryParse(scriptValue, NumberStyles.Any, CultureInfo.InvariantCulture, out convertedValue))
                 {
-                    if (!float.TryParse(scriptValue, NumberStyles.Any, CultureInfo.InvariantCulture, out convertedValue))
-                    {
-                        NUILog.Error("Cannot convert the script {scriptValue}\n");
-                        convertedValue = 0;
-                    }
+                    NUILog.Error("Cannot convert the script {scriptValue}\n");
+                    convertedValue = 0;
                 }
             }
             return convertedValue;
@@ -69,7 +55,7 @@ namespace Tizen.NUI
         [EditorBrowsable(EditorBrowsableState.Never)]
         public virtual float ConvertToPixel(float value)
         {
-            return value * (NUIApplication.GetDefaultWindow().Dpi.X / defaultDpi);
+            return value;
         }
 
         /// <summary>
@@ -80,7 +66,7 @@ namespace Tizen.NUI
         [EditorBrowsable(EditorBrowsableState.Never)]
         public virtual float ConvertFromPixel(float value)
         {
-            return value * (defaultDpi / NUIApplication.GetDefaultWindow().Dpi.X);
+            return value;
         }
     }
 }
diff --git a/src/Tizen.NUI/src/public/Utility/GraphicsTypeExtensions.cs b/src/Tizen.NUI/src/public/Utility/GraphicsTypeExtensions.cs
new file mode 100644 (file)
index 0000000..a80ebd1
--- /dev/null
@@ -0,0 +1,308 @@
+using System.ComponentModel;
+
+namespace Tizen.NUI
+{
+    /// <summary>
+    /// The GraphicTypeExtensions class is graphics type coverter for pixel based object.
+    /// Density independent pixel(dp) unit is our basic target type and you can get converted value by ToDp(),
+    /// and you can get original pixel by ToDp().
+    /// One dp is a virtual pixel unit that's roughly equal to one pixel on a medium-density(160dpi) screen.
+    /// See <see cref="Tizen.NUI.GraphicsTypeManager" /> and <see cref="Tizen.NUI.GraphicsTypeConverter" /> also.
+    /// </summary>
+    /// 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 class GraphicsTypeExtensions
+    {
+        /// <summary>
+        /// Converter float pixel to dp.
+        /// 100.0f.ToDp() = 50.0f in 320dpi display.
+        /// </summary>
+        /// <param name="pixel">The float pixel unit value to be converted dp unit.</param>
+        /// <returns>The float dp unit value.</returns>
+        /// 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 ToDp(this float pixel)
+        {
+            return GraphicsTypeManager.Instance.ConvertFromPixel(pixel);
+        }
+
+        /// <summary>
+        /// Converter float dp to pixel.
+        /// 100.0f.ToPixel() = 200.0f in 320dpi display.
+        /// </summary>
+        /// <param name="dp">The float dp unit value to be converted pixel unit.</param>
+        /// <returns>The float pixel unit value.</returns>
+        /// 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 ToPixel(this float dp)
+        {
+            return GraphicsTypeManager.Instance.ConvertToPixel(dp);
+        }
+
+        /// <summary>
+        /// Converter int pixel to dp.
+        /// 100.ToDp() = 50 in 320dpi display.
+        /// </summary>
+        /// <param name="pixel">The int pixel unit value to be converted dp unit.</param>
+        /// <returns>The int dp unit value.</returns>
+        /// 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 ToDp(this int pixel)
+        {
+            return (int)GraphicsTypeManager.Instance.ConvertFromPixel(pixel);
+        }
+
+        /// <summary>
+        /// Converter int dp to pixel.
+        /// 100.ToPixel() = 200 in 320dpi display.
+        /// </summary>
+        /// <param name="dp">The int dp unit value to be converted pixel unit.</param>
+        /// <returns>The int pixel unit value.</returns>
+        /// 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 ToPixel(this int dp)
+        {
+            return (int)GraphicsTypeManager.Instance.ConvertToPixel(dp);
+        }
+
+        /// <summary>
+        /// Converter Size pixel to dp.
+        /// Size(100.0f, 100.0f).ToDp() = Size(50.0f, 50.0f) in 320dpi display.
+        /// </summary>
+        /// <param name="pixel">The Size pixel unit value to be converted dp unit.</param>
+        /// <returns>The Size dp unit value.</returns>
+        /// 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 Size ToDp(this Size pixel)
+        {
+            if (pixel == null) return null;
+            return new Size(GraphicsTypeManager.Instance.ConvertFromPixel(pixel.Width),
+                            GraphicsTypeManager.Instance.ConvertFromPixel(pixel.Height));
+        }
+
+        /// <summary>
+        /// Converter Size dp to pixel.
+        /// Size(100.0f, 100.0f).ToPixel() = Size(200.0f, 200.0f) in 320dpi display.
+        /// </summary>
+        /// <param name="dp">The Size dp unit value to be converted pixel unit.</param>
+        /// <returns>The Size pixel unit value.</returns>
+        /// 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 Size ToPixel(this Size dp)
+        {
+            if (dp == null) return null;
+            return new Size(GraphicsTypeManager.Instance.ConvertToPixel(dp.Width),
+                            GraphicsTypeManager.Instance.ConvertToPixel(dp.Height));
+        }
+
+        /// <summary>
+        /// Converter Size2D pixel to dp.
+        /// Size2D(100, 100).ToDp() = Size2D(50, 50) in 320dpi display.
+        /// </summary>
+        /// <param name="pixel">The Size2D pixel unit value to be converted dp unit.</param>
+        /// <returns>The Size2D dp unit value.</returns>
+        /// 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 Size2D ToDp(this Size2D pixel)
+        {
+            if (pixel == null) return null;
+            return new Size2D((int)GraphicsTypeManager.Instance.ConvertFromPixel(pixel.Width),
+                              (int)GraphicsTypeManager.Instance.ConvertFromPixel(pixel.Height));
+        }
+
+        /// <summary>
+        /// Converter Size2D dp to pixel.
+        /// Size2D(100, 100).ToPixel() = Size(200, 200) in 320dpi display.
+        /// </summary>
+        /// <param name="dp">The Size2D dp unit value to be converted pixel unit.</param>
+        /// <returns>The Size2D pixel unit value.</returns>
+        /// 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 Size2D ToPixel(this Size2D dp)
+        {
+            if (dp == null) return null;
+            return new Size2D((int)GraphicsTypeManager.Instance.ConvertToPixel(dp.Width),
+                              (int)GraphicsTypeManager.Instance.ConvertToPixel(dp.Height));
+        }
+
+        /// <summary>
+        /// Converter Position pixel to dp.
+        /// Position(100.0f, 100.0f).ToDp() = Position(50.0f, 50.0f) in 320dpi display.
+        /// </summary>
+        /// <param name="pixel">The Position pixel unit value to be converted dp unit.</param>
+        /// <returns>The Position dp unit value.</returns>
+        /// 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 Position ToDp(this Position pixel)
+        {
+            if (pixel == null) return null;
+            return new Position(GraphicsTypeManager.Instance.ConvertFromPixel(pixel.X),
+                                GraphicsTypeManager.Instance.ConvertFromPixel(pixel.Y));
+        }
+
+        /// <summary>
+        /// Converter Position dp to pixel.
+        /// Position(100.0f, 100.0f).ToPixel() = Position(200.0f, 200.0f) in 320dpi display.
+        /// </summary>
+        /// <param name="dp">The Position dp unit value to be converted pixel unit.</param>
+        /// <returns>The Position pixel unit value.</returns>
+        /// 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 Position ToPixel(this Position dp)
+        {
+            if (dp == null) return null;
+            return new Position(GraphicsTypeManager.Instance.ConvertToPixel(dp.X),
+                                GraphicsTypeManager.Instance.ConvertToPixel(dp.Y));
+        }
+
+        /// <summary>
+        /// Converter Position2D pixel to dp.
+        /// Position2D(100.0f, 100.0f).ToDp() = Position2D(50.0f, 50.0f) in 320dpi display.
+        /// </summary>
+        /// <param name="pixel">The Position2D pixel unit value to be converted dp unit.</param>
+        /// <returns>The Position2D dp unit value.</returns>
+        /// 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 Position2D ToDp(this Position2D pixel)
+        {
+            if (pixel == null) return null;
+            return new Position2D((int)GraphicsTypeManager.Instance.ConvertFromPixel(pixel.X),
+                                  (int)GraphicsTypeManager.Instance.ConvertFromPixel(pixel.Y));
+        }
+
+        /// <summary>
+        /// Converter Position2D dp to pixel.
+        /// Position2D(100, 100).ToPixel() = Position2D(200, 200) in 320dpi display.
+        /// </summary>
+        /// <param name="dp">The Position2D dp unit value to be converted pixel unit.</param>
+        /// <returns>The Position2D pixel unit value.</returns>
+        /// 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 Position2D ToPixel(this Position2D dp)
+        {
+            if (dp == null) return null;
+            return new Position2D((int)GraphicsTypeManager.Instance.ConvertToPixel(dp.X),
+                                  (int)GraphicsTypeManager.Instance.ConvertToPixel(dp.Y));
+        }
+
+        /// <summary>
+        /// Converter Rectangle pixel to dp.
+        /// Rectangle(100, 100, 100, 100).ToDp() = Rectangle(50, 50, 50, 50) in 320dpi display.
+        /// </summary>
+        /// <param name="pixel">The Rectangle pixel unit value to be converted dp unit.</param>
+        /// <returns>The Rectangle dp unit value.</returns>
+        /// 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 Rectangle ToDp(this Rectangle pixel)
+        {
+            if (pixel == null) return null;
+            return new Rectangle((int)GraphicsTypeManager.Instance.ConvertFromPixel(pixel.X),
+                                 (int)GraphicsTypeManager.Instance.ConvertFromPixel(pixel.Y),
+                                 (int)GraphicsTypeManager.Instance.ConvertFromPixel(pixel.Width),
+                                 (int)GraphicsTypeManager.Instance.ConvertFromPixel(pixel.Height));
+        }
+
+        /// <summary>
+        /// Converter Rectangle dp to pixel.
+        /// Rectangle(100, 100, 100, 100).ToPixel() = Rectangle(200, 200, 200, 200) in 320dpi display.
+        /// </summary>
+        /// <param name="dp">The Rectangle dp unit value to be converted pixel unit.</param>
+        /// <returns>The Rectangle pixel unit value.</returns>
+        /// 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 Rectangle ToPixel(this Rectangle dp)
+        {
+            if (dp == null) return null;
+            return new Rectangle((int)GraphicsTypeManager.Instance.ConvertToPixel(dp.X),
+                                 (int)GraphicsTypeManager.Instance.ConvertToPixel(dp.Y),
+                                 (int)GraphicsTypeManager.Instance.ConvertToPixel(dp.Width),
+                                 (int)GraphicsTypeManager.Instance.ConvertToPixel(dp.Height));
+        }
+
+        /// <summary>
+        /// Converter Extents pixel to dp.
+        /// Extents(2, 2, 2, 2).ToDp() = Extents(1, 1, 1, 1) in 320dpi display.
+        /// </summary>
+        /// <param name="pixel">The Extents pixel unit value to be converted dp unit.</param>
+        /// <returns>The Extents dp unit value.</returns>
+        /// 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 Extents ToDp(this Extents pixel)
+        {
+            if (pixel == null) return null;
+            return new Extents((ushort)GraphicsTypeManager.Instance.ConvertFromPixel(pixel.Start),
+                               (ushort)GraphicsTypeManager.Instance.ConvertFromPixel(pixel.End),
+                               (ushort)GraphicsTypeManager.Instance.ConvertFromPixel(pixel.Top),
+                               (ushort)GraphicsTypeManager.Instance.ConvertFromPixel(pixel.Bottom));
+        }
+
+        /// <summary>
+        /// Converter Extents dp to pixel.
+        /// Extents(2, 2, 2, 2).ToPixel() = Extents(4, 4, 4, 4) in 320dpi display.
+        /// </summary>
+        /// <param name="dp">The Extents dp unit value to be converted pixel unit.</param>
+        /// <returns>The Extents pixel unit value.</returns>
+        /// 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 Extents ToPixel(this Extents dp)
+        {
+            if (dp == null) return null;
+            return new Extents((ushort)GraphicsTypeManager.Instance.ConvertToPixel(dp.Start),
+                               (ushort)GraphicsTypeManager.Instance.ConvertToPixel(dp.End),
+                               (ushort)GraphicsTypeManager.Instance.ConvertToPixel(dp.Top),
+                               (ushort)GraphicsTypeManager.Instance.ConvertToPixel(dp.Bottom));
+        }
+
+        /// <summary>
+        /// Converter float font pixel size to point size.
+        /// 100.0f.PixelToPoint() = 50.0f in 144dpi display.
+        /// </summary>
+        /// <param name="pixel">The float pixel unit value to be converted point unit.</param>
+        /// <returns>The float point unit value.</returns>
+        /// 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 PixelToPoint(this float pixel)
+        {
+            return GraphicsTypeManager.Instance.ConvertFromPixel(pixel);
+        }
+
+        /// <summary>
+        /// Converter float font point size to pixel size.
+        /// 100.0f.PointToPixel() = 200.0f in 144dpi display.
+        /// </summary>
+        /// <param name="point">The float point unit value to be converted pixel unit.</param>
+        /// <returns>The float pixel unit value.</returns>
+        /// 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 PointToPixel(this float point)
+        {
+            return PointTypeConverter.Instance.ConvertToPixel(point);
+        }
+
+        /// <summary>
+        /// Converter float font dp size to point size.
+        /// 16.0f.DpToPoint() = 7.2f.
+        /// </summary>
+        /// <param name="dp">The float dp unit value to be converted point unit.</param>
+        /// <returns>The float point unit value.</returns>
+        /// 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 DpToPoint(this float dp)
+        {
+            return PointTypeConverter.Instance.ConvertDpToPoint(dp);
+        }
+
+        /// <summary>
+        /// Converter float font point size to dp size.
+        /// 7.2f.PointToDp() = 16.0f.
+        /// </summary>
+        /// <param name="point">The float point unit value to be converted dp unit.</param>
+        /// <returns>The float dp unit value.</returns>
+        /// 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 PointToDp(this float point)
+        {
+            return PointTypeConverter.Instance.ConvertPointToDp(point);
+        }
+    }
+}
index b9ce4fb..c30b964 100755 (executable)
@@ -15,6 +15,7 @@
  *
  */
 
+using System;
 using System.ComponentModel;
 
 namespace Tizen.NUI
@@ -28,13 +29,118 @@ namespace Tizen.NUI
     {
         private volatile static GraphicsTypeManager graphicsTypeManager;
         private GraphicsTypeConverter typeConverter;
+        private float scalingFactor = 1.0f;
+        private int baselineDpi = DensityMedium;
 
         /// <summary>
-        /// Creates private GraphicsTypeManager object.
+        /// Constant of low(120) density dpi.
         /// </summary>
-        private GraphicsTypeManager()
+        /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public const ushort DensityLow = 120;
+
+        /// <summary>
+        /// Constant of medium(160) density dpi. Baseline dpi.
+        /// </summary>
+        /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public const ushort DensityMedium = 160;
+
+        /// <summary>
+        /// Constant of high(240) density dpi.
+        /// </summary>
+        /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public const ushort DensityHigh = 240;
+
+        /// <summary>
+        /// Constant of extra high(320) density dpi.
+        /// </summary>
+        /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public const ushort DensityXHigh = 320;
+
+        /// <summary>
+        /// Constant of double extra high(480) density dpi.
+        /// </summary>
+        /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public const ushort DensityXXHigh = 480;
+
+        /// <summary>
+        /// Constant of triple extra high(640) density dpi.
+        /// </summary>
+        /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public const ushort DensityXXXHigh = 640;
+
+        /// <summary>
+        /// Custom scale factor of display metrics.
+        /// ScalingFactor scale Dpi on DpiStable.
+        /// </summary>
+        /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public float ScalingFactor
+        {
+            get => scalingFactor;
+            internal set => scalingFactor = value;
+        }
+
+        /// <summary>
+        /// Dot per Inch value from system.
+        /// See Vector Dpi in <see cref="Tizen.NUI.Window" /> also.
+        /// </summary>
+        /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public int Dpi
+        {
+            get
+            {
+               Vector2 screenDpi = NUIApplication.GetDefaultWindow().Dpi;
+
+               // Currently Dpi.X and Dpi.Y is all same value from ecore_wl2_output_dpi_get
+               // Also Diagonal Dpi should be same as X, Y Dpi in normal rectangle-pixels display
+               // so for the convenience, we use Dpi.X
+               return Convert.ToInt32(Math.Round(screenDpi.X));
+            }
+        }
+
+        /// <summary>
+        /// Dpi for GraphicsTypeManager.
+        /// Dpi is scaled from Dpi with custom ScalingFactor.
+        /// </summary>
+        /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public int ScaledDpi
+        {
+            get
+            {
+                return Convert.ToInt32(Math.Round(Dpi * ScalingFactor));
+            }
+        }
+
+        /// <summary>
+        /// Default baseline dpi. Medium(160) density dpi is origianlly provided.
+        /// </summary>
+        /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public int BaselineDpi
+        {
+            get => baselineDpi;
+            internal set
+            {
+                baselineDpi = value;
+            }
+        }
+
+        /// <summary>
+        /// Density of display.
+        /// </summary>
+        /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public float Density
         {
-            typeConverter = new GraphicsTypeConverter();
+            get => ((float)ScaledDpi / (float)BaselineDpi);
         }
 
         /// <summary>
@@ -54,17 +160,36 @@ namespace Tizen.NUI
 
                 return graphicsTypeManager;
             }
+        }
 
+        /// <summary>
+        /// GraphicsTypeConverter that manager internally use for type converting.
+        /// Default TypeConverter is DpTypeConverter.
+        /// See <see cref="Tizen.NUI.GraphicsTypeConverter" /> and <see cref="Tizen.NUI.DpTypeConverter" />.
+        /// </summary>
+        /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public GraphicsTypeConverter TypeConverter
+        {
+            get
+            {
+                return typeConverter;
+            }
+            set
+            {
+                typeConverter = value;
+            }
         }
 
         /// <summary>
-        /// Sets the custom GraphicsTypeConverter.
+        /// Creates private GraphicsTypeManager object.
         /// </summary>
         /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public void SetTypeConverter(GraphicsTypeConverter typeConverter)
+        private GraphicsTypeManager()
         {
-            this.typeConverter = typeConverter;
+            // Get default type converter
+            typeConverter = DpTypeConverter.Instance;
         }
 
         /// <summary>
diff --git a/src/Tizen.NUI/src/public/Utility/PointTypeConverter.cs b/src/Tizen.NUI/src/public/Utility/PointTypeConverter.cs
new file mode 100755 (executable)
index 0000000..d746596
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+ * Copyright(c) 2021 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 System.Globalization;
+
+namespace Tizen.NUI
+{
+    /// <summary>
+    /// Default PointTypeConverter class to convert point types.
+    /// </summary>
+    /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public sealed class PointTypeConverter : GraphicsTypeConverter
+    {
+        private volatile static PointTypeConverter ptTypeConverter;
+        private const ushort pointDpi = 72;
+
+        /// <summary>
+        /// An unique Singleton Instance of PointTypeConverter
+        /// </summary>
+        /// <value>Singleton instance of PointTypeConverter</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 PointTypeConverter Instance
+        {
+            get
+            {
+                if (ptTypeConverter == null)
+                {
+                    ptTypeConverter = new PointTypeConverter();
+                }
+
+                return ptTypeConverter;
+            }
+        }
+
+        /// <summary>
+        /// Converts script to pixel
+        /// </summary>
+        /// <returns>Pixel value that is converted from input string</returns>
+        /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public override float ConvertScriptToPixel(string scriptValue)
+        {
+            float convertedValue = 0;
+            if (scriptValue != null)
+            {
+                if (scriptValue.EndsWith("pt"))
+                {
+                    convertedValue = ConvertToPixel(float.Parse(scriptValue.Substring(0, scriptValue.LastIndexOf("pt")), CultureInfo.InvariantCulture));
+                }
+                else if (scriptValue.EndsWith("px"))
+                {
+                    convertedValue = float.Parse(scriptValue.Substring(0, scriptValue.LastIndexOf("px")), CultureInfo.InvariantCulture);
+                }
+                else
+                {
+                    if (!float.TryParse(scriptValue, NumberStyles.Any, CultureInfo.InvariantCulture, out convertedValue))
+                    {
+                        NUILog.Error("Cannot convert the script {scriptValue}\n");
+                        convertedValue = 0;
+                    }
+                }
+            }
+            return convertedValue;
+        }
+
+        /// <summary>
+        /// Converts point type to pixel.
+        /// </summary>
+        /// <returns>Pixel value that is converted by the the display matric</returns>
+        /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public override float ConvertToPixel(float value)
+        {
+            return value * (GraphicsTypeManager.Instance.ScaledDpi / (float)pointDpi);
+        }
+
+        /// <summary>
+        /// Converts pixel to point type
+        /// </summary>
+        /// <returns>An converted value from pixel</returns>
+        /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public override float ConvertFromPixel(float value)
+        {
+            return value * ((float)pointDpi / (float)GraphicsTypeManager.Instance.ScaledDpi);
+        }
+
+        /// <summary>
+        /// Converts point type to pixel.
+        /// </summary>
+        /// <returns>Pixel value that is converted by the the display matric</returns>
+        /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public float ConvertDpToPoint(float value)
+        {
+            return value * ((float)pointDpi / (float)GraphicsTypeManager.Instance.BaselineDpi);
+        }
+
+        /// <summary>
+        /// Converts pixel to point type
+        /// </summary>
+        /// <returns>An converted value from pixel</returns>
+        /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public float ConvertPointToDp(float value)
+        {
+            return value * ((float)GraphicsTypeManager.Instance.BaselineDpi / (float)pointDpi);
+        }
+    }
+}
diff --git a/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/GraphicsTypeTest.cs b/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/GraphicsTypeTest.cs
new file mode 100755 (executable)
index 0000000..aa014a3
--- /dev/null
@@ -0,0 +1,148 @@
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+
+namespace Tizen.NUI.Samples
+{
+    public class GraphicsTypeTest : IExample
+    {
+        private int oldPageCount = 0;
+
+        private Window window;
+        private View rootView;
+
+        public void Activate()
+        {
+            window = NUIApplication.GetDefaultWindow();
+
+            rootView = new View()
+            {
+                WidthSpecification = LayoutParamPolicies.MatchParent,
+                HeightSpecification = LayoutParamPolicies.MatchParent,
+                Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Vertical}
+            };
+
+            /* GraphicsTypeManager test. */
+            var baseDpiText = new TextLabel();
+            baseDpiText.Text = $"Baseline Dpi : {GraphicsTypeManager.Instance.BaselineDpi}";
+            rootView.Add(baseDpiText);
+
+            var densityText = new TextLabel();
+            densityText.Text = $"Density : {GraphicsTypeManager.Instance.Density}";
+            rootView.Add(densityText);
+
+            var dpiText = new TextLabel();
+            dpiText.Text = $"Dpi : {GraphicsTypeManager.Instance.Dpi}";
+            rootView.Add(dpiText);
+
+            var scalingFactorText = new TextLabel();
+            scalingFactorText.Text = $"ScalingFactor : {GraphicsTypeManager.Instance.ScalingFactor}";
+            rootView.Add(scalingFactorText);
+
+            var scaledDpiText = new TextLabel();
+            scaledDpiText.Text = $"Scaled Dpi : {GraphicsTypeManager.Instance.ScaledDpi}";
+            rootView.Add(scaledDpiText);
+
+            var defConvertText = new TextLabel();
+            defConvertText.Text = $"DefaultTypeConverter : {GraphicsTypeManager.Instance.TypeConverter}";
+            rootView.Add(defConvertText);
+
+            /* GraphicsTypeConverter test. */
+            var dpConvertText = new TextLabel();
+            var dp = 100.0f;
+            dpConvertText.Text = $"dp : {dp}, pixel : {DpTypeConverter.Instance.ConvertToPixel(dp)}";
+            rootView.Add(dpConvertText);
+
+            var pxConvertText = new TextLabel();
+            var px = 100.0f;
+            pxConvertText.Text = $"pixel : {px}, dp : {DpTypeConverter.Instance.ConvertToPixel(px)}";
+            rootView.Add(pxConvertText);
+
+            /* GraphicsTypeExtension test. */
+            var dpToPixelText = new TextLabel();
+            dpToPixelText.Text = $"dp : {100.01f}, pixel : {100.01f.ToPixel()}";
+            rootView.Add(dpToPixelText);
+
+            var pixelToDpText = new TextLabel();
+            pixelToDpText.Text = $"pixel : {60.01f}, dp : {60.01f.ToDp()}";
+            rootView.Add(pixelToDpText);
+
+            var dpToPixel2Text = new TextLabel();
+            dpToPixel2Text.Text = $"dp : {100}, pixel : {100.ToPixel()}";
+            rootView.Add(dpToPixel2Text);
+
+            var pixelToDp2Text = new TextLabel();
+            pixelToDp2Text.Text = $"pixel : {60}, dp : {60.ToDp()}";
+            rootView.Add(pixelToDp2Text);
+
+            var dpToPixelSizeText = new TextLabel();
+            var dpSize = new Size(100.0f, 100.0f);
+            var pixelSize = dpSize.ToPixel();
+            dpToPixelSizeText.Text = $"dp : ({dpSize.Width}, {dpSize.Height}), pixel : ({pixelSize.Width}, {pixelSize.Height})";
+            rootView.Add(dpToPixelSizeText);
+
+            var pixelToDpSizeText = new TextLabel();
+            pixelSize = new Size(100.0f, 100.0f);
+            dpSize = pixelSize.ToDp();
+            pixelToDpSizeText.Text = $"pixel : ({pixelSize.Width}, {pixelSize.Height}), dp : ({dpSize.Width}, {dpSize.Height})";
+            rootView.Add(pixelToDpSizeText);
+
+            var dpToPixelPosText = new TextLabel();
+            var dpPos = new Position(100.0f, 100.0f);
+            var pixelPos = dpPos.ToPixel();
+            dpToPixelPosText.Text = $"dp : ({dpPos.X}, {dpPos.Y}), pixel : ({pixelPos.X}, {pixelPos.Y})";
+            rootView.Add(dpToPixelPosText);
+
+            var pixelToDpPosText = new TextLabel();
+            pixelPos = new Position(100.0f, 100.0f);
+            dpPos = pixelPos.ToDp();
+            pixelToDpPosText.Text = $"pixel : ({pixelPos.X}, {pixelPos.Y}), dp : ({dpPos.X}, {dpPos.Y})";
+            rootView.Add(pixelToDpPosText);
+
+            var dpToPixelRectText = new TextLabel();
+            var dpRect = new Rectangle(100, 100, 100, 100);
+            var pixelRect = dpRect.ToPixel();
+            dpToPixelRectText.Text = $"dp : ({dpRect.X}, {dpRect.Y}, {dpRect.Width}, {dpRect.Height}), pixel : ({pixelRect.X}, {pixelRect.Y}, {pixelRect.Width}, {pixelRect.Height})";
+            rootView.Add(dpToPixelRectText);
+
+            var pixelToDpRectText = new TextLabel();
+            pixelRect =new Rectangle(100, 100, 100, 100);
+            dpRect = pixelRect.ToDp();
+            pixelToDpRectText.Text = $"pixel : ({pixelRect.X}, {pixelRect.Y}, {pixelRect.Width}, {pixelRect.Height}), dp : ({dpRect.X}, {dpRect.Y}, {dpRect.Width}, {dpRect.Height})";
+            rootView.Add(pixelToDpRectText);
+
+            var dpToPixelExtentText = new TextLabel();
+            var dpExtent = new Extents(10, 10, 10, 10);
+            var pixelExtent = dpExtent.ToPixel();
+            dpToPixelExtentText.Text = $"dp : ({dpExtent.Start}, {dpExtent.End}, {dpExtent.Top}, {dpExtent.Bottom}), pixel : ({pixelExtent.Start}, {pixelExtent.End}, {pixelExtent.Top}, {pixelExtent.Bottom})";
+            rootView.Add(dpToPixelExtentText);
+
+            var pixelToDpExtentText = new TextLabel();
+            pixelExtent =new Extents(10, 10, 10, 10);
+            dpExtent = pixelExtent.ToDp();
+            pixelToDpExtentText.Text = $"pixel : ({pixelExtent.Start}, {pixelExtent.End}, {pixelExtent.Top}, {pixelExtent.Bottom}), dp : ({dpExtent.Start}, {dpExtent.End}, {dpExtent.Top}, {dpExtent.Bottom})";
+            rootView.Add(pixelToDpExtentText);
+
+            var pixelToPointText = new TextLabel();
+            var fontPxSize = 30.0f;
+            pixelToPointText.PointSize = fontPxSize.PixelToPoint();
+            pixelToPointText.Text = $"pixel : {fontPxSize}, point: {fontPxSize.PixelToPoint()}";
+            rootView.Add(pixelToPointText);
+
+            var dpToPointText = new TextLabel();
+            var dpPxSize = 80.0f;
+            dpToPointText.PointSize = dpPxSize.DpToPoint();
+            dpToPointText.Text = $"pixel : {dpPxSize}, point: {dpPxSize.DpToPoint()}";
+            rootView.Add(dpToPointText);
+
+
+            window.Add(rootView);
+        }
+
+        public void Deactivate()
+        {
+            window.Remove(rootView);
+            rootView.Dispose();
+            rootView = null;
+        }
+    }
+}
\ No newline at end of file