e54fb427011baab17110fd423b197ea9e369cf00
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / RenderTask.cs
1 /*
2  * Copyright(c) 2017 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17 using System;
18 using System.ComponentModel;
19 using Tizen.NUI.BaseComponents;
20
21 namespace Tizen.NUI
22 {
23     /// This will be released at Tizen.NET API Level 6, so currently this would be used as inhouse API.
24     [EditorBrowsable(EditorBrowsableState.Never)]
25     public class RenderTask : Animatable
26     {
27
28         internal RenderTask(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.RenderTask.Upcast(cPtr), cMemoryOwn)
29         {
30         }
31
32         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(RenderTask obj)
33         {
34             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
35         }
36
37         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
38         {
39             Interop.RenderTask.DeleteRenderTask(swigCPtr);
40         }
41
42
43         public static RenderTask GetRenderTaskFromPtr(global::System.IntPtr cPtr)
44         {
45             RenderTask ret = new RenderTask(cPtr, false);
46             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
47             return ret;
48         }
49
50         internal class Property
51         {
52             internal static readonly int ViewportPosition = Interop.RenderTask.ViewportPositionGet();
53             internal static readonly int ViewportSize = Interop.RenderTask.ViewportSizeGet();
54             internal static readonly int ClearColor = Interop.RenderTask.ClearColorGet();
55             internal static readonly int RequiresSync = Interop.RenderTask.RequiresSyncGet();
56         }
57
58         internal static SWIGTYPE_p_f_r_Dali__Vector2__bool DEFAULT_SCREEN_TO_FRAMEBUFFER_FUNCTION
59         {
60             get
61             {
62                 global::System.IntPtr cPtr = Interop.RenderTask.DefaultScreenToFramebufferFunctionGet();
63                 SWIGTYPE_p_f_r_Dali__Vector2__bool ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_f_r_Dali__Vector2__bool(cPtr);
64                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
65                 return ret;
66             }
67         }
68
69         internal static SWIGTYPE_p_f_r_Dali__Vector2__bool FULLSCREEN_FRAMEBUFFER_FUNCTION
70         {
71             get
72             {
73                 global::System.IntPtr cPtr = Interop.RenderTask.FullscreenFramebufferFunctionGet();
74                 SWIGTYPE_p_f_r_Dali__Vector2__bool ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_f_r_Dali__Vector2__bool(cPtr);
75                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
76                 return ret;
77             }
78         }
79
80         public static bool DEFAULT_EXCLUSIVE
81         {
82             get
83             {
84                 bool ret = Interop.RenderTask.DefaultExclusiveGet();
85                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
86                 return ret;
87             }
88         }
89
90         public static bool DEFAULT_INPUT_ENABLED
91         {
92             get
93             {
94                 bool ret = Interop.RenderTask.DefaultInputEnabledGet();
95                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
96                 return ret;
97             }
98         }
99
100         public static Vector4 DEFAULT_CLEAR_COLOR
101         {
102             get
103             {
104                 global::System.IntPtr cPtr = Interop.RenderTask.DefaultClearColorGet();
105                 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
106                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
107                 return ret;
108             }
109         }
110
111         public static bool DEFAULT_CLEAR_ENABLED
112         {
113             get
114             {
115                 bool ret = Interop.RenderTask.DefaultClearEnabledGet();
116                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
117                 return ret;
118             }
119         }
120
121         public static bool DEFAULT_CULL_MODE
122         {
123             get
124             {
125                 bool ret = Interop.RenderTask.DefaultCullModeGet();
126                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
127                 return ret;
128             }
129         }
130
131         public static uint DEFAULT_REFRESH_RATE
132         {
133             get
134             {
135                 uint ret = Interop.RenderTask.DefaultRefreshRateGet();
136                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
137                 return ret;
138             }
139         }
140
141         public RenderTask() : this(Interop.RenderTask.NewRenderTask(), true)
142         {
143             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
144         }
145
146         public static RenderTask DownCast(BaseHandle handle)
147         {
148             if (handle == null)
149             {
150                 throw new global::System.ArgumentNullException(nameof(handle));
151             }
152             RenderTask ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as RenderTask;
153             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
154             return ret;
155         }
156
157         public RenderTask(RenderTask handle) : this(Interop.RenderTask.NewRenderTask(RenderTask.getCPtr(handle)), true)
158         {
159             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
160         }
161
162         public RenderTask Assign(RenderTask rhs)
163         {
164             RenderTask ret = new RenderTask(Interop.RenderTask.Assign(SwigCPtr, RenderTask.getCPtr(rhs)), false);
165             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
166             return ret;
167         }
168
169         public void SetSourceView(View view)
170         {
171             Interop.RenderTask.SetSourceActor(SwigCPtr, View.getCPtr(view));
172             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
173         }
174
175         public View GetSourceView()
176         {
177             View ret = new View(Interop.RenderTask.GetSourceActor(SwigCPtr), true);
178             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
179             return ret;
180         }
181
182         public void SetExclusive(bool exclusive)
183         {
184             Interop.RenderTask.SetExclusive(SwigCPtr, exclusive);
185             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
186         }
187
188         public bool IsExclusive()
189         {
190             bool ret = Interop.RenderTask.IsExclusive(SwigCPtr);
191             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
192             return ret;
193         }
194
195         public void SetInputEnabled(bool enabled)
196         {
197             Interop.RenderTask.SetInputEnabled(SwigCPtr, enabled);
198             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
199         }
200
201         public bool GetInputEnabled()
202         {
203             bool ret = Interop.RenderTask.GetInputEnabled(SwigCPtr);
204             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
205             return ret;
206         }
207
208         internal void SetCamera(Camera camera)
209         {
210             Interop.RenderTask.SetCameraActor(SwigCPtr, Camera.getCPtr(camera));
211             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
212         }
213
214         internal Camera GetCamera()
215         {
216             Camera ret = new Camera(Interop.RenderTask.GetCameraActor(SwigCPtr), true);
217             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
218             return ret;
219         }
220
221         public void SetFrameBuffer(FrameBuffer frameBuffer)
222         {
223             Interop.RenderTask.SetFrameBuffer(SwigCPtr, FrameBuffer.getCPtr(frameBuffer));
224             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
225         }
226
227         public FrameBuffer GetFrameBuffer()
228         {
229             FrameBuffer ret = new FrameBuffer(Interop.RenderTask.GetFrameBuffer(SwigCPtr), true);
230             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
231             return ret;
232         }
233
234         internal void SetScreenToFrameBufferFunction(SWIGTYPE_p_f_r_Dali__Vector2__bool conversionFunction)
235         {
236             Interop.RenderTask.SetScreenToFrameBufferFunction(SwigCPtr, SWIGTYPE_p_f_r_Dali__Vector2__bool.getCPtr(conversionFunction));
237             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
238         }
239
240         internal SWIGTYPE_p_f_r_Dali__Vector2__bool GetScreenToFrameBufferFunction()
241         {
242             global::System.IntPtr cPtr = Interop.RenderTask.GetScreenToFrameBufferFunction(SwigCPtr);
243             SWIGTYPE_p_f_r_Dali__Vector2__bool ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_f_r_Dali__Vector2__bool(cPtr);
244             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
245             return ret;
246         }
247
248         public void SetScreenToFrameBufferMappingView(View mappingView)
249         {
250             Interop.RenderTask.SetScreenToFrameBufferMappingActor(SwigCPtr, View.getCPtr(mappingView));
251             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
252         }
253
254         public View GetScreenToFrameBufferMappingView()
255         {
256             View ret = new View(Interop.RenderTask.GetScreenToFrameBufferMappingActor(SwigCPtr), true);
257             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
258             return ret;
259         }
260
261         public void SetViewportPosition(Vector2 position)
262         {
263             Interop.RenderTask.SetViewportPosition(SwigCPtr, Vector2.getCPtr(position));
264             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
265         }
266
267         public Vector2 GetCurrentViewportPosition()
268         {
269             Vector2 ret = new Vector2(Interop.RenderTask.GetCurrentViewportPosition(SwigCPtr), true);
270             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
271             return ret;
272         }
273
274         public void SetViewportSize(Vector2 size)
275         {
276             Interop.RenderTask.SetViewportSize(SwigCPtr, Vector2.getCPtr(size));
277             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
278         }
279
280         public Vector2 GetCurrentViewportSize()
281         {
282             Vector2 ret = new Vector2(Interop.RenderTask.GetCurrentViewportSize(SwigCPtr), true);
283             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
284             return ret;
285         }
286
287         public void SetViewport(Rectangle viewport)
288         {
289             Interop.RenderTask.SetViewport(SwigCPtr, Rectangle.getCPtr(viewport));
290             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
291         }
292
293         public Rectangle GetViewport()
294         {
295             Rectangle ret = new Rectangle(Interop.RenderTask.GetViewport(SwigCPtr), true);
296             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
297             return ret;
298         }
299
300         public void SetClearColor(Vector4 color)
301         {
302             Interop.RenderTask.SetClearColor(SwigCPtr, Vector4.getCPtr(color));
303             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
304         }
305
306         public Vector4 GetClearColor()
307         {
308             Vector4 ret = new Vector4(Interop.RenderTask.GetClearColor(SwigCPtr), true);
309             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
310             return ret;
311         }
312
313         public void SetClearEnabled(bool enabled)
314         {
315             Interop.RenderTask.SetClearEnabled(SwigCPtr, enabled);
316             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
317         }
318
319         public bool GetClearEnabled()
320         {
321             bool ret = Interop.RenderTask.GetClearEnabled(SwigCPtr);
322             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
323             return ret;
324         }
325
326         public void SetCullMode(bool cullMode)
327         {
328             Interop.RenderTask.SetCullMode(SwigCPtr, cullMode);
329             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
330         }
331
332         public bool GetCullMode()
333         {
334             bool ret = Interop.RenderTask.GetCullMode(SwigCPtr);
335             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
336             return ret;
337         }
338
339         public void SetRefreshRate(uint refreshRate)
340         {
341             Interop.RenderTask.SetRefreshRate(SwigCPtr, refreshRate);
342             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
343         }
344
345         public uint GetRefreshRate()
346         {
347             uint ret = Interop.RenderTask.GetRefreshRate(SwigCPtr);
348             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
349             return ret;
350         }
351
352         public bool WorldToViewport(Vector3 position, out float viewportX, out float viewportY)
353         {
354             bool ret = Interop.RenderTask.WorldToViewport(SwigCPtr, Vector3.getCPtr(position), out viewportX, out viewportY);
355             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
356             return ret;
357         }
358
359         public bool ViewportToLocal(View view, float viewportX, float viewportY, out float localX, out float localY)
360         {
361             bool ret = Interop.RenderTask.ViewportToLocal(SwigCPtr, View.getCPtr(view), viewportX, viewportY, out localX, out localY);
362             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
363             return ret;
364         }
365
366         internal RenderTaskSignal FinishedSignal()
367         {
368             RenderTaskSignal ret = new RenderTaskSignal(Interop.RenderTask.FinishedSignal(SwigCPtr), false);
369             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
370             return ret;
371         }
372
373         /// <since_tizen> 3 </since_tizen>
374         public enum RefreshRate
375         {
376             REFRESH_ONCE = 0,
377             REFRESH_ALWAYS = 1
378         }
379
380         public Vector2 ViewportPosition
381         {
382             get
383             {
384                 Vector2 temp = new Vector2(0.0f, 0.0f);
385                 GetProperty(RenderTask.Property.ViewportPosition).Get(temp);
386                 return temp;
387             }
388             set
389             {
390                 SetProperty(RenderTask.Property.ViewportPosition, new Tizen.NUI.PropertyValue(value));
391             }
392         }
393         public Vector2 ViewportSize
394         {
395             get
396             {
397                 Vector2 temp = new Vector2(0.0f, 0.0f);
398                 GetProperty(RenderTask.Property.ViewportSize).Get(temp);
399                 return temp;
400             }
401             set
402             {
403                 SetProperty(RenderTask.Property.ViewportSize, new Tizen.NUI.PropertyValue(value));
404             }
405         }
406         public Vector4 ClearColor
407         {
408             get
409             {
410                 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
411                 GetProperty(RenderTask.Property.ClearColor).Get(temp);
412                 return temp;
413             }
414             set
415             {
416                 SetProperty(RenderTask.Property.ClearColor, new Tizen.NUI.PropertyValue(value));
417             }
418         }
419         public bool RequiresSync
420         {
421             get
422             {
423                 bool temp = false;
424                 GetProperty(RenderTask.Property.RequiresSync).Get(out temp);
425                 return temp;
426             }
427             set
428             {
429                 SetProperty(RenderTask.Property.RequiresSync, new Tizen.NUI.PropertyValue(value));
430             }
431         }
432     }
433 }