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