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.
17 using System.ComponentModel;
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(Interop.Renderer.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 Interop.Renderer.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 = Interop.Renderer.Renderer_GetGeometry(swigCPtr);
492 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
493 Geometry ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as Geometry;
494 Interop.BaseHandle.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 Interop.Renderer.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 Interop.Renderer.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 = Interop.Renderer.Renderer_GetTextures(swigCPtr);
533 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
534 TextureSet ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as TextureSet;
535 if (cPtr != null && ret == null)
537 ret = new TextureSet(cPtr, false);
538 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
541 Interop.BaseHandle.delete_BaseHandle(CPtr);
542 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
544 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
549 /// Sets the shader used by this renderer.
551 /// <param name="shader">The shader to be used by this renderer.</param>
552 /// <since_tizen> 3 </since_tizen>
553 public void SetShader(Shader shader)
555 Interop.Renderer.Renderer_SetShader(swigCPtr, Shader.getCPtr(shader));
556 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
560 /// Gets the shader used by this renderer.
562 /// <returns>The shader used by the renderer.</returns>
563 /// <since_tizen> 3 </since_tizen>
564 public Shader GetShader()
566 //to fix memory leak issue, match the handle count with native side.
567 System.IntPtr cPtr = Interop.Renderer.Renderer_GetShader(swigCPtr);
568 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
569 Shader ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as Shader;
570 Interop.BaseHandle.delete_BaseHandle(CPtr);
571 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
573 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
577 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Renderer obj)
579 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
582 internal Renderer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.Renderer.Renderer_SWIGUpcast(cPtr), cMemoryOwn)
584 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
590 /// <since_tizen> 3 </since_tizen>
591 protected override void Dispose(DisposeTypes type)
598 if (type == DisposeTypes.Explicit)
601 //Release your own managed resources here.
602 //You should release all of your own disposable objects here.
606 //Release your own unmanaged resources here.
607 //You should not access any managed member here except static instance.
608 //because the execution order of Finalizes is non-deterministic.
611 if (swigCPtr.Handle != global::System.IntPtr.Zero)
616 Interop.Renderer.delete_Renderer(swigCPtr);
618 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
625 /// Enumeration for instances of properties belonging to the Renderer class.
627 /// <since_tizen> 3 </since_tizen>
628 public class Property
631 /// This should be internal, please do not use.
633 /// <since_tizen> 3 </since_tizen>
634 public static readonly int DEPTH_INDEX = Interop.Renderer.Renderer_Property_DEPTH_INDEX_get();
636 /// This should be internal, please do not use.
638 /// <since_tizen> 3 </since_tizen>
639 public static readonly int FACE_CULLING_MODE = Interop.Renderer.Renderer_Property_FACE_CULLING_MODE_get();
641 /// This should be internal, please do not use.
643 /// <since_tizen> 3 </since_tizen>
644 public static readonly int BLEND_MODE = Interop.Renderer.Renderer_Property_BLEND_MODE_get();
646 /// This should be internal, please do not use.
648 /// <since_tizen> 3 </since_tizen>
649 public static readonly int BLEND_EQUATION_RGB = Interop.Renderer.Renderer_Property_BLEND_EQUATION_RGB_get();
651 /// This should be internal, please do not use.
653 /// <since_tizen> 3 </since_tizen>
654 public static readonly int BLEND_EQUATION_ALPHA = Interop.Renderer.Renderer_Property_BLEND_EQUATION_ALPHA_get();
656 /// This should be internal, please do not use.
658 /// <since_tizen> 3 </since_tizen>
659 public static readonly int BLEND_FACTOR_SRC_RGB = Interop.Renderer.Renderer_Property_BLEND_FACTOR_SRC_RGB_get();
661 /// This should be internal, please do not use.
663 /// <since_tizen> 3 </since_tizen>
664 public static readonly int BLEND_FACTOR_DEST_RGB = Interop.Renderer.Renderer_Property_BLEND_FACTOR_DEST_RGB_get();
666 /// This should be internal, please do not use.
668 /// <since_tizen> 3 </since_tizen>
669 public static readonly int BLEND_FACTOR_SRC_ALPHA = Interop.Renderer.Renderer_Property_BLEND_FACTOR_SRC_ALPHA_get();
671 /// This should be internal, please do not use.
673 /// <since_tizen> 3 </since_tizen>
674 public static readonly int BLEND_FACTOR_DEST_ALPHA = Interop.Renderer.Renderer_Property_BLEND_FACTOR_DEST_ALPHA_get();
676 /// This should be internal, please do not use.
678 /// <since_tizen> 3 </since_tizen>
679 public static readonly int BLEND_COLOR = Interop.Renderer.Renderer_Property_BLEND_COLOR_get();
681 /// This should be internal, please do not use.
683 /// <since_tizen> 3 </since_tizen>
684 public static readonly int BLEND_PRE_MULTIPLIED_ALPHA = Interop.Renderer.Renderer_Property_BLEND_PRE_MULTIPLIED_ALPHA_get();
686 /// This should be internal, please do not use.
688 /// <since_tizen> 3 </since_tizen>
689 public static readonly int INDEX_RANGE_FIRST = Interop.Renderer.Renderer_Property_INDEX_RANGE_FIRST_get();
691 /// This should be internal, please do not use.
693 /// <since_tizen> 3 </since_tizen>
694 public static readonly int INDEX_RANGE_COUNT = Interop.Renderer.Renderer_Property_INDEX_RANGE_COUNT_get();
696 /// This should be internal, please do not use.
698 /// <since_tizen> 3 </since_tizen>
699 public static readonly int DEPTH_WRITE_MODE = Interop.Renderer.Renderer_Property_DEPTH_WRITE_MODE_get();
701 /// This should be internal, please do not use.
703 /// <since_tizen> 3 </since_tizen>
704 public static readonly int DEPTH_FUNCTION = Interop.Renderer.Renderer_Property_DEPTH_FUNCTION_get();
706 /// This should be internal, please do not use.
708 /// <since_tizen> 3 </since_tizen>
709 public static readonly int DEPTH_TEST_MODE = Interop.Renderer.Renderer_Property_DEPTH_TEST_MODE_get();
711 /// This should be internal, please do not use.
713 /// <since_tizen> 3 </since_tizen>
714 public static readonly int RENDER_MODE = Interop.Renderer.Renderer_Property_RENDER_MODE_get();
716 /// This should be internal, please do not use.
718 /// <since_tizen> 3 </since_tizen>
719 public static readonly int STENCIL_FUNCTION = Interop.Renderer.Renderer_Property_STENCIL_FUNCTION_get();
721 /// This should be internal, please do not use.
723 /// <since_tizen> 3 </since_tizen>
724 public static readonly int STENCIL_FUNCTION_MASK = Interop.Renderer.Renderer_Property_STENCIL_FUNCTION_MASK_get();
726 /// This should be internal, please do not use.
728 /// <since_tizen> 3 </since_tizen>
729 public static readonly int STENCIL_FUNCTION_REFERENCE = Interop.Renderer.Renderer_Property_STENCIL_FUNCTION_REFERENCE_get();
731 /// This should be internal, please do not use.
733 /// <since_tizen> 3 </since_tizen>
734 public static readonly int STENCIL_MASK = Interop.Renderer.Renderer_Property_STENCIL_MASK_get();
736 /// This should be internal, please do not use.
738 /// <since_tizen> 3 </since_tizen>
739 public static readonly int STENCIL_OPERATION_ON_FAIL = Interop.Renderer.Renderer_Property_STENCIL_OPERATION_ON_FAIL_get();
741 /// This should be internal, please do not use.
743 /// <since_tizen> 3 </since_tizen>
744 public static readonly int STENCIL_OPERATION_ON_Z_FAIL = Interop.Renderer.Renderer_Property_STENCIL_OPERATION_ON_Z_FAIL_get();
746 /// This should be internal, please do not use.
748 /// <since_tizen> 3 </since_tizen>
749 public static readonly int STENCIL_OPERATION_ON_Z_PASS = Interop.Renderer.Renderer_Property_STENCIL_OPERATION_ON_Z_PASS_get();