{
internal static partial class CanvasView
{
- [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_CanvasView_Property")]
- public static extern global::System.IntPtr NewCanvasViewProperty();
-
- [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_CanvasView_Property")]
- public static extern void DeleteCanvasViewProperty(global::System.Runtime.InteropServices.HandleRef jarg1);
-
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_CanvasView_New__SWIG_0")]
public static extern global::System.IntPtr New(global::System.Runtime.InteropServices.HandleRef jarg1);
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_CanvasView")]
public static extern void DeleteCanvasView(global::System.Runtime.InteropServices.HandleRef jarg1);
- [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_CanvasView_Assign")]
- public static extern global::System.IntPtr Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
-
- [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_CanvasView_DownCast")]
- public static extern global::System.IntPtr DownCast(global::System.Runtime.InteropServices.HandleRef jarg1);
-
- [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_CanvasView_AddPaint")]
- public static extern bool AddPaint(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_CanvasView_AddDrawable")]
+ public static extern bool AddDrawable(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
}
}
{
internal static partial class Interop
{
- internal static partial class Paint
+ internal static partial class Drawable
{
- [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Paint_Translate")]
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Drawable_Translate")]
public static extern bool Translate(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3);
- [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Paint_SetOpacity")]
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Drawable_SetOpacity")]
public static extern bool SetOpacity(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2);
- [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Paint_GetOpacity")]
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Drawable_GetOpacity")]
public static extern float GetOpacity(global::System.Runtime.InteropServices.HandleRef jarg1);
- [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Paint_Scale")]
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Drawable_Scale")]
public static extern bool Scale(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2);
- [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Paint_Rotate")]
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Drawable_Rotate")]
public static extern bool Rotate(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2);
- [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Paint_Transform")]
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Drawable_Transform")]
public static extern bool Transform(global::System.Runtime.InteropServices.HandleRef jarg1, [global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)] float[] jarg2);
}
}
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Shape_GetStrokeColor")]
public static extern global::System.IntPtr GetStrokeColor(global::System.Runtime.InteropServices.HandleRef jarg1);
- [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Paint_SetStrokeDash")]
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Shape_SetStrokeDash")]
public static extern bool SetStrokeDash(global::System.Runtime.InteropServices.HandleRef jarg1, [global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)] float[] jarg2, int jarg3);
- [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Paint_GetStrokeDashIndexOf")]
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Shape_GetStrokeDashIndexOf")]
public static extern float GetStrokeDashIndexOf(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
- [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Paint_GetStrokeDashCount")]
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Shape_GetStrokeDashCount")]
public static extern int GetStrokeDashCount(global::System.Runtime.InteropServices.HandleRef jarg1);
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Shape_SetStrokeCap")]
/*
-* Copyright(c) 2019 Samsung Electronics Co., Ltd.
+* 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.
*/
using System;
using System.ComponentModel;
-
+using System.Diagnostics.CodeAnalysis;
namespace Tizen.NUI.BaseComponents
{
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public class CanvasView : View
- {
-
+ {
static CanvasView() { }
/// <summary>
/// </summary>
/// <param name="viewBox">The size of viewbox.</param>
[EditorBrowsable(EditorBrowsableState.Never)]
- public CanvasView(Size2D viewBox) : this(Interop.CanvasView.New(Uint16Pair.getCPtr( new Uint16Pair((uint)viewBox.Width, (uint)viewBox.Height))), true)
+ [SuppressMessage("Microsoft.Design", "CA2000: Dispose objects before losing scope", Justification = "It does not have dispose ownership.")]
+ public CanvasView(Size2D viewBox) : this(viewBox == null ? throw new ArgumentNullException(nameof(viewBox)) : Interop.CanvasView.New(Uint16Pair.getCPtr(new Uint16Pair((uint)viewBox.Width, (uint)viewBox.Height))), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
}
/// <summary>
- /// Downcasts a handle to CanvasView handle.
- /// </summary>
- /// <exception cref="ArgumentNullException"> Thrown when handle is null. </exception>
- /// Please do not use! this will be deprecated!
- /// Instead please use as keyword.
- [Obsolete("Please do not use! This will be deprecated! Please use as keyword instead! " +
- "Like: " +
- "BaseHandle handle = new CanvasView(viewBox); " +
- "CanvasView canvasView = handle as CanvasView")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static CanvasView DownCast(BaseHandle handle)
- {
- if (null == handle)
- {
- throw new ArgumentNullException(nameof(handle));
- }
- CanvasView ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as CanvasView;
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- /// This will not be public opened.
- [EditorBrowsable(EditorBrowsableState.Never)]
- protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
- {
- Interop.CanvasView.DeleteCanvasView(swigCPtr);
- }
-
- /// <summary>
/// you can override it to clean-up your own resources.
/// </summary>
/// <param name="type">DisposeTypes</param>
base.Dispose(type);
}
+ /// This will not be public opened.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
+ {
+ Interop.CanvasView.DeleteCanvasView(swigCPtr);
+ }
+
/// <summary>
- /// Add paint object to the CanvasView.
+ /// Add drawable object to the CanvasView.
/// This method is similar to registration. The added shape is drawn on the inner canvas.
/// </summary>
- /// <param name="paint">Paint object</param>
+ /// <param name="drawable">Drawable object</param>
[EditorBrowsable(EditorBrowsableState.Never)]
- public void AddPaint(Paint paint)
+ public void AddDrawable(Drawable drawable)
{
- Interop.CanvasView.AddPaint(View.getCPtr(this), BaseHandle.getCPtr(paint));
+ Interop.CanvasView.AddDrawable(View.getCPtr(this), BaseHandle.getCPtr(drawable));
}
-
}
}
}
/*
-* Copyright(c) 2019 Samsung Electronics Co., Ltd.
+* 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.
namespace Tizen.NUI.BaseComponents
{
-
namespace VectorGraphics
{
/// <summary>
- /// Paint is a object class for drawing a vector primitive.<br />
+ /// Drawable is a object class for drawing a vector primitive.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public class Paint : BaseHandle
+ public class Drawable : BaseHandle
{
- private Paint()
- {
+ /// <summary>
+ /// Creates an initialized drawable.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ private Drawable() {}
+ internal Drawable(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+ {
}
- internal Paint(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
- {
+ /// <summary>
+ /// Get the transparency value
+ /// </summary>
+ /// <returns>The transparency level</returns>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float GetOpacity()
+ {
+ return Interop.Drawable.GetOpacity(BaseHandle.getCPtr(this));
}
/// <summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public bool SetOpacity(float opacity)
{
- if (Interop.Paint.SetOpacity(BaseHandle.getCPtr(this), opacity))
+ if (Interop.Drawable.SetOpacity(BaseHandle.getCPtr(this), opacity))
return true;
return false;
}
/// <summary>
- /// Get the transparency value
- /// </summary>
- /// <returns>The transparency level</returns>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public float GetOpacity()
- {
- return Interop.Paint.GetOpacity(BaseHandle.getCPtr(this));
- }
-
- /// <summary>
- /// Set the x, y movement value of translate transformation.
+ /// Set the angle of rotation transformation.
/// </summary>
- /// <param name="x">The x-axis movement value.</param>
- /// <param name="y">The y-axis movement value.</param>
+ /// <param name="degree">The degree value of angle.</param>
/// <returns>True when it's successful. False otherwise.</returns>
[EditorBrowsable(EditorBrowsableState.Never)]
- public bool Translate(float x, float y)
+ public bool Rotate(float degree)
{
- if (Interop.Paint.Translate(BaseHandle.getCPtr(this), x, y))
+ if (Interop.Drawable.Rotate(BaseHandle.getCPtr(this), degree))
return true;
return false;
}
-
+
/// <summary>
/// Set the scale value of scale transformation.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public bool Scale(float factor)
{
- if (Interop.Paint.Scale(BaseHandle.getCPtr(this), factor))
+ if (Interop.Drawable.Scale(BaseHandle.getCPtr(this), factor))
return true;
return false;
}
/// <summary>
- /// Set the angle of rotation transformation.
+ /// Set the matrix value for affine transform.
/// </summary>
- /// <param name="degree">The degree value of angle.</param>
+ /// <param name="matrix">The float type array of 3x3 matrix.</param>
/// <returns>True when it's successful. False otherwise.</returns>
[EditorBrowsable(EditorBrowsableState.Never)]
- public bool Rotate(float degree)
+ public bool Transform(float[] matrix)
{
- if (Interop.Paint.Rotate(BaseHandle.getCPtr(this), degree))
+ if (Interop.Drawable.Transform(BaseHandle.getCPtr(this), matrix))
return true;
return false;
}
/// <summary>
- /// Set the matrix value for affine transform.
+ /// Set the x, y movement value of translate transformation.
/// </summary>
- /// <param name="matrix">The float type array of 3x3 matrix.</param>
+ /// <param name="x">The x-axis movement value.</param>
+ /// <param name="y">The y-axis movement value.</param>
/// <returns>True when it's successful. False otherwise.</returns>
[EditorBrowsable(EditorBrowsableState.Never)]
- public bool Transform(float[] matrix)
+ public bool Translate(float x, float y)
{
- if (Interop.Paint.Transform(BaseHandle.getCPtr(this), matrix))
+ if (Interop.Drawable.Translate(BaseHandle.getCPtr(this), x, y))
return true;
return false;
}
}
-
-
}
}
/*
-* Copyright(c) 2019 Samsung Electronics Co., Ltd.
+* 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.
namespace Tizen.NUI.BaseComponents
{
-
namespace VectorGraphics
{
/// <summary>
- /// Shape is a command list for drawing one shape groups It has own path data & properties for sync/asynchronous drawing
+ /// Shape is a command list for drawing one shape groups It has own path data and properties for sync/asynchronous drawing
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public class Shape : Paint
+ public class Shape : Drawable
{
/// <summary>
+ /// Creates an initialized Shape.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Shape() : this(Interop.Shape.New(), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ internal Shape(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+ {
+ }
+
+ /// <summary>
/// Enumeration for The cap style to be used for stroking the path.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
EvenOdd
}
- public Shape() : this(Interop.Shape.New(), true)
- {
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- }
-
- internal Shape(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
- {
- }
-
/// <summary>
/// Append the given rectangle with rounded corner to the path.
/// The roundedCorner arguments specify the radii of the ellipses defining the
/// If roundedCorner's values are 0, then it will draw a rectangle without rounded corner.
/// </summary>
/// <param name="x">X co-ordinate of the rectangle.</param>
- /// <param name="Y">Y co-ordinate of the rectangle.</param>
+ /// <param name="y">Y co-ordinate of the rectangle.</param>
/// <param name="width">Width of the rectangle.</param>
/// <param name="height">Height of the rectangle.</param>
/// <param name="roundedCornerX">The x radius of the rounded corner and should be in range [ 0 to w/2 ].</param>
/// <summary>
/// Sets the stroke dash pattern. The dash pattern is specified dash pattern.
/// </summary>
- /// <param name="dashPattern">Lenght and a gap list.</param>
+ /// <param name="dashPattern">Length and a gap list.</param>
/// <param name="count">Pattern list length</param>
/// <returns>True when it's successful. False otherwise.</returns>
[EditorBrowsable(EditorBrowsableState.Never)]
List<float> pattern = new List<float>();
int patternCount = Interop.Shape.GetStrokeDashCount(BaseHandle.getCPtr(this));
- for(int i = 0; i < patternCount; i++)
+ for (int i = 0; i < patternCount; i++)
{
pattern.Add(Interop.Shape.GetStrokeDashIndexOf(BaseHandle.getCPtr(this), i));
}
-using Tizen.NUI;
using Tizen.NUI.BaseComponents;
using Tizen.NUI.BaseComponents.VectorGraphics;
using System.Collections.Generic;
public class CanvasViewSample : IExample
{
+ const string tag = "NUITEST";
+
private View root;
private CanvasView canvasView ;
- private Shape mShape;
-
- private int mCount = 0;
-
- const string tag = "NUITEST";
+ private Shape shape;
private Timer timer;
+ private int count = 0;
public void Activate()
{
shape1.Scale(1.2f);
shape1.Rotate(45.0f);
- canvasView.AddPaint(shape1);
+ canvasView.AddDrawable(shape1);
Shape shape2 = new Shape();
shape2.AddCircle(0.0f, 0.0f, 150.0f, 100.0f);
shape2.Transform(new float[] {0.6f, 0.0f, 350.0f, 0.0f, 0.6f, 100.0f, 0.0f, 0.0f, 1.0f});
- canvasView.AddPaint(shape2);
+ canvasView.AddDrawable(shape2);
Shape shape3 = new Shape();
shape3.AddArc(0.0f, 0.0f, 80.0f, 10.0f, 120.0f, true);
shape3.SetStrokeWidth(10.0f);
shape3.Translate(100.0f, 300.0f);
shape3.SetStrokeJoin(Shape.StrokeJoin.Miter);
- canvasView.AddPaint(shape3);
+ canvasView.AddDrawable(shape3);
Shape shape4 = new Shape();
shape4.AddMoveTo(0.0f, -160.0f);
shape4.SetStrokeJoin(Shape.StrokeJoin.Round);
shape4.SetOpacity(0.5f);
- canvasView.AddPaint(shape4);
-
- mShape = new Shape();
- mShape.AddMoveTo(-1.0f, -165.0f);
- mShape.AddLineTo(53.0f, -56.0f);
- mShape.AddLineTo(174.0f, -39.0f);
- mShape.AddLineTo(87.0f, 45.0f);
- mShape.AddLineTo(107.0f, 166.0f);
- mShape.AddLineTo(-1.0f, 110.0f);
- mShape.AddLineTo(-103.0f, 166.0f);
- mShape.AddLineTo(-88.0f, 46.0f);
- mShape.AddLineTo(-174.0f, -38.0f);
- mShape.AddLineTo(-54.0f, -56.0f);
-
- mShape.Close();
-
- mShape.SetFillColor(new Color(0.0f, 1.0f, 1.0f, 1.0f));
- mShape.SetStrokeColor(new Color(0.5f, 1.0f, 0.5f, 1.0f));
- mShape.SetStrokeWidth(30.0f);
- mShape.SetStrokeCap(Shape.StrokeCap.Round);
- mShape.Scale(0.6f);
- mShape.Translate(250.0f, 550.0f);
- mShape.SetOpacity(0.5f);
-
- canvasView.AddPaint(mShape);
+ canvasView.AddDrawable(shape4);
+
+ shape = new Shape();
+ shape.AddMoveTo(-1.0f, -165.0f);
+ shape.AddLineTo(53.0f, -56.0f);
+ shape.AddLineTo(174.0f, -39.0f);
+ shape.AddLineTo(87.0f, 45.0f);
+ shape.AddLineTo(107.0f, 166.0f);
+ shape.AddLineTo(-1.0f, 110.0f);
+ shape.AddLineTo(-103.0f, 166.0f);
+ shape.AddLineTo(-88.0f, 46.0f);
+ shape.AddLineTo(-174.0f, -38.0f);
+ shape.AddLineTo(-54.0f, -56.0f);
+
+ shape.Close();
+
+ shape.SetFillColor(new Color(0.0f, 1.0f, 1.0f, 1.0f));
+ shape.SetStrokeColor(new Color(0.5f, 1.0f, 0.5f, 1.0f));
+ shape.SetStrokeWidth(30.0f);
+ shape.SetStrokeCap(Shape.StrokeCap.Round);
+ shape.Scale(0.6f);
+ shape.Translate(250.0f, 550.0f);
+ shape.SetOpacity(0.5f);
+
+ canvasView.AddDrawable(shape);
timer = new Timer(1000 / 32);
timer.Tick += onTick;
log.Debug(tag, "Shape4 Opacity : " + shape4.GetOpacity() + "\n");
List<float> pattern = shape2.GetStrokeDash();
- for(int i = 0; i < pattern.Count; i++)
+ for (int i = 0; i < pattern.Count; i++)
{
log.Debug(tag, "Shape4 StrokeDash : " + pattern[i] + "\n");
}
root.Add(canvasView);
}
- private bool onTick(object o, Timer.TickEventArgs e)
- {
- mShape.Rotate((float)(mCount * 2.0f));
- mShape.Scale((float)(mCount % 100) * 0.01f + 0.6f);
- mCount++;
-
- return true;
- }
-
public void Deactivate()
{
if (root != null)
root.Dispose();
}
}
+
+ private bool onTick(object o, Timer.TickEventArgs e)
+ {
+ shape.Rotate((float)(count * 2.0f));
+ shape.Scale((float)(count % 100) * 0.01f + 0.6f);
+ count++;
+
+ return true;
+ }
}
}