Merge "Add C# binding for VideoView.Underlay property."
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Geometry.cs
1 /*
2  * Copyright(c) 2017 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 namespace Tizen.NUI
19 {
20
21     /// <summary>
22     /// Geometry is handle to an object that can be used to define a geometric elements.
23     /// </summary>
24     public class Geometry : BaseHandle
25     {
26         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
27
28         internal Geometry(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Geometry_SWIGUpcast(cPtr), cMemoryOwn)
29         {
30             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
31         }
32
33         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Geometry obj)
34         {
35             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
36         }
37
38         /// <summary>
39         /// Dispose.
40         /// </summary>
41         /// <since_tizen> 3 </since_tizen>
42         protected override void Dispose(DisposeTypes type)
43         {
44             if (disposed)
45             {
46                 return;
47             }
48
49             if (type == DisposeTypes.Explicit)
50             {
51                 //Called by User
52                 //Release your own managed resources here.
53                 //You should release all of your own disposable objects here.
54
55             }
56
57             //Release your own unmanaged resources here.
58             //You should not access any managed member here except static instance.
59             //because the execution order of Finalizes is non-deterministic.
60
61             if (swigCPtr.Handle != global::System.IntPtr.Zero)
62             {
63                 if (swigCMemOwn)
64                 {
65                     swigCMemOwn = false;
66                     NDalicPINVOKE.delete_Geometry(swigCPtr);
67                 }
68                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
69             }
70
71             base.Dispose(type);
72         }
73
74         /// <summary>
75         /// Create an instance of Geometry.
76         /// <since_tizen> 3 </since_tizen>
77         /// </summary>
78         public Geometry() : this(NDalicPINVOKE.Geometry_New(), true)
79         {
80             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
81
82         }
83
84         /// <summary>
85         /// Adds a PropertyBuffer to be used as source of geometry vertices.
86         /// </summary>
87         /// <param name="vertexBuffer">PropertyBuffer to be used as source of geometry vertices.</param>
88         /// <returns>Index of the newly added buffer.</returns>
89         /// <since_tizen> 3 </since_tizen>
90         public uint AddVertexBuffer(PropertyBuffer vertexBuffer)
91         {
92             uint ret = NDalicPINVOKE.Geometry_AddVertexBuffer(swigCPtr, PropertyBuffer.getCPtr(vertexBuffer));
93             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
94             return ret;
95         }
96
97         /// <summary>
98         /// Retrieves the number of vertex buffers that have been added to this geometry.
99         /// </summary>
100         /// <returns>Number of vertex buffers that have been added to this geometry.</returns>
101         /// <since_tizen> 3 </since_tizen>
102         public uint GetNumberOfVertexBuffers()
103         {
104             uint ret = NDalicPINVOKE.Geometry_GetNumberOfVertexBuffers(swigCPtr);
105             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
106             return ret;
107         }
108
109         /// <summary>
110         /// Removes a vertex buffer.
111         /// </summary>
112         /// <param name="index">Index to the vertex buffer to remove.</param>
113         /// <since_tizen> 3 </since_tizen>
114         public void RemoveVertexBuffer(uint index)
115         {
116             NDalicPINVOKE.Geometry_RemoveVertexBuffer(swigCPtr, index);
117             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
118         }
119
120         /// <summary>
121         /// Sets a the index data to be used as a source of indices for the geometry
122         /// Setting this buffer will cause the geometry to be rendered using indices.
123         /// </summary>
124         /// <param name="indices">Array of indices.</param>
125         /// <param name="count">Number of indices in the array.</param>
126         /// <since_tizen> 3 </since_tizen>
127         public void SetIndexBuffer(ushort[] indices, uint count)
128         {
129             NDalicPINVOKE.Geometry_SetIndexBuffer(swigCPtr, indices, count);
130             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
131         }
132
133         /// <summary>
134         /// Sets the type of primitives this geometry contains.
135         /// </summary>
136         /// <param name="geometryType">Array of indices.</param>
137         /// <since_tizen> 3 </since_tizen>
138         public void SetType(Geometry.Type geometryType)
139         {
140             NDalicPINVOKE.Geometry_SetType(swigCPtr, (int)geometryType);
141             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
142         }
143
144         /// <summary>
145         /// Gets the type of primitives this geometry contains.
146         /// </summary>
147         /// <returns>Type of primitives this geometry contains.</returns>
148         /// <since_tizen> 3 </since_tizen>
149         public new Geometry.Type GetType()
150         {
151             Geometry.Type ret = (Geometry.Type)NDalicPINVOKE.Geometry_GetType(swigCPtr);
152             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
153             return ret;
154         }
155
156         /// <summary>
157         /// Enumeration for the description of the type of geometry,
158         /// used to determine how the coordinates will be used.
159         /// </summary>
160         /// <returns>Type of primitives this geometry contains.</returns>
161         /// <since_tizen> 3 </since_tizen>
162         public enum Type
163         {
164             /// <summary>
165             /// Individual points.
166             /// </summary>
167             POINTS,
168
169             /// <summary>
170             /// Individual lines (made of 2 points each).
171             /// </summary>
172             LINES,
173
174             /// <summary>
175             /// A strip of lines (made of 1 point each) which also joins the first and last point.
176             /// </summary>
177             LINE_LOOP,
178
179             /// <summary>
180             /// A strip of lines (made of 1 point each).
181             /// </summary>
182             LINE_STRIP,
183
184             /// <summary>
185             /// Individual triangles (made of 3 points each).
186             /// </summary>
187             TRIANGLES,
188
189             /// <summary>
190             /// A fan of triangles around a centre point (after the first triangle, following triangles need only 1 point).
191             /// </summary>
192             TRIANGLE_FAN,
193
194             /// <summary>
195             /// A strip of triangles (after the first triangle, following triangles need only 1 point).
196             /// </summary>
197             TRIANGLE_STRIP
198         }
199
200     }
201
202 }