2 * Copyright(c) 2017 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 using System.Runtime.InteropServices;
23 /// Renderer is a handle to an object used to show content by combining a Geometry, a TextureSet and a shader.
25 /// <since_tizen> 3 </since_tizen>
26 public class Renderer : Animatable
28 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
30 internal Renderer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Renderer_SWIGUpcast(cPtr), cMemoryOwn)
32 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
35 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Renderer obj)
37 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
43 /// <since_tizen> 3 </since_tizen>
44 protected override void Dispose(DisposeTypes type)
51 if (type == DisposeTypes.Explicit)
54 //Release your own managed resources here.
55 //You should release all of your own disposable objects here.
59 //Release your own unmanaged resources here.
60 //You should not access any managed member here except static instance.
61 //because the execution order of Finalizes is non-deterministic.
64 if (swigCPtr.Handle != global::System.IntPtr.Zero)
69 NDalicPINVOKE.delete_Renderer(swigCPtr);
71 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
78 /// Enumeration for instances of properties belonging to the Renderer class.
80 /// <since_tizen> 3 </since_tizen>
84 /// This should be internal, please do not use.
86 /// <since_tizen> 3 </since_tizen>
87 public static readonly int DEPTH_INDEX = NDalicPINVOKE.Renderer_Property_DEPTH_INDEX_get();
89 /// This should be internal, please do not use.
91 /// <since_tizen> 3 </since_tizen>
92 public static readonly int FACE_CULLING_MODE = NDalicPINVOKE.Renderer_Property_FACE_CULLING_MODE_get();
94 /// This should be internal, please do not use.
96 /// <since_tizen> 3 </since_tizen>
97 public static readonly int BLEND_MODE = NDalicPINVOKE.Renderer_Property_BLEND_MODE_get();
99 /// This should be internal, please do not use.
101 /// <since_tizen> 3 </since_tizen>
102 public static readonly int BLEND_EQUATION_RGB = NDalicPINVOKE.Renderer_Property_BLEND_EQUATION_RGB_get();
104 /// This should be internal, please do not use.
106 /// <since_tizen> 3 </since_tizen>
107 public static readonly int BLEND_EQUATION_ALPHA = NDalicPINVOKE.Renderer_Property_BLEND_EQUATION_ALPHA_get();
109 /// This should be internal, please do not use.
111 /// <since_tizen> 3 </since_tizen>
112 public static readonly int BLEND_FACTOR_SRC_RGB = NDalicPINVOKE.Renderer_Property_BLEND_FACTOR_SRC_RGB_get();
114 /// This should be internal, please do not use.
116 /// <since_tizen> 3 </since_tizen>
117 public static readonly int BLEND_FACTOR_DEST_RGB = NDalicPINVOKE.Renderer_Property_BLEND_FACTOR_DEST_RGB_get();
119 /// This should be internal, please do not use.
121 /// <since_tizen> 3 </since_tizen>
122 public static readonly int BLEND_FACTOR_SRC_ALPHA = NDalicPINVOKE.Renderer_Property_BLEND_FACTOR_SRC_ALPHA_get();
124 /// This should be internal, please do not use.
126 /// <since_tizen> 3 </since_tizen>
127 public static readonly int BLEND_FACTOR_DEST_ALPHA = NDalicPINVOKE.Renderer_Property_BLEND_FACTOR_DEST_ALPHA_get();
129 /// This should be internal, please do not use.
131 /// <since_tizen> 3 </since_tizen>
132 public static readonly int BLEND_COLOR = NDalicPINVOKE.Renderer_Property_BLEND_COLOR_get();
134 /// This should be internal, please do not use.
136 /// <since_tizen> 3 </since_tizen>
137 public static readonly int BLEND_PRE_MULTIPLIED_ALPHA = NDalicPINVOKE.Renderer_Property_BLEND_PRE_MULTIPLIED_ALPHA_get();
139 /// This should be internal, please do not use.
141 /// <since_tizen> 3 </since_tizen>
142 public static readonly int INDEX_RANGE_FIRST = NDalicPINVOKE.Renderer_Property_INDEX_RANGE_FIRST_get();
144 /// This should be internal, please do not use.
146 /// <since_tizen> 3 </since_tizen>
147 public static readonly int INDEX_RANGE_COUNT = NDalicPINVOKE.Renderer_Property_INDEX_RANGE_COUNT_get();
149 /// This should be internal, please do not use.
151 /// <since_tizen> 3 </since_tizen>
152 public static readonly int DEPTH_WRITE_MODE = NDalicPINVOKE.Renderer_Property_DEPTH_WRITE_MODE_get();
154 /// This should be internal, please do not use.
156 /// <since_tizen> 3 </since_tizen>
157 public static readonly int DEPTH_FUNCTION = NDalicPINVOKE.Renderer_Property_DEPTH_FUNCTION_get();
159 /// This should be internal, please do not use.
161 /// <since_tizen> 3 </since_tizen>
162 public static readonly int DEPTH_TEST_MODE = NDalicPINVOKE.Renderer_Property_DEPTH_TEST_MODE_get();
164 /// This should be internal, please do not use.
166 /// <since_tizen> 3 </since_tizen>
167 public static readonly int RENDER_MODE = NDalicPINVOKE.Renderer_Property_RENDER_MODE_get();
169 /// This should be internal, please do not use.
171 /// <since_tizen> 3 </since_tizen>
172 public static readonly int STENCIL_FUNCTION = NDalicPINVOKE.Renderer_Property_STENCIL_FUNCTION_get();
174 /// This should be internal, please do not use.
176 /// <since_tizen> 3 </since_tizen>
177 public static readonly int STENCIL_FUNCTION_MASK = NDalicPINVOKE.Renderer_Property_STENCIL_FUNCTION_MASK_get();
179 /// This should be internal, please do not use.
181 /// <since_tizen> 3 </since_tizen>
182 public static readonly int STENCIL_FUNCTION_REFERENCE = NDalicPINVOKE.Renderer_Property_STENCIL_FUNCTION_REFERENCE_get();
184 /// This should be internal, please do not use.
186 /// <since_tizen> 3 </since_tizen>
187 public static readonly int STENCIL_MASK = NDalicPINVOKE.Renderer_Property_STENCIL_MASK_get();
189 /// This should be internal, please do not use.
191 /// <since_tizen> 3 </since_tizen>
192 public static readonly int STENCIL_OPERATION_ON_FAIL = NDalicPINVOKE.Renderer_Property_STENCIL_OPERATION_ON_FAIL_get();
194 /// This should be internal, please do not use.
196 /// <since_tizen> 3 </since_tizen>
197 public static readonly int STENCIL_OPERATION_ON_Z_FAIL = NDalicPINVOKE.Renderer_Property_STENCIL_OPERATION_ON_Z_FAIL_get();
199 /// This should be internal, please do not use.
201 /// <since_tizen> 3 </since_tizen>
202 public static readonly int STENCIL_OPERATION_ON_Z_PASS = NDalicPINVOKE.Renderer_Property_STENCIL_OPERATION_ON_Z_PASS_get();
207 /// Create an instance of Renderer.
209 /// <since_tizen> 3 </since_tizen>
210 public Renderer(Geometry geometry, Shader shader) : this(NDalicPINVOKE.Renderer_New(Geometry.getCPtr(geometry), Shader.getCPtr(shader)), true)
212 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
217 /// Sets the geometry to be used by this renderer.
219 /// <param name="geometry">The geometry to be used by this renderer.</param>
220 /// <since_tizen> 3 </since_tizen>
221 public void SetGeometry(Geometry geometry)
223 NDalicPINVOKE.Renderer_SetGeometry(swigCPtr, Geometry.getCPtr(geometry));
224 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
228 /// Gets the geometry used by this renderer.
230 /// <returns>The geometry used by the renderer.</returns>
231 /// <since_tizen> 3 </since_tizen>
232 public Geometry GetGeometry()
234 //to fix memory leak issue, match the handle count with native side.
235 System.IntPtr cPtr = NDalicPINVOKE.Renderer_GetGeometry(swigCPtr);
236 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
237 Geometry ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as Geometry;
238 NDalicPINVOKE.delete_BaseHandle(CPtr);
239 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
241 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
246 /// Sets effective range of indices to draw from bound index buffer.
248 /// <param name="firstElement">The First element to draw.</param>
249 /// <param name="elementsCount">The number of elements to draw.</param>
250 /// <since_tizen> 3 </since_tizen>
251 public void SetIndexRange(int firstElement, int elementsCount)
253 NDalicPINVOKE.Renderer_SetIndexRange(swigCPtr, firstElement, elementsCount);
254 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
258 /// Sets the texture set to be used by this renderer.
260 /// <param name="textureSet">The texture set to be used by this renderer.</param>
261 /// <since_tizen> 3 </since_tizen>
262 public void SetTextures(TextureSet textureSet)
264 NDalicPINVOKE.Renderer_SetTextures(swigCPtr, TextureSet.getCPtr(textureSet));
265 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
269 /// Gets the texture set used by this renderer.
271 /// <returns>The texture set used by the renderer.</returns>
272 /// <since_tizen> 3 </since_tizen>
273 public TextureSet GetTextures()
275 //to fix memory leak issue, match the handle count with native side.
276 System.IntPtr cPtr = NDalicPINVOKE.Renderer_GetTextures(swigCPtr);
277 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
278 TextureSet ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as TextureSet;
279 NDalicPINVOKE.delete_BaseHandle(CPtr);
280 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
282 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
287 /// Sets the shader used by this renderer.
289 /// <param name="shader">The shader to be used by this renderer.</param>
290 /// <since_tizen> 3 </since_tizen>
291 public void SetShader(Shader shader)
293 NDalicPINVOKE.Renderer_SetShader(swigCPtr, Shader.getCPtr(shader));
294 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
298 /// Gets the shader used by this renderer.
300 /// <returns>The shader used by the renderer.</returns>
301 /// <since_tizen> 3 </since_tizen>
302 public Shader GetShader()
304 //to fix memory leak issue, match the handle count with native side.
305 System.IntPtr cPtr = NDalicPINVOKE.Renderer_GetShader(swigCPtr);
306 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
307 Shader ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as Shader;
308 NDalicPINVOKE.delete_BaseHandle(CPtr);
309 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
311 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
316 /// Gets and Sets DepthIndex property.
318 /// <since_tizen> 3 </since_tizen>
319 public int DepthIndex
324 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.DEPTH_INDEX).Get(out temp);
329 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.DEPTH_INDEX, new Tizen.NUI.PropertyValue(value));
334 /// Gets and Sets FaceCullingMode.
336 /// <since_tizen> 3 </since_tizen>
337 public int FaceCullingMode
342 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.FACE_CULLING_MODE).Get(out temp);
347 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.FACE_CULLING_MODE, new Tizen.NUI.PropertyValue(value));
352 /// Gets and Sets BlendMode.
354 /// <since_tizen> 3 </since_tizen>
360 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_MODE).Get(out temp);
365 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_MODE, new Tizen.NUI.PropertyValue(value));
370 /// Gets and Sets BlendEquationRgb.
372 /// <since_tizen> 3 </since_tizen>
373 public int BlendEquationRgb
378 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_EQUATION_RGB).Get(out temp);
383 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_EQUATION_RGB, new Tizen.NUI.PropertyValue(value));
388 /// Gets and Sets BlendEquationAlpha.
390 /// <since_tizen> 3 </since_tizen>
391 public int BlendEquationAlpha
396 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_EQUATION_ALPHA).Get(out temp);
401 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_EQUATION_ALPHA, new Tizen.NUI.PropertyValue(value));
406 /// Gets and Sets BlendFactorSrcRgb.
408 /// <since_tizen> 3 </since_tizen>
409 public int BlendFactorSrcRgb
414 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_SRC_RGB).Get(out temp);
419 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_SRC_RGB, new Tizen.NUI.PropertyValue(value));
424 /// Gets and Sets BlendFactorDestRgb.
426 /// <since_tizen> 3 </since_tizen>
427 public int BlendFactorDestRgb
432 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_DEST_RGB).Get(out temp);
437 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_DEST_RGB, new Tizen.NUI.PropertyValue(value));
442 /// Gets and Sets BlendFactorSrcAlpha.
444 /// <since_tizen> 3 </since_tizen>
445 public int BlendFactorSrcAlpha
450 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_SRC_ALPHA).Get(out temp);
455 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_SRC_ALPHA, new Tizen.NUI.PropertyValue(value));
460 /// Gets and Sets BlendFactorDestAlpha.
462 /// <since_tizen> 3 </since_tizen>
463 public int BlendFactorDestAlpha
468 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_DEST_ALPHA).Get(out temp);
473 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_DEST_ALPHA, new Tizen.NUI.PropertyValue(value));
478 /// Gets and Sets BlendColor.
480 /// <since_tizen> 3 </since_tizen>
481 public Vector4 BlendColor
485 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
486 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_COLOR).Get(temp);
491 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_COLOR, new Tizen.NUI.PropertyValue(value));
496 /// Gets and Sets BlendPreMultipliedAlpha.
498 /// <since_tizen> 3 </since_tizen>
499 public bool BlendPreMultipliedAlpha
504 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_PRE_MULTIPLIED_ALPHA).Get(out temp);
509 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_PRE_MULTIPLIED_ALPHA, new Tizen.NUI.PropertyValue(value));
514 /// Gets and Sets IndexRangeFirst.
516 /// <since_tizen> 3 </since_tizen>
517 public int IndexRangeFirst
522 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.INDEX_RANGE_FIRST).Get(out temp);
527 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.INDEX_RANGE_FIRST, new Tizen.NUI.PropertyValue(value));
532 /// Gets and Sets IndexRangeCount.
534 /// <since_tizen> 3 </since_tizen>
535 public int IndexRangeCount
540 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.INDEX_RANGE_COUNT).Get(out temp);
545 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.INDEX_RANGE_COUNT, new Tizen.NUI.PropertyValue(value));
550 /// Gets and Sets DepthWriteMode.
552 /// <since_tizen> 3 </since_tizen>
553 public int DepthWriteMode
558 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.DEPTH_WRITE_MODE).Get(out temp);
563 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.DEPTH_WRITE_MODE, new Tizen.NUI.PropertyValue(value));
568 /// Gets and Sets DepthFunction.
570 /// <since_tizen> 3 </since_tizen>
571 public int DepthFunction
576 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.DEPTH_FUNCTION).Get(out temp);
581 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.DEPTH_FUNCTION, new Tizen.NUI.PropertyValue(value));
586 /// Gets and Sets DepthTestMode.
588 /// <since_tizen> 3 </since_tizen>
589 public int DepthTestMode
594 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.DEPTH_TEST_MODE).Get(out temp);
599 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.DEPTH_TEST_MODE, new Tizen.NUI.PropertyValue(value));
604 /// Gets and Sets RenderMode.
606 /// <since_tizen> 3 </since_tizen>
607 public int RenderMode
612 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.RENDER_MODE).Get(out temp);
617 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.RENDER_MODE, new Tizen.NUI.PropertyValue(value));
622 /// Gets and Sets StencilFunction.
624 /// <since_tizen> 3 </since_tizen>
625 public int StencilFunction
630 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_FUNCTION).Get(out temp);
635 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_FUNCTION, new Tizen.NUI.PropertyValue(value));
640 /// Gets and Sets StencilFunctionMask.
642 /// <since_tizen> 3 </since_tizen>
643 public int StencilFunctionMask
648 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_FUNCTION_MASK).Get(out temp);
653 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_FUNCTION_MASK, new Tizen.NUI.PropertyValue(value));
658 /// Gets and Sets StencilFunctionReference.
660 /// <since_tizen> 3 </since_tizen>
661 public int StencilFunctionReference
666 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_FUNCTION_REFERENCE).Get(out temp);
671 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_FUNCTION_REFERENCE, new Tizen.NUI.PropertyValue(value));
676 /// Gets and Sets StencilMask.
678 /// <since_tizen> 3 </since_tizen>
679 public int StencilMask
684 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_MASK).Get(out temp);
689 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_MASK, new Tizen.NUI.PropertyValue(value));
694 /// Gets and Sets StencilOperationOnFail.
696 /// <since_tizen> 3 </since_tizen>
697 public int StencilOperationOnFail
702 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_OPERATION_ON_FAIL).Get(out temp);
707 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_OPERATION_ON_FAIL, new Tizen.NUI.PropertyValue(value));
712 /// Gets and Sets StencilOperationOnZFail.
714 /// <since_tizen> 3 </since_tizen>
715 public int StencilOperationOnZFail
720 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_OPERATION_ON_Z_FAIL).Get(out temp);
725 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_OPERATION_ON_Z_FAIL, new Tizen.NUI.PropertyValue(value));
730 /// Gets and Sets StencilOperationOnZPass property.
732 /// <since_tizen> 3 </since_tizen>
733 public int StencilOperationOnZPass
738 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_OPERATION_ON_Z_PASS).Get(out temp);
743 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_OPERATION_ON_Z_PASS, new Tizen.NUI.PropertyValue(value));