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