2 * Copyright(c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.ComponentModel;
20 namespace Tizen.NUI.BaseComponents.VectorGraphics
23 /// Drawable is a object class for drawing a vector primitive.
25 [EditorBrowsable(EditorBrowsableState.Never)]
26 public class Drawable : BaseHandle
29 /// Creates an initialized drawable.
31 [EditorBrowsable(EditorBrowsableState.Never)]
34 internal Drawable(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
39 /// The transparency level [0 ~ 1.0], 0 means totally transparent, while 1 means opaque.
41 [EditorBrowsable(EditorBrowsableState.Never)]
45 return Interop.Drawable.GetOpacity(BaseHandle.getCPtr(this));
48 Interop.Drawable.SetOpacity(BaseHandle.getCPtr(this), value);
49 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
54 /// Set the angle of rotation transformation.
56 /// <param name="degree">The degree value of angle.</param>
57 /// <returns>True when it's successful. False otherwise.</returns>
58 [EditorBrowsable(EditorBrowsableState.Never)]
59 public bool Rotate(float degree)
61 bool ret = Interop.Drawable.Rotate(BaseHandle.getCPtr(this), degree);
62 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
67 /// Set the scale value of scale transformation.
69 /// <param name="factor">The scale factor value.</param>
70 /// <returns>True when it's successful. False otherwise.</returns>
71 [EditorBrowsable(EditorBrowsableState.Never)]
72 public bool Scale(float factor)
74 bool ret = Interop.Drawable.Scale(BaseHandle.getCPtr(this), factor);
75 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
80 /// Set the matrix value for affine transform.
82 /// <param name="matrix">The float type array of 3x3 matrix.</param>
83 /// <returns>True when it's successful. False otherwise.</returns>
84 /// <exception cref="ArgumentNullException"> Thrown when matrix is null. </exception>
85 /// <exception cref="ArgumentException"> Thrown when matrix array length is not 9. </exception>
86 [EditorBrowsable(EditorBrowsableState.Never)]
87 public bool Transform(float[] matrix)
91 throw new ArgumentNullException(nameof(matrix));
93 if (matrix.Length != 9)
95 throw new ArgumentException("matrix array length is not 9.", nameof(matrix));
97 bool ret = Interop.Drawable.Transform(BaseHandle.getCPtr(this), matrix);
98 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
103 /// Set the x, y movement value of translate transformation.
105 /// <param name="x">The x-axis movement value.</param>
106 /// <param name="y">The y-axis movement value.</param>
107 /// <returns>True when it's successful. False otherwise.</returns>
108 [EditorBrowsable(EditorBrowsableState.Never)]
109 public bool Translate(float x, float y)
111 bool ret = Interop.Drawable.Translate(BaseHandle.getCPtr(this), x, y);
112 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();