{
/// <summary>
/// The GraphicTypeExtensions class is graphics type converter 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().
+ /// Density independent pixel(dp) unit is our basic target type and you can get converted value by PxToDp(),
+ /// and you can get original pixel by PxToDp().
/// 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>
public static class GraphicsTypeExtensions
{
/// <summary>
+ /// Converter float dp to pixel.
+ /// </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 DpToPx(this float dp)
+ {
+ return GraphicsTypeManager.Instance.Dp.ConvertToPixel(dp);
+ }
+
+ /// <summary>
+ /// Converter float sp to pixel.
+ /// </summary>
+ /// <param name="sp">The float sp 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 SpToPx(this float sp)
+ {
+ return GraphicsTypeManager.Instance.Sp.ConvertToPixel(sp);
+ }
+
+ /// <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)
+ public static float PxToDp(this float pixel)
{
- return GraphicsTypeManager.Instance.ConvertFromPixel(pixel);
+ return GraphicsTypeManager.Instance.Dp.ConvertFromPixel(pixel);
}
/// <summary>
- /// Converter float dp to pixel.
- /// 100.0f.ToPixel() = 200.0f in 320dpi display.
+ /// Converter float pixel to sp.
/// </summary>
- /// <param name="dp">The float dp unit value to be converted pixel unit.</param>
- /// <returns>The float pixel unit value.</returns>
+ /// <param name="pixel">The float pixel unit value to be converted sp unit.</param>
+ /// <returns>The float sp 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 PxToSp(this float pixel)
+ {
+ return GraphicsTypeManager.Instance.Sp.ConvertFromPixel(pixel);
+ }
+
+ /// <summary>
+ /// Converter int dp to pixel.
+ /// </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 DpToPx(this int dp)
+ {
+ return (int)GraphicsTypeManager.Instance.Dp.ConvertToPixel(dp);
+ }
+
+ /// <summary>
+ /// Converter int dp to pixel.
+ /// </summary>
+ /// <param name="sp">The int sp 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 float ToPixel(this float dp)
+ public static int SpToPx(this int sp)
{
- return GraphicsTypeManager.Instance.ConvertToPixel(dp);
+ return (int)GraphicsTypeManager.Instance.Sp.ConvertToPixel(sp);
}
/// <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)
+ public static int PxToDp(this int pixel)
{
- return (int)GraphicsTypeManager.Instance.ConvertFromPixel(pixel);
+ return (int)GraphicsTypeManager.Instance.Dp.ConvertFromPixel(pixel);
}
/// <summary>
- /// Converter int dp to pixel.
- /// 100.ToPixel() = 200 in 320dpi display.
+ /// Converter int pixel to sp.
/// </summary>
- /// <param name="dp">The int dp unit value to be converted pixel unit.</param>
- /// <returns>The int pixel unit value.</returns>
+ /// <param name="pixel">The int pixel unit value to be converted sp unit.</param>
+ /// <returns>The int sp 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)
+ public static int PxToSp(this int pixel)
{
- return (int)GraphicsTypeManager.Instance.ConvertToPixel(dp);
+ return (int)GraphicsTypeManager.Instance.Sp.ConvertFromPixel(pixel);
}
+
/// <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)
+ public static Size PxToDp(this Size pixel)
{
if (pixel == null) return null;
- return new Size(GraphicsTypeManager.Instance.ConvertFromPixel(pixel.Width),
- GraphicsTypeManager.Instance.ConvertFromPixel(pixel.Height));
+ return new Size(GraphicsTypeManager.Instance.Dp.ConvertFromPixel(pixel.Width),
+ GraphicsTypeManager.Instance.Dp.ConvertFromPixel(pixel.Height));
+ }
+
+ /// <summary>
+ /// Converter Size pixel to sp.
+ /// </summary>
+ /// <param name="pixel">The Size pixel unit value to be converted sp unit.</param>
+ /// <returns>The Size sp 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 PxToSp(this Size pixel)
+ {
+ if (pixel == null) return null;
+ return new Size(GraphicsTypeManager.Instance.Sp.ConvertFromPixel(pixel.Width),
+ GraphicsTypeManager.Instance.Sp.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)
+ public static Size DpToPx(this Size dp)
{
if (dp == null) return null;
- return new Size(GraphicsTypeManager.Instance.ConvertToPixel(dp.Width),
- GraphicsTypeManager.Instance.ConvertToPixel(dp.Height));
+ return new Size(GraphicsTypeManager.Instance.Dp.ConvertToPixel(dp.Width),
+ GraphicsTypeManager.Instance.Dp.ConvertToPixel(dp.Height));
+ }
+
+ /// <summary>
+ /// Converter Size sp to pixel.
+ /// </summary>
+ /// <param name="sp">The Size sp 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 SpToPx(this Size sp)
+ {
+ if (sp == null) return null;
+ return new Size(GraphicsTypeManager.Instance.Sp.ConvertToPixel(sp.Width),
+ GraphicsTypeManager.Instance.Sp.ConvertToPixel(sp.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)
+ public static Size2D PxToDp(this Size2D pixel)
{
if (pixel == null) return null;
- return new Size2D((int)GraphicsTypeManager.Instance.ConvertFromPixel(pixel.Width),
- (int)GraphicsTypeManager.Instance.ConvertFromPixel(pixel.Height));
+ return new Size2D((int)GraphicsTypeManager.Instance.Dp.ConvertFromPixel(pixel.Width),
+ (int)GraphicsTypeManager.Instance.Dp.ConvertFromPixel(pixel.Height));
+ }
+
+ /// <summary>
+ /// Converter Size2D pixel to sp.
+ /// </summary>
+ /// <param name="pixel">The Size2D pixel unit value to be converted sp unit.</param>
+ /// <returns>The Size2D sp 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 PxToSp(this Size2D pixel)
+ {
+ if (pixel == null) return null;
+ return new Size2D((int)GraphicsTypeManager.Instance.Sp.ConvertFromPixel(pixel.Width),
+ (int)GraphicsTypeManager.Instance.Sp.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)
+ public static Size2D DpToPx(this Size2D dp)
{
if (dp == null) return null;
- return new Size2D((int)GraphicsTypeManager.Instance.ConvertToPixel(dp.Width),
- (int)GraphicsTypeManager.Instance.ConvertToPixel(dp.Height));
+ return new Size2D((int)GraphicsTypeManager.Instance.Dp.ConvertToPixel(dp.Width),
+ (int)GraphicsTypeManager.Instance.Dp.ConvertToPixel(dp.Height));
+ }
+
+ /// <summary>
+ /// Converter Size2D sp to pixel.
+ /// </summary>
+ /// <param name="sp">The Size2D sp 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 SpToPx(this Size2D sp)
+ {
+ if (sp == null) return null;
+ return new Size2D((int)GraphicsTypeManager.Instance.Sp.ConvertToPixel(sp.Width),
+ (int)GraphicsTypeManager.Instance.Sp.ConvertToPixel(sp.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)
+ public static Position PxToDp(this Position pixel)
+ {
+ if (pixel == null) return null;
+ return new Position(GraphicsTypeManager.Instance.Dp.ConvertFromPixel(pixel.X),
+ GraphicsTypeManager.Instance.Dp.ConvertFromPixel(pixel.Y));
+ }
+
+ /// <summary>
+ /// Converter Position pixel to sp.
+ /// </summary>
+ /// <param name="pixel">The Position pixel unit value to be converted sp unit.</param>
+ /// <returns>The Position sp 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 PxToSp(this Position pixel)
{
if (pixel == null) return null;
- return new Position(GraphicsTypeManager.Instance.ConvertFromPixel(pixel.X),
- GraphicsTypeManager.Instance.ConvertFromPixel(pixel.Y));
+ return new Position(GraphicsTypeManager.Instance.Sp.ConvertFromPixel(pixel.X),
+ GraphicsTypeManager.Instance.Sp.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)
+ public static Position DpToPx(this Position dp)
{
if (dp == null) return null;
- return new Position(GraphicsTypeManager.Instance.ConvertToPixel(dp.X),
- GraphicsTypeManager.Instance.ConvertToPixel(dp.Y));
+ return new Position(GraphicsTypeManager.Instance.Dp.ConvertToPixel(dp.X),
+ GraphicsTypeManager.Instance.Dp.ConvertToPixel(dp.Y));
+ }
+
+ /// <summary>
+ /// Converter Position sp to pixel.
+ /// </summary>
+ /// <param name="sp">The Position sp 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 SpToPx(this Position sp)
+ {
+ if (sp == null) return null;
+ return new Position(GraphicsTypeManager.Instance.Sp.ConvertToPixel(sp.X),
+ GraphicsTypeManager.Instance.Sp.ConvertToPixel(sp.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)
+ public static Position2D PxToDp(this Position2D pixel)
{
if (pixel == null) return null;
- return new Position2D((int)GraphicsTypeManager.Instance.ConvertFromPixel(pixel.X),
- (int)GraphicsTypeManager.Instance.ConvertFromPixel(pixel.Y));
+ return new Position2D((int)GraphicsTypeManager.Instance.Dp.ConvertFromPixel(pixel.X),
+ (int)GraphicsTypeManager.Instance.Dp.ConvertFromPixel(pixel.Y));
+ }
+
+ /// <summary>
+ /// Converter Position2D pixel to sp.
+ /// </summary>
+ /// <param name="pixel">The Position2D pixel unit value to be converted sp unit.</param>
+ /// <returns>The Position2D sp 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 PxToSp(this Position2D pixel)
+ {
+ if (pixel == null) return null;
+ return new Position2D((int)GraphicsTypeManager.Instance.Sp.ConvertFromPixel(pixel.X),
+ (int)GraphicsTypeManager.Instance.Sp.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)
+ public static Position2D DpToPx(this Position2D dp)
{
if (dp == null) return null;
- return new Position2D((int)GraphicsTypeManager.Instance.ConvertToPixel(dp.X),
- (int)GraphicsTypeManager.Instance.ConvertToPixel(dp.Y));
+ return new Position2D((int)GraphicsTypeManager.Instance.Dp.ConvertToPixel(dp.X),
+ (int)GraphicsTypeManager.Instance.Dp.ConvertToPixel(dp.Y));
+ }
+
+ /// <summary>
+ /// Converter Position2D sp to pixel.
+ /// </summary>
+ /// <param name="sp">The Position2D sp 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 SpToPx(this Position2D sp)
+ {
+ if (sp == null) return null;
+ return new Position2D((int)GraphicsTypeManager.Instance.Sp.ConvertToPixel(sp.X),
+ (int)GraphicsTypeManager.Instance.Sp.ConvertToPixel(sp.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)
+ public static Rectangle PxToDp(this Rectangle pixel)
+ {
+ if (pixel == null) return null;
+ return new Rectangle((int)GraphicsTypeManager.Instance.Dp.ConvertFromPixel(pixel.X),
+ (int)GraphicsTypeManager.Instance.Dp.ConvertFromPixel(pixel.Y),
+ (int)GraphicsTypeManager.Instance.Dp.ConvertFromPixel(pixel.Width),
+ (int)GraphicsTypeManager.Instance.Dp.ConvertFromPixel(pixel.Height));
+ }
+
+ /// <summary>
+ /// Converter Rectangle pixel to sp.
+ /// </summary>
+ /// <param name="pixel">The Rectangle pixel unit value to be converted sp unit.</param>
+ /// <returns>The Rectangle sp 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 PxToSp(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));
+ return new Rectangle((int)GraphicsTypeManager.Instance.Sp.ConvertFromPixel(pixel.X),
+ (int)GraphicsTypeManager.Instance.Sp.ConvertFromPixel(pixel.Y),
+ (int)GraphicsTypeManager.Instance.Sp.ConvertFromPixel(pixel.Width),
+ (int)GraphicsTypeManager.Instance.Sp.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)
+ public static Rectangle DpToPx(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));
+ return new Rectangle((int)GraphicsTypeManager.Instance.Dp.ConvertToPixel(dp.X),
+ (int)GraphicsTypeManager.Instance.Dp.ConvertToPixel(dp.Y),
+ (int)GraphicsTypeManager.Instance.Dp.ConvertToPixel(dp.Width),
+ (int)GraphicsTypeManager.Instance.Dp.ConvertToPixel(dp.Height));
+ }
+
+ /// <summary>
+ /// Converter Rectangle sp to pixel.
+ /// </summary>
+ /// <param name="sp">The Rectangle sp 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 SpToPx(this Rectangle sp)
+ {
+ if (sp == null) return null;
+ return new Rectangle((int)GraphicsTypeManager.Instance.Sp.ConvertToPixel(sp.X),
+ (int)GraphicsTypeManager.Instance.Sp.ConvertToPixel(sp.Y),
+ (int)GraphicsTypeManager.Instance.Sp.ConvertToPixel(sp.Width),
+ (int)GraphicsTypeManager.Instance.Sp.ConvertToPixel(sp.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)
+ public static Extents PxToDp(this Extents pixel)
+ {
+ if (pixel == null) return null;
+ return new Extents((ushort)GraphicsTypeManager.Instance.Dp.ConvertFromPixel(pixel.Start),
+ (ushort)GraphicsTypeManager.Instance.Dp.ConvertFromPixel(pixel.End),
+ (ushort)GraphicsTypeManager.Instance.Dp.ConvertFromPixel(pixel.Top),
+ (ushort)GraphicsTypeManager.Instance.Dp.ConvertFromPixel(pixel.Bottom));
+ }
+
+ /// <summary>
+ /// Converter Extents pixel to sp.
+ /// </summary>
+ /// <param name="pixel">The Extents pixel unit value to be converted sp unit.</param>
+ /// <returns>The Extents sp 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 PxToSp(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));
+ return new Extents((ushort)GraphicsTypeManager.Instance.Sp.ConvertFromPixel(pixel.Start),
+ (ushort)GraphicsTypeManager.Instance.Sp.ConvertFromPixel(pixel.End),
+ (ushort)GraphicsTypeManager.Instance.Sp.ConvertFromPixel(pixel.Top),
+ (ushort)GraphicsTypeManager.Instance.Sp.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)
+ public static Extents DpToPx(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));
+ return new Extents((ushort)GraphicsTypeManager.Instance.Dp.ConvertToPixel(dp.Start),
+ (ushort)GraphicsTypeManager.Instance.Dp.ConvertToPixel(dp.End),
+ (ushort)GraphicsTypeManager.Instance.Dp.ConvertToPixel(dp.Top),
+ (ushort)GraphicsTypeManager.Instance.Dp.ConvertToPixel(dp.Bottom));
+ }
+
+ /// <summary>
+ /// Converter Extents sp to pixel.
+ /// </summary>
+ /// <param name="sp">The Extents sp 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 SpToPx(this Extents sp)
+ {
+ if (sp == null) return null;
+ return new Extents((ushort)GraphicsTypeManager.Instance.Sp.ConvertToPixel(sp.Start),
+ (ushort)GraphicsTypeManager.Instance.Sp.ConvertToPixel(sp.End),
+ (ushort)GraphicsTypeManager.Instance.Sp.ConvertToPixel(sp.Top),
+ (ushort)GraphicsTypeManager.Instance.Sp.ConvertToPixel(sp.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)
+ public static float PxToPt(this float pixel)
{
- return GraphicsTypeManager.Instance.ConvertFromPixel(pixel);
+ return GraphicsTypeManager.Instance.Point.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>
+ /// <param name="pt">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)
+ public static float PtToPixel(this float pt)
{
- return PointTypeConverter.Instance.ConvertToPixel(point);
+ return GraphicsTypeManager.Instance.Point.ConvertToPixel(pt);
}
/// <summary>
/// Converter float font dp size to point size.
- /// 16.0f.DpToPoint() = 7.2f.
+ /// 16.0f.DpToPt() = 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)
+ public static float DpToPt(this float dp)
{
- return PointTypeConverter.Instance.ConvertDpToPoint(dp);
+ return GraphicsTypeManager.Instance.Point.ConvertDpToPoint(dp);
}
/// <summary>
/// Converter float font point size to dp size.
- /// 7.2f.PointToDp() = 16.0f.
+ /// 7.2f.PtToDp() = 16.0f.
/// </summary>
- /// <param name="point">The float point unit value to be converted dp unit.</param>
+ /// <param name="pt">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)
+ public static float PtToDp(this float pt)
{
- return PointTypeConverter.Instance.ConvertPointToDp(point);
+ return GraphicsTypeManager.Instance.Point.ConvertPointToDp(pt);
}
}
}
private int oldPageCount = 0;
private Window window;
- private View rootView;
+ private ScrollableBase rootView;
public void Activate()
{
window = NUIApplication.GetDefaultWindow();
- rootView = new View()
+ rootView = new ScrollableBase()
{
WidthSpecification = LayoutParamPolicies.MatchParent,
HeightSpecification = LayoutParamPolicies.MatchParent,
- Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Vertical}
+ Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Vertical},
+ Padding = new Extents(20, 20, 0, 0)
};
/* GraphicsTypeManager test. */
+ var managerTitleText = new TextLabel();
+ managerTitleText.Text = "GraphicsTypeManager";
+ managerTitleText.PointSize = 40;
+ managerTitleText.TextColor = Color.Blue;
+ managerTitleText.Padding = new Extents(0, 0, 0, 10);
+ rootView.Add(managerTitleText);
+
var baseDpiText = new TextLabel();
baseDpiText.Text = $"Baseline Dpi : {GraphicsTypeManager.Instance.BaselineDpi}";
rootView.Add(baseDpiText);
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 converterTitleText = new TextLabel();
+ converterTitleText.Text = "GraphicsTypeConverter";
+ converterTitleText.PointSize = 40;
+ converterTitleText.TextColor = Color.Red;
+ converterTitleText.Padding = new Extents(0, 0, 10, 10);
+ rootView.Add(converterTitleText);
+
var dpConvertText = new TextLabel();
var dp = 100.0f;
dpConvertText.Text = $"dp : {dp}, pixel : {DpTypeConverter.Instance.ConvertToPixel(dp)}";
var pxConvertText = new TextLabel();
var px = 100.0f;
- pxConvertText.Text = $"pixel : {px}, dp : {DpTypeConverter.Instance.ConvertToPixel(px)}";
+ pxConvertText.Text = $"pixel : {px}, dp : {DpTypeConverter.Instance.ConvertFromPixel(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 spConvertText = new TextLabel();
+ var sp = 100.0f;
+ spConvertText.Text = $"sp : {sp}, pixel : {SpTypeConverter.Instance.ConvertToPixel(sp)}";
+ rootView.Add(spConvertText);
- var dpToPixel2Text = new TextLabel();
- dpToPixel2Text.Text = $"dp : {100}, pixel : {100.ToPixel()}";
- rootView.Add(dpToPixel2Text);
+ pxConvertText = new TextLabel();
+ px = 100.0f;
+ pxConvertText.Text = $"pixel : {px}, sp : {PointTypeConverter.Instance.ConvertFromPixel(px)}";
+ rootView.Add(pxConvertText);
- var pixelToDp2Text = new TextLabel();
- pixelToDp2Text.Text = $"pixel : {60}, dp : {60.ToDp()}";
- rootView.Add(pixelToDp2Text);
+ var ptConvertText = new TextLabel();
+ var pt = 100.0f;
+ ptConvertText.Text = $"point : {pt}, pixel : {PointTypeConverter.Instance.ConvertToPixel(pt)}";
+ rootView.Add(pxConvertText);
- 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);
+ pxConvertText = new TextLabel();
+ px = 100.0f;
+ pxConvertText.Text = $"pixel : {px}, point : {PointTypeConverter.Instance.ConvertFromPixel(px)}";
+ rootView.Add(pxConvertText);
- var pixelToDpSizeText = new TextLabel();
+ /* GraphicsTypeExtension test. */
+ var extTitleText = new TextLabel();
+ extTitleText.Text = "GraphicsTypeExtensions";
+ extTitleText.PointSize = 40;
+ extTitleText.TextColor = Color.Green;
+ extTitleText.Padding = new Extents(0, 0, 10, 10);
+ rootView.Add(extTitleText);
+
+ var spToPxFloatText = new TextLabel();
+ spToPxFloatText.Text = $"sp : {100.01f}, pixel : {100.01f.SpToPx()}";
+ rootView.Add(spToPxFloatText);
+
+ var pixelToSpFloatText = new TextLabel();
+ pixelToSpFloatText.Text = $"pixel : {60.01f}, sp : {60.01f.PxToSp()}";
+ rootView.Add(pixelToSpFloatText);
+
+ var spToPxIntText = new TextLabel();
+ spToPxIntText.Text = $"sp : {100}, pixel : {100.SpToPx()}";
+ rootView.Add(spToPxIntText);
+
+ var pixelToSpIntText = new TextLabel();
+ pixelToSpIntText.Text = $"pixel : {60}, sp : {60.PxToSp()}";
+ rootView.Add(pixelToSpIntText);
+
+ var spToPxSizeText = new TextLabel();
+ var spSize = new Size(100.0f, 100.0f);
+ var pixelSize = spSize.SpToPx();
+ spToPxSizeText.Text = $"sp : ({spSize.Width}, {spSize.Height}), pixel : ({pixelSize.Width}, {pixelSize.Height})";
+ rootView.Add(spToPxSizeText);
+
+ var pixelToSpSizeText = 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);
+ spSize = pixelSize.PxToSp();
+ pixelToSpSizeText.Text = $"pixel : ({pixelSize.Width}, {pixelSize.Height}), sp : ({spSize.Width}, {spSize.Height})";
+ rootView.Add(pixelToSpSizeText);
- 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 spToPxPosText = new TextLabel();
+ var spPos = new Position(100.0f, 100.0f);
+ var pixelPos = spPos.SpToPx();
+ spToPxPosText.Text = $"sp : ({spPos.X}, {spPos.Y}), pixel : ({pixelPos.X}, {pixelPos.Y})";
+ rootView.Add(spToPxPosText);
- var pixelToDpPosText = new TextLabel();
+ var pixelToSpPosText = 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);
+ spPos = pixelPos.PxToSp();
+ pixelToSpPosText.Text = $"pixel : ({pixelPos.X}, {pixelPos.Y}), sp : ({spPos.X}, {spPos.Y})";
+ rootView.Add(pixelToSpPosText);
- 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 spToPxRectText = new TextLabel();
+ var spRect = new Rectangle(100, 100, 100, 100);
+ var pixelRect = spRect.SpToPx();
+ spToPxRectText.Text = $"sp : ({spRect.X}, {spRect.Y}, {spRect.Width}, {spRect.Height}), pixel : ({pixelRect.X}, {pixelRect.Y}, {pixelRect.Width}, {pixelRect.Height})";
+ rootView.Add(spToPxRectText);
- var pixelToDpRectText = new TextLabel();
+ var pixelToSpRectText = 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);
+ spRect = pixelRect.PxToSp();
+ pixelToSpRectText.Text = $"pixel : ({pixelRect.X}, {pixelRect.Y}, {pixelRect.Width}, {pixelRect.Height}), sp : ({spRect.X}, {spRect.Y}, {spRect.Width}, {spRect.Height})";
+ rootView.Add(pixelToSpRectText);
- 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 spToPxExtentText = new TextLabel();
+ var spExtent = new Extents(10, 10, 10, 10);
+ var pixelExtent = spExtent.SpToPx();
+ spToPxExtentText.Text = $"sp : ({spExtent.Start}, {spExtent.End}, {spExtent.Top}, {spExtent.Bottom}), pixel : ({pixelExtent.Start}, {pixelExtent.End}, {pixelExtent.Top}, {pixelExtent.Bottom})";
+ rootView.Add(spToPxExtentText);
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})";
+ spExtent = pixelExtent.PxToSp();
+ pixelToDpExtentText.Text = $"pixel : ({pixelExtent.Start}, {pixelExtent.End}, {pixelExtent.Top}, {pixelExtent.Bottom}), sp : ({spExtent.Start}, {spExtent.End}, {spExtent.Top}, {spExtent.Bottom})";
rootView.Add(pixelToDpExtentText);
var pixelToPointText = new TextLabel();
var fontPxSize = 30.0f;
- pixelToPointText.PointSize = fontPxSize.PixelToPoint();
- pixelToPointText.Text = $"pixel : {fontPxSize}, point: {fontPxSize.PixelToPoint()}";
+ pixelToPointText.PointSize = fontPxSize.PxToPt();
+ pixelToPointText.Text = $"pixel : {fontPxSize}, point: {fontPxSize.PxToPt()}";
rootView.Add(pixelToPointText);
var dpToPointText = new TextLabel();
var dpPxSize = 80.0f;
- dpToPointText.PointSize = dpPxSize.DpToPoint();
- dpToPointText.Text = $"pixel : {dpPxSize}, point: {dpPxSize.DpToPoint()}";
+ dpToPointText.PointSize = dpPxSize.DpToPt();
+ dpToPointText.Text = $"pixel : {dpPxSize}, point: {dpPxSize.DpToPt()}";
rootView.Add(dpToPointText);
-
window.Add(rootView);
}