[NUI] Fix ABI break (#731)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Shader.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     /// Shader.
23     /// </summary>
24     /// <since_tizen> 3 </since_tizen>
25     public class Shader : Animatable
26     {
27         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
28
29         /// <summary>
30         /// Creates Shader object.
31         /// </summary>
32         /// <param name="vertexShader">The vertex shader code for the effect.</param>
33         /// <param name="fragmentShader">The fragment Shader code for the effect.</param>
34         /// <param name="hints">The hints to define the geometry of the rendered object.</param>
35         /// <since_tizen> 3 </since_tizen>
36         public Shader(string vertexShader, string fragmentShader, Shader.Hint.Value hints) : this(NDalicPINVOKE.Shader_New__SWIG_0(vertexShader, fragmentShader, (int)hints), true)
37         {
38             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
39
40         }
41
42         /// <summary>
43         /// Creates Shader object.
44         /// </summary>
45         /// <param name="vertexShader">The vertex shader code for the effect.</param>
46         /// <param name="fragmentShader">The fragment Shader code for the effect.</param>
47         /// <since_tizen> 3 </since_tizen>
48         public Shader(string vertexShader, string fragmentShader) : this(NDalicPINVOKE.Shader_New__SWIG_1(vertexShader, fragmentShader), true)
49         {
50             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
51
52         }
53
54         /// <summary>
55         /// Gets and Sets the program property.
56         /// </summary>
57         /// <since_tizen> 3 </since_tizen>
58         public Tizen.NUI.PropertyMap Program
59         {
60             get
61             {
62                 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
63                 Tizen.NUI.Object.GetProperty(swigCPtr, Shader.Property.PROGRAM).Get(temp);
64                 return temp;
65             }
66             set
67             {
68                 Tizen.NUI.Object.SetProperty(swigCPtr, Shader.Property.PROGRAM, new Tizen.NUI.PropertyValue(value));
69             }
70         }
71
72         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Shader obj)
73         {
74             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
75         }
76
77         internal Shader(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Shader_SWIGUpcast(cPtr), cMemoryOwn)
78         {
79             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
80         }
81
82         /// <summary>
83         /// Dispose.
84         /// </summary>
85         /// <since_tizen> 3 </since_tizen>
86         protected override void Dispose(DisposeTypes type)
87         {
88             if (disposed)
89             {
90                 return;
91             }
92
93             if (type == DisposeTypes.Explicit)
94             {
95                 //Called by User
96                 //Release your own managed resources here.
97                 //You should release all of your own disposable objects here.
98
99             }
100
101             //Release your own unmanaged resources here.
102             //You should not access any managed member here except static instance.
103             //because the execution order of Finalizes is non-deterministic.
104
105             if (swigCPtr.Handle != global::System.IntPtr.Zero)
106             {
107                 if (swigCMemOwn)
108                 {
109                     swigCMemOwn = false;
110                     NDalicPINVOKE.delete_Shader(swigCPtr);
111                 }
112                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
113             }
114
115             base.Dispose(type);
116         }
117
118         /// <summary>
119         /// Hint.
120         /// </summary>
121         /// <since_tizen> 3 </since_tizen>
122         public class Hint
123         {
124             /// <summary>
125             /// Enumeration for the hint value.
126             /// </summary>
127             /// <since_tizen> 3 </since_tizen>
128             public enum Value
129             {
130                 /// <summary>
131                 /// No hints.
132                 /// </summary>
133                 /// <since_tizen> 3 </since_tizen>
134                 NONE = 0x00,
135
136                 /// <summary>
137                 /// Might generate transparent alpha from opaque inputs
138                 /// </summary>
139                 /// <since_tizen> 3 </since_tizen>
140                 OUTPUT_IS_TRANSPARENT = 0x01,
141
142                 /// <summary>
143                 /// Might change position of vertices, this option disables any culling optimizations
144                 /// </summary>
145                 /// <since_tizen> 3 </since_tizen>
146                 MODIFIES_GEOMETRY = 0x02
147             }
148         }
149
150         /// <summary>
151         /// Enumeration for instances of properties belonging to the Shader class.
152         /// </summary>
153         /// <since_tizen> 3 </since_tizen>
154         public class Property
155         {
156             /// <summary>
157             /// The default value is empty.
158             /// Format: {"vertex":"","fragment":"",hints:"","vertexPrefix":"","fragmentPrefix":""}
159             /// </summary>
160             /// <since_tizen> 3 </since_tizen>
161             public static readonly int PROGRAM = NDalicPINVOKE.Shader_Property_PROGRAM_get();
162         }
163
164     }
165 }