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