[NUI] Fixing the emtpy finalizers(CA1821)
[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 using System.ComponentModel;
18
19 namespace Tizen.NUI
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
28         /// <summary>
29         /// Create an instance of Geometry.
30         /// </summary>
31         /// <since_tizen> 3 </since_tizen>
32         public Geometry() : this(Interop.Geometry.New(), true)
33         {
34             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
35
36         }
37
38         internal Geometry(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.Geometry.Upcast(cPtr), cMemoryOwn)
39         {
40         }
41
42         /// <summary>
43         /// Enumeration for the description of the type of geometry,
44         /// used to determine how the coordinates will be used.
45         /// </summary>
46         /// <returns>Type of primitives this geometry contains.</returns>
47         /// <since_tizen> 3 </since_tizen>
48         public enum Type
49         {
50             /// <summary>
51             /// Individual points.
52             /// </summary>
53             POINTS,
54
55             /// <summary>
56             /// Individual lines (made of 2 points each).
57             /// </summary>
58             LINES,
59
60             /// <summary>
61             /// A strip of lines (made of 1 point each) which also joins the first and last point.
62             /// </summary>
63             LINE_LOOP,
64
65             /// <summary>
66             /// A strip of lines (made of 1 point each).
67             /// </summary>
68             LINE_STRIP,
69
70             /// <summary>
71             /// Individual triangles (made of 3 points each).
72             /// </summary>
73             TRIANGLES,
74
75             /// <summary>
76             /// A fan of triangles around a centre point (after the first triangle, following triangles need only 1 point).
77             /// </summary>
78             TRIANGLE_FAN,
79
80             /// <summary>
81             /// A strip of triangles (after the first triangle, following triangles need only 1 point).
82             /// </summary>
83             TRIANGLE_STRIP
84         }
85
86         /// <summary>
87         /// Adds a PropertyBuffer to be used as source of geometry vertices.
88         /// </summary>
89         /// <param name="vertexBuffer">PropertyBuffer to be used as source of geometry vertices.</param>
90         /// <returns>Index of the newly added buffer.</returns>
91         /// <since_tizen> 3 </since_tizen>
92         public uint AddVertexBuffer(PropertyBuffer vertexBuffer)
93         {
94             uint ret = Interop.Geometry.AddVertexBuffer(SwigCPtr, PropertyBuffer.getCPtr(vertexBuffer));
95             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
96             return ret;
97         }
98
99         /// <summary>
100         /// Adds a VertexBuffer to be used as source of geometry vertices.
101         /// </summary>
102         /// <param name="vertexBuffer">VertexBuffer to be used as source of geometry vertices.</param>
103         /// <returns>Index of the newly added buffer.</returns>
104         /// <since_tizen> 8 </since_tizen>
105         public uint AddVertexBuffer(VertexBuffer vertexBuffer)
106         {
107             uint ret = Interop.Geometry.AddVertexBuffer(SwigCPtr, VertexBuffer.getCPtr(vertexBuffer));
108             if (NDalicPINVOKE.SWIGPendingException.Pending)
109                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
110             return ret;
111         }
112
113         /// <summary>
114         /// Retrieves the number of vertex buffers that have been added to this geometry.
115         /// </summary>
116         /// <returns>Number of vertex buffers that have been added to this geometry.</returns>
117         /// <since_tizen> 3 </since_tizen>
118         public uint GetNumberOfVertexBuffers()
119         {
120             uint ret = Interop.Geometry.GetNumberOfVertexBuffers(SwigCPtr);
121             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
122             return ret;
123         }
124
125         /// <summary>
126         /// Removes a vertex buffer.
127         /// </summary>
128         /// <param name="index">Index to the vertex buffer to remove.</param>
129         /// <since_tizen> 3 </since_tizen>
130         public void RemoveVertexBuffer(uint index)
131         {
132             Interop.Geometry.RemoveVertexBuffer(SwigCPtr, index);
133             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
134         }
135
136         /// <summary>
137         /// Sets a the index data to be used as a source of indices for the geometry
138         /// Setting this buffer will cause the geometry to be rendered using indices.
139         /// </summary>
140         /// <param name="indices">Array of indices.</param>
141         /// <param name="count">Number of indices in the array.</param>
142         /// <since_tizen> 3 </since_tizen>
143         public void SetIndexBuffer(ushort[] indices, uint count)
144         {
145             Interop.Geometry.SetIndexBuffer(SwigCPtr, indices, count);
146             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
147         }
148
149         /// <summary>
150         /// Sets the type of primitives this geometry contains.
151         /// </summary>
152         /// <param name="geometryType">Array of indices.</param>
153         /// <since_tizen> 3 </since_tizen>
154         public void SetType(Geometry.Type geometryType)
155         {
156             Interop.Geometry.SetType(SwigCPtr, (int)geometryType);
157             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
158         }
159
160         /// <summary>
161         /// Gets the type of primitives this geometry contains.
162         /// </summary>
163         /// <returns>Type of primitives this geometry contains.</returns>
164         /// <since_tizen> 3 </since_tizen>
165         public new Geometry.Type GetType()
166         {
167             Geometry.Type ret = (Geometry.Type)Interop.Geometry.GetType(SwigCPtr);
168             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
169             return ret;
170         }
171
172         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Geometry obj)
173         {
174             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
175         }
176
177         /// This will not be public opened.
178         [EditorBrowsable(EditorBrowsableState.Never)]
179         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
180         {
181             Interop.Geometry.DeleteGeometry(swigCPtr);
182         }
183     }
184 }