[NUI] Fixing the emtpy finalizers(CA1821)
[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.Diagnostics.CodeAnalysis;
19 using System.ComponentModel;
20
21 namespace Tizen.NUI
22 {
23     /// <summary>
24     /// Shader.
25     /// </summary>
26     /// <since_tizen> 3 </since_tizen>
27     public class Shader : Animatable
28     {
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.New(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.New(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.Upcast(cPtr), cMemoryOwn)
77         {
78         }
79
80         /// This will not be public opened.
81         [EditorBrowsable(EditorBrowsableState.Never)]
82         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
83         {
84             Interop.Shader.DeleteShader(swigCPtr);
85         }
86
87         /// <summary>
88         /// Hint.
89         /// </summary>
90         /// <since_tizen> 3 </since_tizen>
91         public sealed class Hint
92         {
93             /// <summary>
94             /// Enumeration for the hint value.
95             /// </summary>
96             /// <since_tizen> 3 </since_tizen>
97             public enum Value
98             {
99                 /// <summary>
100                 /// No hints.
101                 /// </summary>
102                 /// <since_tizen> 3 </since_tizen>
103                 NONE = 0x00,
104
105                 /// <summary>
106                 /// Might generate transparent alpha from opaque inputs
107                 /// </summary>
108                 /// <since_tizen> 3 </since_tizen>
109                 OUTPUT_IS_TRANSPARENT = 0x01,
110
111                 /// <summary>
112                 /// Might change position of vertices, this option disables any culling optimizations
113                 /// </summary>
114                 /// <since_tizen> 3 </since_tizen>
115                 MODIFIES_GEOMETRY = 0x02
116             }
117         }
118
119         /// <summary>
120         /// Enumeration for instances of properties belonging to the Shader class.
121         /// </summary>
122         /// <since_tizen> 3 </since_tizen>
123         [EditorBrowsable(EditorBrowsableState.Never)]
124         [Obsolete("Deprecated in API6; Will be removed in API9.")]
125 #pragma warning disable CA1716, CA1052, CA1034 // Identifiers should not match keywords
126         public class Property
127 #pragma warning restore CA1716, CA1052, CA1034 // Identifiers should not match keywords
128         {
129             /// <summary>
130             /// The default value is empty.
131             /// Format: {"vertex":"","fragment":"",hints:"","vertexPrefix":"","fragmentPrefix":""}
132             /// </summary>
133             /// <since_tizen> 3 </since_tizen>
134             [EditorBrowsable(EditorBrowsableState.Never)]
135             [Obsolete("Deprecated in API6; Will be removed in API9.")]
136             public static readonly int PROGRAM = Interop.Shader.ProgramGet();
137         }
138     }
139 }