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