[Tizen] Ensuring that Registry.Unregister is called from the most derived class befor...
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Renderer.cs
1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 *
15 */
16
17 namespace Tizen.NUI
18 {
19
20     public class Renderer : Animatable
21     {
22         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
23
24         internal Renderer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Renderer_SWIGUpcast(cPtr), cMemoryOwn)
25         {
26             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
27         }
28
29         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Renderer obj)
30         {
31             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
32         }
33
34         protected override void Dispose(DisposeTypes type)
35         {
36             if (disposed)
37             {
38                 return;
39             }
40
41             if (type == DisposeTypes.Explicit)
42             {
43                 //Called by User
44                 //Release your own managed resources here.
45                 //You should release all of your own disposable objects here.
46
47             }
48
49             //Release your own unmanaged resources here.
50             //You should not access any managed member here except static instance.
51             //because the execution order of Finalizes is non-deterministic.
52
53
54             if (swigCPtr.Handle != global::System.IntPtr.Zero)
55             {
56                 if (swigCMemOwn)
57                 {
58                     swigCMemOwn = false;
59
60                     //Unreference this instance from Registry.
61                     Registry.Unregister(this);
62
63                     NDalicPINVOKE.delete_Renderer(swigCPtr);
64                 }
65                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
66             }
67
68             base.Dispose(type);
69         }
70
71         public class Property
72         {
73             public static readonly int DEPTH_INDEX = NDalicPINVOKE.Renderer_Property_DEPTH_INDEX_get();
74             public static readonly int FACE_CULLING_MODE = NDalicPINVOKE.Renderer_Property_FACE_CULLING_MODE_get();
75             public static readonly int BLEND_MODE = NDalicPINVOKE.Renderer_Property_BLEND_MODE_get();
76             public static readonly int BLEND_EQUATION_RGB = NDalicPINVOKE.Renderer_Property_BLEND_EQUATION_RGB_get();
77             public static readonly int BLEND_EQUATION_ALPHA = NDalicPINVOKE.Renderer_Property_BLEND_EQUATION_ALPHA_get();
78             public static readonly int BLEND_FACTOR_SRC_RGB = NDalicPINVOKE.Renderer_Property_BLEND_FACTOR_SRC_RGB_get();
79             public static readonly int BLEND_FACTOR_DEST_RGB = NDalicPINVOKE.Renderer_Property_BLEND_FACTOR_DEST_RGB_get();
80             public static readonly int BLEND_FACTOR_SRC_ALPHA = NDalicPINVOKE.Renderer_Property_BLEND_FACTOR_SRC_ALPHA_get();
81             public static readonly int BLEND_FACTOR_DEST_ALPHA = NDalicPINVOKE.Renderer_Property_BLEND_FACTOR_DEST_ALPHA_get();
82             public static readonly int BLEND_COLOR = NDalicPINVOKE.Renderer_Property_BLEND_COLOR_get();
83             public static readonly int BLEND_PRE_MULTIPLIED_ALPHA = NDalicPINVOKE.Renderer_Property_BLEND_PRE_MULTIPLIED_ALPHA_get();
84             public static readonly int INDEX_RANGE_FIRST = NDalicPINVOKE.Renderer_Property_INDEX_RANGE_FIRST_get();
85             public static readonly int INDEX_RANGE_COUNT = NDalicPINVOKE.Renderer_Property_INDEX_RANGE_COUNT_get();
86             public static readonly int DEPTH_WRITE_MODE = NDalicPINVOKE.Renderer_Property_DEPTH_WRITE_MODE_get();
87             public static readonly int DEPTH_FUNCTION = NDalicPINVOKE.Renderer_Property_DEPTH_FUNCTION_get();
88             public static readonly int DEPTH_TEST_MODE = NDalicPINVOKE.Renderer_Property_DEPTH_TEST_MODE_get();
89             public static readonly int RENDER_MODE = NDalicPINVOKE.Renderer_Property_RENDER_MODE_get();
90             public static readonly int STENCIL_FUNCTION = NDalicPINVOKE.Renderer_Property_STENCIL_FUNCTION_get();
91             public static readonly int STENCIL_FUNCTION_MASK = NDalicPINVOKE.Renderer_Property_STENCIL_FUNCTION_MASK_get();
92             public static readonly int STENCIL_FUNCTION_REFERENCE = NDalicPINVOKE.Renderer_Property_STENCIL_FUNCTION_REFERENCE_get();
93             public static readonly int STENCIL_MASK = NDalicPINVOKE.Renderer_Property_STENCIL_MASK_get();
94             public static readonly int STENCIL_OPERATION_ON_FAIL = NDalicPINVOKE.Renderer_Property_STENCIL_OPERATION_ON_FAIL_get();
95             public static readonly int STENCIL_OPERATION_ON_Z_FAIL = NDalicPINVOKE.Renderer_Property_STENCIL_OPERATION_ON_Z_FAIL_get();
96             public static readonly int STENCIL_OPERATION_ON_Z_PASS = NDalicPINVOKE.Renderer_Property_STENCIL_OPERATION_ON_Z_PASS_get();
97
98         }
99
100         public Renderer(Geometry geometry, Shader shader) : this(NDalicPINVOKE.Renderer_New(Geometry.getCPtr(geometry), Shader.getCPtr(shader)), true)
101         {
102             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
103
104         }
105
106         public void SetGeometry(Geometry geometry)
107         {
108             NDalicPINVOKE.Renderer_SetGeometry(swigCPtr, Geometry.getCPtr(geometry));
109             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
110         }
111
112         public Geometry GetGeometry()
113         {
114             Geometry ret = new Geometry(NDalicPINVOKE.Renderer_GetGeometry(swigCPtr), true);
115             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
116             return ret;
117         }
118
119         public void SetIndexRange(int firstElement, int elementsCount)
120         {
121             NDalicPINVOKE.Renderer_SetIndexRange(swigCPtr, firstElement, elementsCount);
122             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
123         }
124
125         public void SetTextures(TextureSet textureSet)
126         {
127             NDalicPINVOKE.Renderer_SetTextures(swigCPtr, TextureSet.getCPtr(textureSet));
128             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
129         }
130
131         public TextureSet GetTextures()
132         {
133             TextureSet ret = new TextureSet(NDalicPINVOKE.Renderer_GetTextures(swigCPtr), true);
134             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
135             return ret;
136         }
137
138         public void SetShader(Shader shader)
139         {
140             NDalicPINVOKE.Renderer_SetShader(swigCPtr, Shader.getCPtr(shader));
141             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
142         }
143
144         public Shader GetShader()
145         {
146             Shader ret = new Shader(NDalicPINVOKE.Renderer_GetShader(swigCPtr), true);
147             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
148             return ret;
149         }
150
151         public int DepthIndex
152         {
153             get
154             {
155                 int temp = 0;
156                 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.DEPTH_INDEX).Get(out temp);
157                 return temp;
158             }
159             set
160             {
161                 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.DEPTH_INDEX, new Tizen.NUI.PropertyValue(value));
162             }
163         }
164         public int FaceCullingMode
165         {
166             get
167             {
168                 int temp = 0;
169                 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.FACE_CULLING_MODE).Get(out temp);
170                 return temp;
171             }
172             set
173             {
174                 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.FACE_CULLING_MODE, new Tizen.NUI.PropertyValue(value));
175             }
176         }
177         public int BlendMode
178         {
179             get
180             {
181                 int temp = 0;
182                 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_MODE).Get(out temp);
183                 return temp;
184             }
185             set
186             {
187                 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_MODE, new Tizen.NUI.PropertyValue(value));
188             }
189         }
190         public int BlendEquationRgb
191         {
192             get
193             {
194                 int temp = 0;
195                 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_EQUATION_RGB).Get(out temp);
196                 return temp;
197             }
198             set
199             {
200                 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_EQUATION_RGB, new Tizen.NUI.PropertyValue(value));
201             }
202         }
203         public int BlendEquationAlpha
204         {
205             get
206             {
207                 int temp = 0;
208                 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_EQUATION_ALPHA).Get(out temp);
209                 return temp;
210             }
211             set
212             {
213                 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_EQUATION_ALPHA, new Tizen.NUI.PropertyValue(value));
214             }
215         }
216         public int BlendFactorSrcRgb
217         {
218             get
219             {
220                 int temp = 0;
221                 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_SRC_RGB).Get(out temp);
222                 return temp;
223             }
224             set
225             {
226                 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_SRC_RGB, new Tizen.NUI.PropertyValue(value));
227             }
228         }
229         public int BlendFactorDestRgb
230         {
231             get
232             {
233                 int temp = 0;
234                 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_DEST_RGB).Get(out temp);
235                 return temp;
236             }
237             set
238             {
239                 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_DEST_RGB, new Tizen.NUI.PropertyValue(value));
240             }
241         }
242         public int BlendFactorSrcAlpha
243         {
244             get
245             {
246                 int temp = 0;
247                 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_SRC_ALPHA).Get(out temp);
248                 return temp;
249             }
250             set
251             {
252                 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_SRC_ALPHA, new Tizen.NUI.PropertyValue(value));
253             }
254         }
255         public int BlendFactorDestAlpha
256         {
257             get
258             {
259                 int temp = 0;
260                 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_DEST_ALPHA).Get(out temp);
261                 return temp;
262             }
263             set
264             {
265                 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_DEST_ALPHA, new Tizen.NUI.PropertyValue(value));
266             }
267         }
268         public Vector4 BlendColor
269         {
270             get
271             {
272                 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
273                 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_COLOR).Get(temp);
274                 return temp;
275             }
276             set
277             {
278                 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_COLOR, new Tizen.NUI.PropertyValue(value));
279             }
280         }
281         public bool BlendPreMultipliedAlpha
282         {
283             get
284             {
285                 bool temp = false;
286                 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_PRE_MULTIPLIED_ALPHA).Get(out temp);
287                 return temp;
288             }
289             set
290             {
291                 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_PRE_MULTIPLIED_ALPHA, new Tizen.NUI.PropertyValue(value));
292             }
293         }
294         public int IndexRangeFirst
295         {
296             get
297             {
298                 int temp = 0;
299                 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.INDEX_RANGE_FIRST).Get(out temp);
300                 return temp;
301             }
302             set
303             {
304                 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.INDEX_RANGE_FIRST, new Tizen.NUI.PropertyValue(value));
305             }
306         }
307         public int IndexRangeCount
308         {
309             get
310             {
311                 int temp = 0;
312                 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.INDEX_RANGE_COUNT).Get(out temp);
313                 return temp;
314             }
315             set
316             {
317                 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.INDEX_RANGE_COUNT, new Tizen.NUI.PropertyValue(value));
318             }
319         }
320         public int DepthWriteMode
321         {
322             get
323             {
324                 int temp = 0;
325                 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.DEPTH_WRITE_MODE).Get(out temp);
326                 return temp;
327             }
328             set
329             {
330                 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.DEPTH_WRITE_MODE, new Tizen.NUI.PropertyValue(value));
331             }
332         }
333         public int DepthFunction
334         {
335             get
336             {
337                 int temp = 0;
338                 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.DEPTH_FUNCTION).Get(out temp);
339                 return temp;
340             }
341             set
342             {
343                 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.DEPTH_FUNCTION, new Tizen.NUI.PropertyValue(value));
344             }
345         }
346         public int DepthTestMode
347         {
348             get
349             {
350                 int temp = 0;
351                 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.DEPTH_TEST_MODE).Get(out temp);
352                 return temp;
353             }
354             set
355             {
356                 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.DEPTH_TEST_MODE, new Tizen.NUI.PropertyValue(value));
357             }
358         }
359         public int RenderMode
360         {
361             get
362             {
363                 int temp = 0;
364                 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.RENDER_MODE).Get(out temp);
365                 return temp;
366             }
367             set
368             {
369                 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.RENDER_MODE, new Tizen.NUI.PropertyValue(value));
370             }
371         }
372         public int StencilFunction
373         {
374             get
375             {
376                 int temp = 0;
377                 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_FUNCTION).Get(out temp);
378                 return temp;
379             }
380             set
381             {
382                 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_FUNCTION, new Tizen.NUI.PropertyValue(value));
383             }
384         }
385         public int StencilFunctionMask
386         {
387             get
388             {
389                 int temp = 0;
390                 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_FUNCTION_MASK).Get(out temp);
391                 return temp;
392             }
393             set
394             {
395                 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_FUNCTION_MASK, new Tizen.NUI.PropertyValue(value));
396             }
397         }
398         public int StencilFunctionReference
399         {
400             get
401             {
402                 int temp = 0;
403                 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_FUNCTION_REFERENCE).Get(out temp);
404                 return temp;
405             }
406             set
407             {
408                 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_FUNCTION_REFERENCE, new Tizen.NUI.PropertyValue(value));
409             }
410         }
411         public int StencilMask
412         {
413             get
414             {
415                 int temp = 0;
416                 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_MASK).Get(out temp);
417                 return temp;
418             }
419             set
420             {
421                 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_MASK, new Tizen.NUI.PropertyValue(value));
422             }
423         }
424         public int StencilOperationOnFail
425         {
426             get
427             {
428                 int temp = 0;
429                 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_OPERATION_ON_FAIL).Get(out temp);
430                 return temp;
431             }
432             set
433             {
434                 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_OPERATION_ON_FAIL, new Tizen.NUI.PropertyValue(value));
435             }
436         }
437         public int StencilOperationOnZFail
438         {
439             get
440             {
441                 int temp = 0;
442                 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_OPERATION_ON_Z_FAIL).Get(out temp);
443                 return temp;
444             }
445             set
446             {
447                 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_OPERATION_ON_Z_FAIL, new Tizen.NUI.PropertyValue(value));
448             }
449         }
450         public int StencilOperationOnZPass
451         {
452             get
453             {
454                 int temp = 0;
455                 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_OPERATION_ON_Z_PASS).Get(out temp);
456                 return temp;
457             }
458             set
459             {
460                 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_OPERATION_ON_Z_PASS, new Tizen.NUI.PropertyValue(value));
461             }
462         }
463
464     }
465
466 }