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