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