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;
31 /// Create an instance of Renderer.
33 /// <since_tizen> 3 </since_tizen>
34 public Renderer(Geometry geometry, Shader shader) : this(NDalicPINVOKE.Renderer_New(Geometry.getCPtr(geometry), Shader.getCPtr(shader)), true)
36 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
41 /// Gets and Sets DepthIndex property.
43 /// <since_tizen> 3 </since_tizen>
49 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.DEPTH_INDEX).Get(out temp);
54 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.DEPTH_INDEX, new Tizen.NUI.PropertyValue(value));
59 /// Gets and Sets FaceCullingMode.
61 /// <since_tizen> 3 </since_tizen>
62 public int FaceCullingMode
67 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.FACE_CULLING_MODE).Get(out temp);
72 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.FACE_CULLING_MODE, new Tizen.NUI.PropertyValue(value));
77 /// Gets and Sets BlendMode.
79 /// <since_tizen> 3 </since_tizen>
85 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_MODE).Get(out temp);
90 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_MODE, new Tizen.NUI.PropertyValue(value));
95 /// Gets and Sets BlendEquationRgb.
97 /// <since_tizen> 3 </since_tizen>
98 public int BlendEquationRgb
103 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_EQUATION_RGB).Get(out temp);
108 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_EQUATION_RGB, new Tizen.NUI.PropertyValue(value));
113 /// Gets and Sets BlendEquationAlpha.
115 /// <since_tizen> 3 </since_tizen>
116 public int BlendEquationAlpha
121 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_EQUATION_ALPHA).Get(out temp);
126 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_EQUATION_ALPHA, new Tizen.NUI.PropertyValue(value));
131 /// Gets and Sets BlendFactorSrcRgb.
133 /// <since_tizen> 3 </since_tizen>
134 public int BlendFactorSrcRgb
139 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_SRC_RGB).Get(out temp);
144 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_SRC_RGB, new Tizen.NUI.PropertyValue(value));
149 /// Gets and Sets BlendFactorDestRgb.
151 /// <since_tizen> 3 </since_tizen>
152 public int BlendFactorDestRgb
157 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_DEST_RGB).Get(out temp);
162 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_DEST_RGB, new Tizen.NUI.PropertyValue(value));
167 /// Gets and Sets BlendFactorSrcAlpha.
169 /// <since_tizen> 3 </since_tizen>
170 public int BlendFactorSrcAlpha
175 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_SRC_ALPHA).Get(out temp);
180 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_SRC_ALPHA, new Tizen.NUI.PropertyValue(value));
185 /// Gets and Sets BlendFactorDestAlpha.
187 /// <since_tizen> 3 </since_tizen>
188 public int BlendFactorDestAlpha
193 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_DEST_ALPHA).Get(out temp);
198 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_DEST_ALPHA, new Tizen.NUI.PropertyValue(value));
203 /// Gets and Sets BlendColor.
205 /// <since_tizen> 3 </since_tizen>
206 public Vector4 BlendColor
210 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
211 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_COLOR).Get(temp);
216 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_COLOR, new Tizen.NUI.PropertyValue(value));
221 /// Gets and Sets BlendPreMultipliedAlpha.
223 /// <since_tizen> 3 </since_tizen>
224 public bool BlendPreMultipliedAlpha
229 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_PRE_MULTIPLIED_ALPHA).Get(out temp);
234 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_PRE_MULTIPLIED_ALPHA, new Tizen.NUI.PropertyValue(value));
239 /// Gets and Sets IndexRangeFirst.
241 /// <since_tizen> 3 </since_tizen>
242 public int IndexRangeFirst
247 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.INDEX_RANGE_FIRST).Get(out temp);
252 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.INDEX_RANGE_FIRST, new Tizen.NUI.PropertyValue(value));
257 /// Gets and Sets IndexRangeCount.
259 /// <since_tizen> 3 </since_tizen>
260 public int IndexRangeCount
265 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.INDEX_RANGE_COUNT).Get(out temp);
270 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.INDEX_RANGE_COUNT, new Tizen.NUI.PropertyValue(value));
275 /// Gets and Sets DepthWriteMode.
277 /// <since_tizen> 3 </since_tizen>
278 public int DepthWriteMode
283 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.DEPTH_WRITE_MODE).Get(out temp);
288 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.DEPTH_WRITE_MODE, new Tizen.NUI.PropertyValue(value));
293 /// Gets and Sets DepthFunction.
295 /// <since_tizen> 3 </since_tizen>
296 public int DepthFunction
301 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.DEPTH_FUNCTION).Get(out temp);
306 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.DEPTH_FUNCTION, new Tizen.NUI.PropertyValue(value));
311 /// Gets and Sets DepthTestMode.
313 /// <since_tizen> 3 </since_tizen>
314 public int DepthTestMode
319 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.DEPTH_TEST_MODE).Get(out temp);
324 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.DEPTH_TEST_MODE, new Tizen.NUI.PropertyValue(value));
329 /// Gets and Sets RenderMode.
331 /// <since_tizen> 3 </since_tizen>
332 public int RenderMode
337 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.RENDER_MODE).Get(out temp);
342 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.RENDER_MODE, new Tizen.NUI.PropertyValue(value));
347 /// Gets and Sets StencilFunction.
349 /// <since_tizen> 3 </since_tizen>
350 public int StencilFunction
355 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_FUNCTION).Get(out temp);
360 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_FUNCTION, new Tizen.NUI.PropertyValue(value));
365 /// Gets and Sets StencilFunctionMask.
367 /// <since_tizen> 3 </since_tizen>
368 public int StencilFunctionMask
373 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_FUNCTION_MASK).Get(out temp);
378 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_FUNCTION_MASK, new Tizen.NUI.PropertyValue(value));
383 /// Gets and Sets StencilFunctionReference.
385 /// <since_tizen> 3 </since_tizen>
386 public int StencilFunctionReference
391 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_FUNCTION_REFERENCE).Get(out temp);
396 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_FUNCTION_REFERENCE, new Tizen.NUI.PropertyValue(value));
401 /// Gets and Sets StencilMask.
403 /// <since_tizen> 3 </since_tizen>
404 public int StencilMask
409 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_MASK).Get(out temp);
414 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_MASK, new Tizen.NUI.PropertyValue(value));
419 /// Gets and Sets StencilOperationOnFail.
421 /// <since_tizen> 3 </since_tizen>
422 public int StencilOperationOnFail
427 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_OPERATION_ON_FAIL).Get(out temp);
432 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_OPERATION_ON_FAIL, new Tizen.NUI.PropertyValue(value));
437 /// Gets and Sets StencilOperationOnZFail.
439 /// <since_tizen> 3 </since_tizen>
440 public int StencilOperationOnZFail
445 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_OPERATION_ON_Z_FAIL).Get(out temp);
450 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_OPERATION_ON_Z_FAIL, new Tizen.NUI.PropertyValue(value));
455 /// Gets and Sets StencilOperationOnZPass property.
457 /// <since_tizen> 3 </since_tizen>
458 public int StencilOperationOnZPass
463 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_OPERATION_ON_Z_PASS).Get(out temp);
468 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_OPERATION_ON_Z_PASS, new Tizen.NUI.PropertyValue(value));
473 /// Sets the geometry to be used by this renderer.
475 /// <param name="geometry">The geometry to be used by this renderer.</param>
476 /// <since_tizen> 3 </since_tizen>
477 public void SetGeometry(Geometry geometry)
479 NDalicPINVOKE.Renderer_SetGeometry(swigCPtr, Geometry.getCPtr(geometry));
480 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
484 /// Gets the geometry used by this renderer.
486 /// <returns>The geometry used by the renderer.</returns>
487 /// <since_tizen> 3 </since_tizen>
488 public Geometry GetGeometry()
490 //to fix memory leak issue, match the handle count with native side.
491 System.IntPtr cPtr = NDalicPINVOKE.Renderer_GetGeometry(swigCPtr);
492 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
493 Geometry ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as Geometry;
494 NDalicPINVOKE.delete_BaseHandle(CPtr);
495 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
497 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
502 /// Sets effective range of indices to draw from bound index buffer.
504 /// <param name="firstElement">The First element to draw.</param>
505 /// <param name="elementsCount">The number of elements to draw.</param>
506 /// <since_tizen> 3 </since_tizen>
507 public void SetIndexRange(int firstElement, int elementsCount)
509 NDalicPINVOKE.Renderer_SetIndexRange(swigCPtr, firstElement, elementsCount);
510 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
514 /// Sets the texture set to be used by this renderer.
516 /// <param name="textureSet">The texture set to be used by this renderer.</param>
517 /// <since_tizen> 3 </since_tizen>
518 public void SetTextures(TextureSet textureSet)
520 NDalicPINVOKE.Renderer_SetTextures(swigCPtr, TextureSet.getCPtr(textureSet));
521 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
525 /// Gets the texture set used by this renderer.
527 /// <returns>The texture set used by the renderer.</returns>
528 /// <since_tizen> 3 </since_tizen>
529 public TextureSet GetTextures()
531 //to fix memory leak issue, match the handle count with native side.
532 System.IntPtr cPtr = NDalicPINVOKE.Renderer_GetTextures(swigCPtr);
533 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
534 TextureSet ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as TextureSet;
535 NDalicPINVOKE.delete_BaseHandle(CPtr);
536 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
538 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
543 /// Sets the shader used by this renderer.
545 /// <param name="shader">The shader to be used by this renderer.</param>
546 /// <since_tizen> 3 </since_tizen>
547 public void SetShader(Shader shader)
549 NDalicPINVOKE.Renderer_SetShader(swigCPtr, Shader.getCPtr(shader));
550 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
554 /// Gets the shader used by this renderer.
556 /// <returns>The shader used by the renderer.</returns>
557 /// <since_tizen> 3 </since_tizen>
558 public Shader GetShader()
560 //to fix memory leak issue, match the handle count with native side.
561 System.IntPtr cPtr = NDalicPINVOKE.Renderer_GetShader(swigCPtr);
562 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
563 Shader ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as Shader;
564 NDalicPINVOKE.delete_BaseHandle(CPtr);
565 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
567 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
571 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Renderer obj)
573 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
576 internal Renderer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Renderer_SWIGUpcast(cPtr), cMemoryOwn)
578 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
584 /// <since_tizen> 3 </since_tizen>
585 protected override void Dispose(DisposeTypes type)
592 if (type == DisposeTypes.Explicit)
595 //Release your own managed resources here.
596 //You should release all of your own disposable objects here.
600 //Release your own unmanaged resources here.
601 //You should not access any managed member here except static instance.
602 //because the execution order of Finalizes is non-deterministic.
605 if (swigCPtr.Handle != global::System.IntPtr.Zero)
610 NDalicPINVOKE.delete_Renderer(swigCPtr);
612 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
619 /// Enumeration for instances of properties belonging to the Renderer class.
621 /// <since_tizen> 3 </since_tizen>
622 public class Property
625 /// This should be internal, please do not use.
627 /// <since_tizen> 3 </since_tizen>
628 public static readonly int DEPTH_INDEX = NDalicPINVOKE.Renderer_Property_DEPTH_INDEX_get();
630 /// This should be internal, please do not use.
632 /// <since_tizen> 3 </since_tizen>
633 public static readonly int FACE_CULLING_MODE = NDalicPINVOKE.Renderer_Property_FACE_CULLING_MODE_get();
635 /// This should be internal, please do not use.
637 /// <since_tizen> 3 </since_tizen>
638 public static readonly int BLEND_MODE = NDalicPINVOKE.Renderer_Property_BLEND_MODE_get();
640 /// This should be internal, please do not use.
642 /// <since_tizen> 3 </since_tizen>
643 public static readonly int BLEND_EQUATION_RGB = NDalicPINVOKE.Renderer_Property_BLEND_EQUATION_RGB_get();
645 /// This should be internal, please do not use.
647 /// <since_tizen> 3 </since_tizen>
648 public static readonly int BLEND_EQUATION_ALPHA = NDalicPINVOKE.Renderer_Property_BLEND_EQUATION_ALPHA_get();
650 /// This should be internal, please do not use.
652 /// <since_tizen> 3 </since_tizen>
653 public static readonly int BLEND_FACTOR_SRC_RGB = NDalicPINVOKE.Renderer_Property_BLEND_FACTOR_SRC_RGB_get();
655 /// This should be internal, please do not use.
657 /// <since_tizen> 3 </since_tizen>
658 public static readonly int BLEND_FACTOR_DEST_RGB = NDalicPINVOKE.Renderer_Property_BLEND_FACTOR_DEST_RGB_get();
660 /// This should be internal, please do not use.
662 /// <since_tizen> 3 </since_tizen>
663 public static readonly int BLEND_FACTOR_SRC_ALPHA = NDalicPINVOKE.Renderer_Property_BLEND_FACTOR_SRC_ALPHA_get();
665 /// This should be internal, please do not use.
667 /// <since_tizen> 3 </since_tizen>
668 public static readonly int BLEND_FACTOR_DEST_ALPHA = NDalicPINVOKE.Renderer_Property_BLEND_FACTOR_DEST_ALPHA_get();
670 /// This should be internal, please do not use.
672 /// <since_tizen> 3 </since_tizen>
673 public static readonly int BLEND_COLOR = NDalicPINVOKE.Renderer_Property_BLEND_COLOR_get();
675 /// This should be internal, please do not use.
677 /// <since_tizen> 3 </since_tizen>
678 public static readonly int BLEND_PRE_MULTIPLIED_ALPHA = NDalicPINVOKE.Renderer_Property_BLEND_PRE_MULTIPLIED_ALPHA_get();
680 /// This should be internal, please do not use.
682 /// <since_tizen> 3 </since_tizen>
683 public static readonly int INDEX_RANGE_FIRST = NDalicPINVOKE.Renderer_Property_INDEX_RANGE_FIRST_get();
685 /// This should be internal, please do not use.
687 /// <since_tizen> 3 </since_tizen>
688 public static readonly int INDEX_RANGE_COUNT = NDalicPINVOKE.Renderer_Property_INDEX_RANGE_COUNT_get();
690 /// This should be internal, please do not use.
692 /// <since_tizen> 3 </since_tizen>
693 public static readonly int DEPTH_WRITE_MODE = NDalicPINVOKE.Renderer_Property_DEPTH_WRITE_MODE_get();
695 /// This should be internal, please do not use.
697 /// <since_tizen> 3 </since_tizen>
698 public static readonly int DEPTH_FUNCTION = NDalicPINVOKE.Renderer_Property_DEPTH_FUNCTION_get();
700 /// This should be internal, please do not use.
702 /// <since_tizen> 3 </since_tizen>
703 public static readonly int DEPTH_TEST_MODE = NDalicPINVOKE.Renderer_Property_DEPTH_TEST_MODE_get();
705 /// This should be internal, please do not use.
707 /// <since_tizen> 3 </since_tizen>
708 public static readonly int RENDER_MODE = NDalicPINVOKE.Renderer_Property_RENDER_MODE_get();
710 /// This should be internal, please do not use.
712 /// <since_tizen> 3 </since_tizen>
713 public static readonly int STENCIL_FUNCTION = NDalicPINVOKE.Renderer_Property_STENCIL_FUNCTION_get();
715 /// This should be internal, please do not use.
717 /// <since_tizen> 3 </since_tizen>
718 public static readonly int STENCIL_FUNCTION_MASK = NDalicPINVOKE.Renderer_Property_STENCIL_FUNCTION_MASK_get();
720 /// This should be internal, please do not use.
722 /// <since_tizen> 3 </since_tizen>
723 public static readonly int STENCIL_FUNCTION_REFERENCE = NDalicPINVOKE.Renderer_Property_STENCIL_FUNCTION_REFERENCE_get();
725 /// This should be internal, please do not use.
727 /// <since_tizen> 3 </since_tizen>
728 public static readonly int STENCIL_MASK = NDalicPINVOKE.Renderer_Property_STENCIL_MASK_get();
730 /// This should be internal, please do not use.
732 /// <since_tizen> 3 </since_tizen>
733 public static readonly int STENCIL_OPERATION_ON_FAIL = NDalicPINVOKE.Renderer_Property_STENCIL_OPERATION_ON_FAIL_get();
735 /// This should be internal, please do not use.
737 /// <since_tizen> 3 </since_tizen>
738 public static readonly int STENCIL_OPERATION_ON_Z_FAIL = NDalicPINVOKE.Renderer_Property_STENCIL_OPERATION_ON_Z_FAIL_get();
740 /// This should be internal, please do not use.
742 /// <since_tizen> 3 </since_tizen>
743 public static readonly int STENCIL_OPERATION_ON_Z_PASS = NDalicPINVOKE.Renderer_Property_STENCIL_OPERATION_ON_Z_PASS_get();