Add tag and document to Tizen.NUI.
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / TextureSet.cs
1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 *
15 */
16
17 namespace Tizen.NUI
18 {
19     /// <summary>
20     /// TextureSet is a handle to an object that specifies the set of images used as textures by a renderer.<br>
21     /// The images have to be ordered in the same order they are declared in the shader.
22     /// </summary>
23     public class TextureSet : BaseHandle
24     {
25         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
26
27         internal TextureSet(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.TextureSet_SWIGUpcast(cPtr), cMemoryOwn)
28         {
29             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
30         }
31
32         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextureSet obj)
33         {
34             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
35         }
36
37         protected override void Dispose(DisposeTypes type)
38         {
39             if (disposed)
40             {
41                 return;
42             }
43
44             if (type == DisposeTypes.Explicit)
45             {
46                 //Called by User
47                 //Release your own managed resources here.
48                 //You should release all of your own disposable objects here.
49
50             }
51
52             //Release your own unmanaged resources here.
53             //You should not access any managed member here except static instance.
54             //because the execution order of Finalizes is non-deterministic.
55
56             if (swigCPtr.Handle != global::System.IntPtr.Zero)
57             {
58                 if (swigCMemOwn)
59                 {
60                     swigCMemOwn = false;
61                     NDalicPINVOKE.delete_TextureSet(swigCPtr);
62                 }
63                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
64             }
65
66             base.Dispose(type);
67         }
68
69         /// <summary>
70         /// Create an instance of TextureSet.
71         /// </summary>
72         /// <since_tizen> 3 </since_tizen>
73         public TextureSet() : this(NDalicPINVOKE.TextureSet_New(), true)
74         {
75             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
76
77         }
78
79         /// <summary>
80         /// Sets the texture at position "index".
81         /// </summary>
82         /// <param name="index">The position in the texture set of the texture.</param>
83         /// <param name="texture">The texture.</param>
84         /// <since_tizen> 3 </since_tizen>
85         public void SetTexture(uint index, Texture texture)
86         {
87             NDalicPINVOKE.TextureSet_SetTexture(swigCPtr, index, Texture.getCPtr(texture));
88             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
89         }
90
91         /// <summary>
92         /// Gets the image at position "index".
93         /// </summary>
94         /// <param name="index">The position in the texture set of the image.</param>
95         /// <returns>A handle to the image at the the specified position.</returns>
96         /// <since_tizen> 3 </since_tizen>
97         public Texture GetTexture(uint index)
98         {
99             System.IntPtr cPtr = NDalicPINVOKE.TextureSet_GetTexture(swigCPtr, index);
100             Texture ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Texture;
101
102             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
103             return ret;
104         }
105
106         /// <summary>
107         /// Sets the sampler to be used by the image at position "index".
108         /// </summary>
109         /// <param name="index">The position in the texture set of the image.</param>
110         /// <param name="sampler">The sampler to use.</param>
111         /// <since_tizen> 3 </since_tizen>
112         public void SetSampler(uint index, Sampler sampler)
113         {
114             NDalicPINVOKE.TextureSet_SetSampler(swigCPtr, index, Sampler.getCPtr(sampler));
115             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
116         }
117
118         /// <summary>
119         /// Sets the sampler to be used by the image at position "index".
120         /// </summary>
121         /// <param name="index">The position in the texture set of the image.</param>
122         /// <returns>A handle to the sampler at the specified position.</returns>
123         /// <since_tizen> 3 </since_tizen>
124         public Sampler GetSampler(uint index)
125         {
126             System.IntPtr cPtr = NDalicPINVOKE.TextureSet_GetSampler(swigCPtr, index);
127             Sampler ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Sampler;
128
129             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
130             return ret;
131         }
132
133         /// <summary>
134         /// Gets the number of textures present in the TextureSet.
135         /// </summary>
136         /// <returns>The number of textures in the TextureSet.</returns>
137         /// <since_tizen> 3 </since_tizen>
138         public uint GetTextureCount()
139         {
140             uint ret = NDalicPINVOKE.TextureSet_GetTextureCount(swigCPtr);
141             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
142             return ret;
143         }
144
145     }
146
147 }