[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Renderer_Property_STENCIL_OPERATION_ON_Z_PASS_get")]
public static extern int StencilOperationOnZPassGet();
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Renderer_Property_MIX_COLOR_get")]
+ public static extern int MixColorGet();
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Renderer_Property_MIX_COLOR_RED_get")]
+ public static extern int MixColorRedGet();
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Renderer_Property_MIX_COLOR_GREEN_get")]
+ public static extern int MixColorGreenGet();
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Renderer_Property_MIX_COLOR_BLUE_get")]
+ public static extern int MixColorBlueGet();
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Renderer_Property_OPACITY_get")]
+ public static extern int MixColorOpacityGet();
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Renderer_Property_RENDERING_BEHAVIOR_get")]
+ public static extern int RenderingBehaviorGet();
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Renderer_Property_BLEND_EQUATION_get")]
+ public static extern int BlendEquationGet();
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Renderer_Property_INSTANCE_COUNT_get")]
+ public static extern int InstanceCountGet();
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Renderer_Property_UPDATE_AREA_EXTENTS_get")]
+ public static extern int UpdateAreaExtentsGet();
+
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Renderer_New")]
public static extern global::System.IntPtr New(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
}
}
+ /// <summary>
+ /// Gets and Sets extents of partial update area.
+ /// </summary>
+ /// <remarks>
+ /// Extents the area - the position and the size - used for the attached View's partial update area calculation.
+ /// This value be appended after calculate all update area, like visual offset.
+ /// Change <see cref="Tizen.NUI.BaseComponents.View.UpdateAreaHint"/> value if you want to change View's partial update area.
+ /// Warning : Only 0u ~ 65535u integer values are allowed for each parameters.
+ /// </remarks>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public UIExtents UpdateArea
+ {
+ get
+ {
+ // TODO : Clean up below logics
+ using Extents temp = new Extents();
+ using var pValue = Tizen.NUI.Object.GetProperty(SwigCPtr, Renderer.Property.UpdateAreaExtents);
+ pValue.Get(temp);
+
+ if (temp == null)
+ {
+ return new UIExtents(0.0f);
+ }
+ UIExtents result = new UIExtents((float)temp.Start, (float)temp.End, (float)temp.Top, (float)temp.Bottom);
+ return result;
+ }
+ set
+ {
+ using var temp = new Tizen.NUI.PropertyValue((Extents)value);
+ Tizen.NUI.Object.SetProperty(SwigCPtr, Renderer.Property.UpdateAreaExtents, temp);
+ }
+ }
+
/// <summary>
/// Sets the geometry to be used by this renderer.
/// </summary>
/// This will be opened API after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
- public static readonly int BACKGROUND = Interop.Renderer.RangesBackgroundGet();
+ public static readonly int Background = Interop.Renderer.RangesBackgroundGet();
/// This will be opened API after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
- public static readonly int CONTENT = Interop.Renderer.RangesContentGet();
+ public static readonly int Content = Interop.Renderer.RangesContentGet();
/// This will be opened API after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
- public static readonly int DECORATION = Interop.Renderer.RangesDecorationGet();
+ public static readonly int Decoration = Interop.Renderer.RangesDecorationGet();
/// This will be opened API after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete("Do not use this, that is deprecated in API9 and will be removed in API11. Use ForegroundEffect instead.")]
+ [Obsolete("Do not use this, that is deprecated in API9 and will be removed in API11. Use BackgroundEffect instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
[SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "<Pending>")]
- public static readonly int FOREGROUND_EFFECT = Interop.Renderer.RangesForegroundEffectGet();
+ public static readonly int BACKGROUND_EFFECT = Interop.Renderer.RangesBackgroundEffectGet();
- [Obsolete("Do not use this, that is deprecated in API9 and will be removed in API11. Use BackgroundEffect instead.")]
+ [Obsolete("Do not use this, that is deprecated in API13 and will be removed in API15. Use Background instead.")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly int BACKGROUND = Interop.Renderer.RangesBackgroundGet();
+
+ [Obsolete("Do not use this, that is deprecated in API13 and will be removed in API15. Use Content instead.")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly int CONTENT = Interop.Renderer.RangesContentGet();
+
+ [Obsolete("Do not use this, that is deprecated in API13 and will be removed in API15. Use Decoration instead.")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly int DECORATION = Interop.Renderer.RangesDecorationGet();
+
+ [Obsolete("Do not use this, that is deprecated in API9 and will be removed in API11. Use ForegroundEffect instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
[SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "<Pending>")]
- public static readonly int BACKGROUND_EFFECT = Interop.Renderer.RangesBackgroundEffectGet();
+ public static readonly int FOREGROUND_EFFECT = Interop.Renderer.RangesForegroundEffectGet();
}
/// <summary>
internal static readonly int StencilOperationOnFail = Interop.Renderer.StencilOperationOnFailGet();
internal static readonly int StencilOperationOnZFail = Interop.Renderer.StencilOperationOnZFailGet();
internal static readonly int StencilOperationOnZPass = Interop.Renderer.StencilOperationOnZPassGet();
+ internal static readonly int MixColor = Interop.Renderer.MixColorGet();
+ internal static readonly int MixColorRed = Interop.Renderer.MixColorRedGet();
+ internal static readonly int MixColorGreen = Interop.Renderer.MixColorGreenGet();
+ internal static readonly int MixColorBlue = Interop.Renderer.MixColorBlueGet();
+ internal static readonly int MixColorOpacity = Interop.Renderer.MixColorOpacityGet();
+ internal static readonly int RenderingBehavior = Interop.Renderer.RenderingBehaviorGet();
+ internal static readonly int BlendEquation = Interop.Renderer.BlendEquationGet();
+ internal static readonly int VertexRangeFirst = Interop.Renderer.IndexRangeFirstGet();
+ internal static readonly int VertexRangeCount = Interop.Renderer.IndexRangeCountGet();
+ internal static readonly int InstanceCount = Interop.Renderer.InstanceCountGet();
+ internal static readonly int UpdateAreaExtents = Interop.Renderer.UpdateAreaExtentsGet();
}
}
}
--- /dev/null
+using System;
+using System.Runtime.InteropServices;
+using Tizen.NUI.BaseComponents;
+using System.Collections.Generic;
+
+namespace Tizen.NUI.Samples
+{
+ public class RendererUpdateAreaTest : IExample
+ {
+ static readonly string VERTEX_SHADER =
+ "//@name RendererUpdateAreaTest.vert\n" +
+ "\n" +
+ "//@version 100\n" +
+ "\n" +
+ "precision highp float;\n"+
+ "INPUT highp vec2 aPosition;\n" +
+ "\n" +
+ "UNIFORM_BLOCK VertBlock\n" +
+ "{\n" +
+ " UNIFORM highp mat4 uMvpMatrix;\n" +
+ " UNIFORM highp vec3 uSize;\n" +
+ " UNIFORM highp vec2 uCustomExtraSize;\n" +
+ "};\n" +
+ "void main()\n" +
+ "{\n" +
+ " vec4 pos = vec4(aPosition, 0.0, 1.0) * vec4(uSize.xy + uCustomExtraSize, 0.0, 1.0);\n" +
+ " gl_Position = uMvpMatrix * pos;\n" +
+ "}\n";
+
+ static readonly string FRAGMENT_SHADER =
+ "//@name RendererUpdateAreaTest.frag\n" +
+ "\n" +
+ "//@version 100\n" +
+ "\n" +
+ "precision highp float;\n"+
+ "\n" +
+ "UNIFORM_BLOCK FragBlock\n" +
+ "{\n" +
+ " UNIFORM lowp vec4 uColor;\n" +
+ "};\n" +
+ "\n" +
+ "void main()\n" +
+ "{\n" +
+ " gl_FragColor = uColor;\n" +
+ "}\n";
+
+
+ struct SimpleQuadVertex
+ {
+ public UIVector2 position;
+ }
+
+ private PropertyBuffer CreateQuadPropertyBuffer()
+ {
+ /* Create Property buffer */
+ PropertyMap vertexFormat = new PropertyMap();
+ vertexFormat.Add("aPosition", (int)PropertyType.Vector2);
+
+ PropertyBuffer vertexBuffer = new PropertyBuffer(vertexFormat);
+
+ SimpleQuadVertex vertex1 = new SimpleQuadVertex();
+ SimpleQuadVertex vertex2 = new SimpleQuadVertex();
+ SimpleQuadVertex vertex3 = new SimpleQuadVertex();
+ SimpleQuadVertex vertex4 = new SimpleQuadVertex();
+ vertex1.position = new UIVector2(-0.5f, -0.5f);
+ vertex2.position = new UIVector2(-0.5f, 0.5f);
+ vertex3.position = new UIVector2(0.5f, -0.5f);
+ vertex4.position = new UIVector2(0.5f, 0.5f);
+
+ SimpleQuadVertex[] texturedQuadVertexData = new SimpleQuadVertex[4] { vertex1, vertex2, vertex3, vertex4 };
+
+ int size = Marshal.SizeOf(vertex1);
+ IntPtr pA = Marshal.AllocHGlobal(checked(size * texturedQuadVertexData.Length));
+
+ try
+ {
+ for (int i = 0; i < texturedQuadVertexData.Length; i++)
+ {
+ Marshal.StructureToPtr(texturedQuadVertexData[i], pA + i * size, true);
+ }
+
+ vertexBuffer.SetData(pA, (uint)texturedQuadVertexData.Length);
+ }
+ catch(Exception e)
+ {
+ Tizen.Log.Error("NUI", "Exception in PropertyBuffer : " + e.Message);
+ }
+ finally
+ {
+ // Free AllocHGlobal memory after call PropertyBuffer.SetData()
+ Marshal.FreeHGlobal(pA);
+ }
+
+ vertexFormat.Dispose();
+
+ return vertexBuffer;
+ }
+
+ static private readonly float extraSizeWidth = 100.0f;
+ static private readonly float extraSizeHeight = 100.0f;
+
+ private Window win;
+ private View root;
+ private View[] subView = new View[3];
+ private Animation moveXAnimation;
+ private Animation moveYAnimation;
+ private Timer mTimer;
+ private int showingViewIndex = 0;
+
+ public void Activate()
+ {
+ win = NUIApplication.GetDefaultWindow();
+ root = new View()
+ {
+ Name = "root",
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ };
+ win.Add(root);
+
+ moveXAnimation = new Animation(3000); //3.0s
+ moveYAnimation = new Animation(2600); //2.6s
+
+ AddViews();
+ var infoLabel = new TextLabel()
+ {
+ Text = "1'st : No update area extents\n2'nd : Extents just right and bottom.\n3'rd : Fit extented area.",
+ MultiLine = true,
+ };
+ root.Add(infoLabel);
+
+ moveXAnimation.Looping = true;
+ moveXAnimation.LoopingMode = Animation.LoopingModes.AutoReverse;
+ moveXAnimation.Play();
+ moveYAnimation.Looping = true;
+ moveYAnimation.LoopingMode = Animation.LoopingModes.AutoReverse;
+ moveYAnimation.Play();
+
+ // Visibility change timer
+ subView[showingViewIndex].Show();
+
+ mTimer = new Timer(2000);
+ mTimer.Tick += OnTick;
+ mTimer.Start();
+ }
+
+
+ private bool OnTick(object o, EventArgs e)
+ {
+ subView[showingViewIndex].Hide();
+ showingViewIndex = (showingViewIndex + 1)%3;
+ subView[showingViewIndex].Show();
+ return true;
+ }
+
+ private void AddViews()
+ {
+ for(int i = 0; i < 3; i++)
+ {
+ // View area is red, and additional renderer area is yellow.
+ View view = new View()
+ {
+ Color = Color.Yellow,
+ BackgroundColor = Color.Red,
+ SizeWidth = 8.0f,
+ SizeHeight = 8.0f,
+ PositionX = extraSizeWidth * 0.5f,
+ PositionY = extraSizeHeight * 0.5f,
+ };
+
+ var renderer = GenerateRenderer();
+
+ // Make it draw under the background
+ renderer.DepthIndex = Renderer.Ranges.Background - 1;
+
+ if (i == 1)
+ {
+ renderer.UpdateArea = new UIExtents(0.0f, extraSizeHeight * 0.5f, 0.0f, extraSizeHeight * 0.5f);
+ }
+ else if (i == 2)
+ {
+ renderer.UpdateArea = new UIExtents(extraSizeHeight * 0.5f, extraSizeHeight * 0.5f, extraSizeHeight * 0.5f, extraSizeHeight * 0.5f);
+ }
+
+ view.AddRenderer(renderer);
+
+ moveXAnimation.AnimateBy(view, "PositionX", 350.0f);
+ moveYAnimation.AnimateBy(view, "PositionY", 200.0f);
+
+ View playGroundView = new View()
+ {
+ BorderlineWidth = 2.0f,
+ BorderlineOffset = 1.0f,
+ SizeWidth = 8.0f + 350.0f + extraSizeWidth,
+ SizeHeight = 8.0f + 200.0f + extraSizeHeight,
+ PositionX = 15.0f,
+ PositionY = i * 250.0f + 15.0f,
+ };
+
+ playGroundView.Hide();
+
+ playGroundView.Add(view);
+ root.Add(playGroundView);
+ subView[i] = playGroundView;
+ }
+ }
+
+ private Geometry GenerateGeometry()
+ {
+ using PropertyBuffer vertexBuffer = CreateQuadPropertyBuffer();
+ Geometry geometry = new Geometry();
+ geometry.AddVertexBuffer(vertexBuffer);
+ geometry.SetType(Geometry.Type.TRIANGLE_STRIP);
+
+ return geometry;
+ }
+
+ private Shader GenerateShader()
+ {
+ Shader shader = new Shader(VERTEX_SHADER, FRAGMENT_SHADER, "RendererUpdateAreaTest");
+ return shader;
+ }
+
+ private Renderer GenerateRenderer()
+ {
+ Renderer renderer = new Renderer();
+ Geometry geometry = GenerateGeometry();
+ Shader shader = GenerateShader();
+
+ renderer.SetGeometry(geometry);
+ renderer.SetShader(shader);
+
+ renderer.RegisterProperty("uCustomExtraSize", new PropertyValue(new UIVector2(extraSizeWidth, extraSizeHeight)));
+
+ return renderer;
+ }
+
+ public void Deactivate()
+ {
+ mTimer?.Stop();
+ mTimer?.Dispose();
+ moveXAnimation?.Stop();
+ moveXAnimation?.Dispose();
+ moveYAnimation?.Stop();
+ moveYAnimation?.Dispose();
+ root?.Unparent();
+ root?.Dispose();
+ }
+ }
+}