[NUI] Integration from dalihub (DALi 1.4.34) (#999)
[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;
18 using System.ComponentModel;
19
20 namespace Tizen.NUI
21 {
22     /// <summary>
23     /// Shader.
24     /// </summary>
25     /// <since_tizen> 3 </since_tizen>
26     public class Shader : Animatable
27     {
28         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
29
30         /// <summary>
31         /// Creates Shader object.
32         /// </summary>
33         /// <param name="vertexShader">The vertex shader code for the effect.</param>
34         /// <param name="fragmentShader">The fragment Shader code for the effect.</param>
35         /// <param name="hints">The hints to define the geometry of the rendered object.</param>
36         /// <since_tizen> 3 </since_tizen>
37         public Shader(string vertexShader, string fragmentShader, Shader.Hint.Value hints) : this(Interop.Shader.Shader_New__SWIG_0(vertexShader, fragmentShader, (int)hints), true)
38         {
39             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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(Interop.Shader.Shader_New__SWIG_1(vertexShader, fragmentShader), true)
49         {
50             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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(Interop.Shader.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             //Release your own unmanaged resources here.
93             //You should not access any managed member here except static instance.
94             //because the execution order of Finalizes is non-deterministic.
95
96             if (swigCPtr.Handle != global::System.IntPtr.Zero)
97             {
98                 if (swigCMemOwn)
99                 {
100                     swigCMemOwn = false;
101                     Interop.Shader.delete_Shader(swigCPtr);
102                 }
103                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
104             }
105
106             base.Dispose(type);
107         }
108
109         /// <summary>
110         /// Hint.
111         /// </summary>
112         /// <since_tizen> 3 </since_tizen>
113         public class Hint
114         {
115             /// <summary>
116             /// Enumeration for the hint value.
117             /// </summary>
118             /// <since_tizen> 3 </since_tizen>
119             public enum Value
120             {
121                 /// <summary>
122                 /// No hints.
123                 /// </summary>
124                 /// <since_tizen> 3 </since_tizen>
125                 NONE = 0x00,
126
127                 /// <summary>
128                 /// Might generate transparent alpha from opaque inputs
129                 /// </summary>
130                 /// <since_tizen> 3 </since_tizen>
131                 OUTPUT_IS_TRANSPARENT = 0x01,
132
133                 /// <summary>
134                 /// Might change position of vertices, this option disables any culling optimizations
135                 /// </summary>
136                 /// <since_tizen> 3 </since_tizen>
137                 MODIFIES_GEOMETRY = 0x02
138             }
139         }
140
141         /// <summary>
142         /// Enumeration for instances of properties belonging to the Shader class.
143         /// </summary>
144         /// <since_tizen> 3 </since_tizen>
145         [EditorBrowsable(EditorBrowsableState.Never)]
146         [Obsolete("Deprecated in API6; Will be removed in API9.")]
147         public class Property
148         {
149             /// <summary>
150             /// The default value is empty.
151             /// Format: {"vertex":"","fragment":"",hints:"","vertexPrefix":"","fragmentPrefix":""}
152             /// </summary>
153             /// <since_tizen> 3 </since_tizen>
154             [EditorBrowsable(EditorBrowsableState.Never)]
155             [Obsolete("Deprecated in API6; Will be removed in API9.")]
156             public static readonly int PROGRAM = Interop.Shader.Shader_Property_PROGRAM_get();
157         }
158     }
159 }