Follow formatting NUI
[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.RenderTaskSwigUpcast(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.DeleteRenderTask(swigCPtr);
39         }
40
41         [EditorBrowsable(EditorBrowsableState.Never)]
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 ViewportPosition = Interop.RenderTask.RenderTaskPropertyViewportPositionGet();
52             internal static readonly int ViewportSize = Interop.RenderTask.RenderTaskPropertyViewportSizeGet();
53             internal static readonly int ClearColor = Interop.RenderTask.RenderTaskPropertyClearColorGet();
54             internal static readonly int RequiresSync = Interop.RenderTask.RenderTaskPropertyRequiresSyncGet();
55         }
56
57         internal static SWIGTYPE_p_f_r_Dali__Vector2__bool DefaultScreenToFramebufferFunction
58         {
59             get
60             {
61                 global::System.IntPtr cPtr = Interop.RenderTask.RenderTaskDefaultScreenToFramebufferFunctionGet();
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 FullscreenFramebufferFunction
69         {
70             get
71             {
72                 global::System.IntPtr cPtr = Interop.RenderTask.RenderTaskFullscreenFramebufferFunctionGet();
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         [EditorBrowsable(EditorBrowsableState.Never)]
80         public static bool DefaultExclusive
81         {
82             get
83             {
84                 bool ret = Interop.RenderTask.RenderTaskDefaultExclusiveGet();
85                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
86                 return ret;
87             }
88         }
89
90         [EditorBrowsable(EditorBrowsableState.Never)]
91         public static bool DefaultInputEnabled
92         {
93             get
94             {
95                 bool ret = Interop.RenderTask.RenderTaskDefaultInputEnabledGet();
96                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
97                 return ret;
98             }
99         }
100
101         [EditorBrowsable(EditorBrowsableState.Never)]
102         public static Vector4 DefaultClearColor
103         {
104             get
105             {
106                 global::System.IntPtr cPtr = Interop.RenderTask.RenderTaskDefaultClearColorGet();
107                 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
108                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
109                 return ret;
110             }
111         }
112
113         [EditorBrowsable(EditorBrowsableState.Never)]
114         public static bool DefaultClearEnabled
115         {
116             get
117             {
118                 bool ret = Interop.RenderTask.RenderTaskDefaultClearEnabledGet();
119                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
120                 return ret;
121             }
122         }
123
124         [EditorBrowsable(EditorBrowsableState.Never)]
125         public static bool DefaultCullMode
126         {
127             get
128             {
129                 bool ret = Interop.RenderTask.RenderTaskDefaultCullModeGet();
130                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
131                 return ret;
132             }
133         }
134
135         [EditorBrowsable(EditorBrowsableState.Never)]
136         public static uint DefaultRefreshRate
137         {
138             get
139             {
140                 uint ret = Interop.RenderTask.RenderTaskDefaultRefreshRateGet();
141                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
142                 return ret;
143             }
144         }
145
146         [EditorBrowsable(EditorBrowsableState.Never)]
147         public RenderTask() : this(Interop.RenderTask.NewRenderTaskSwig0(), true)
148         {
149             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
150         }
151
152         [EditorBrowsable(EditorBrowsableState.Never)]
153         public static RenderTask DownCast(BaseHandle handle)
154         {
155             RenderTask ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as RenderTask;
156             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
157             return ret;
158         }
159
160         [EditorBrowsable(EditorBrowsableState.Never)]
161         public RenderTask(RenderTask handle) : this(Interop.RenderTask.NewRenderTaskSwig1(RenderTask.getCPtr(handle)), true)
162         {
163             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
164         }
165
166         [EditorBrowsable(EditorBrowsableState.Never)]
167         public RenderTask Assign(RenderTask rhs)
168         {
169             RenderTask ret = new RenderTask(Interop.RenderTask.RenderTaskAssign(swigCPtr, RenderTask.getCPtr(rhs)), false);
170             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
171             return ret;
172         }
173
174         [EditorBrowsable(EditorBrowsableState.Never)]
175         public void SetSourceView(View view)
176         {
177             Interop.RenderTask.RenderTaskSetSourceActor(swigCPtr, View.getCPtr(view));
178             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
179         }
180
181         public View GetSourceView()
182         {
183             View ret = new View(Interop.RenderTask.RenderTaskGetSourceActor(swigCPtr), true);
184             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
185             return ret;
186         }
187
188         [EditorBrowsable(EditorBrowsableState.Never)]
189         public void SetExclusive(bool exclusive)
190         {
191             Interop.RenderTask.RenderTaskSetExclusive(swigCPtr, exclusive);
192             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
193         }
194
195         [EditorBrowsable(EditorBrowsableState.Never)]
196         public bool IsExclusive()
197         {
198             bool ret = Interop.RenderTask.RenderTaskIsExclusive(swigCPtr);
199             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
200             return ret;
201         }
202
203         [EditorBrowsable(EditorBrowsableState.Never)]
204         public void SetInputEnabled(bool enabled)
205         {
206             Interop.RenderTask.RenderTaskSetInputEnabled(swigCPtr, enabled);
207             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
208         }
209
210         [EditorBrowsable(EditorBrowsableState.Never)]
211         public bool GetInputEnabled()
212         {
213             bool ret = Interop.RenderTask.RenderTaskGetInputEnabled(swigCPtr);
214             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
215             return ret;
216         }
217
218         internal void SetCamera(Camera camera)
219         {
220             Interop.RenderTask.RenderTaskSetCameraActor(swigCPtr, Camera.getCPtr(camera));
221             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
222         }
223
224         internal Camera GetCamera()
225         {
226             Camera ret = new Camera(Interop.RenderTask.RenderTaskGetCameraActor(swigCPtr), true);
227             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
228             return ret;
229         }
230
231         [EditorBrowsable(EditorBrowsableState.Never)]
232         public void SetFrameBuffer(FrameBuffer frameBuffer)
233         {
234             Interop.RenderTask.RenderTaskSetFrameBuffer(swigCPtr, FrameBuffer.getCPtr(frameBuffer));
235             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
236         }
237
238         [EditorBrowsable(EditorBrowsableState.Never)]
239         public FrameBuffer GetFrameBuffer()
240         {
241             FrameBuffer ret = new FrameBuffer(Interop.RenderTask.RenderTaskGetFrameBuffer(swigCPtr), true);
242             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
243             return ret;
244         }
245
246         internal void SetScreenToFrameBufferFunction(SWIGTYPE_p_f_r_Dali__Vector2__bool conversionFunction)
247         {
248             Interop.RenderTask.RenderTaskSetScreenToFrameBufferFunction(swigCPtr, SWIGTYPE_p_f_r_Dali__Vector2__bool.getCPtr(conversionFunction));
249             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
250         }
251
252         internal SWIGTYPE_p_f_r_Dali__Vector2__bool GetScreenToFrameBufferFunction()
253         {
254             global::System.IntPtr cPtr = Interop.RenderTask.RenderTaskGetScreenToFrameBufferFunction(swigCPtr);
255             SWIGTYPE_p_f_r_Dali__Vector2__bool ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_f_r_Dali__Vector2__bool(cPtr, false);
256             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
257             return ret;
258         }
259
260         [EditorBrowsable(EditorBrowsableState.Never)]
261         public void SetScreenToFrameBufferMappingView(View mappingView)
262         {
263             Interop.RenderTask.RenderTaskSetScreenToFrameBufferMappingActor(swigCPtr, View.getCPtr(mappingView));
264             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
265         }
266
267         [EditorBrowsable(EditorBrowsableState.Never)]
268         public View GetScreenToFrameBufferMappingView()
269         {
270             View ret = new View(Interop.RenderTask.RenderTaskGetScreenToFrameBufferMappingActor(swigCPtr), true);
271             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
272             return ret;
273         }
274
275         [EditorBrowsable(EditorBrowsableState.Never)]
276         public void SetViewportPosition(Vector2 position)
277         {
278             Interop.RenderTask.RenderTaskSetViewportPosition(swigCPtr, Vector2.getCPtr(position));
279             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
280         }
281
282         [EditorBrowsable(EditorBrowsableState.Never)]
283         public Vector2 GetCurrentViewportPosition()
284         {
285             Vector2 ret = new Vector2(Interop.RenderTask.RenderTaskGetCurrentViewportPosition(swigCPtr), true);
286             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
287             return ret;
288         }
289
290         [EditorBrowsable(EditorBrowsableState.Never)]
291         public void SetViewportSize(Vector2 size)
292         {
293             Interop.RenderTask.RenderTaskSetViewportSize(swigCPtr, Vector2.getCPtr(size));
294             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
295         }
296
297         [EditorBrowsable(EditorBrowsableState.Never)]
298         public Vector2 GetCurrentViewportSize()
299         {
300             Vector2 ret = new Vector2(Interop.RenderTask.RenderTaskGetCurrentViewportSize(swigCPtr), true);
301             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
302             return ret;
303         }
304
305         [EditorBrowsable(EditorBrowsableState.Never)]
306         public void SetViewport(Rectangle viewport)
307         {
308             Interop.RenderTask.RenderTaskSetViewport(swigCPtr, Rectangle.getCPtr(viewport));
309             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
310         }
311
312         [EditorBrowsable(EditorBrowsableState.Never)]
313         public Rectangle GetViewport()
314         {
315             Rectangle ret = new Rectangle(Interop.RenderTask.RenderTaskGetViewport(swigCPtr), true);
316             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
317             return ret;
318         }
319
320         [EditorBrowsable(EditorBrowsableState.Never)]
321         public void SetClearColor(Vector4 color)
322         {
323             Interop.RenderTask.RenderTaskSetClearColor(swigCPtr, Vector4.getCPtr(color));
324             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
325         }
326
327         [EditorBrowsable(EditorBrowsableState.Never)]
328         public Vector4 GetClearColor()
329         {
330             Vector4 ret = new Vector4(Interop.RenderTask.RenderTaskGetClearColor(swigCPtr), true);
331             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
332             return ret;
333         }
334
335         [EditorBrowsable(EditorBrowsableState.Never)]
336         public void SetClearEnabled(bool enabled)
337         {
338             Interop.RenderTask.RenderTaskSetClearEnabled(swigCPtr, enabled);
339             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
340         }
341
342         [EditorBrowsable(EditorBrowsableState.Never)]
343         public bool GetClearEnabled()
344         {
345             bool ret = Interop.RenderTask.RenderTaskGetClearEnabled(swigCPtr);
346             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
347             return ret;
348         }
349
350         [EditorBrowsable(EditorBrowsableState.Never)]
351         public void SetCullMode(bool cullMode)
352         {
353             Interop.RenderTask.RenderTaskSetCullMode(swigCPtr, cullMode);
354             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
355         }
356
357         [EditorBrowsable(EditorBrowsableState.Never)]
358         public bool GetCullMode()
359         {
360             bool ret = Interop.RenderTask.RenderTaskGetCullMode(swigCPtr);
361             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
362             return ret;
363         }
364
365         [EditorBrowsable(EditorBrowsableState.Never)]
366         public void SetRefreshRate(uint refreshRate)
367         {
368             Interop.RenderTask.RenderTaskSetRefreshRate(swigCPtr, refreshRate);
369             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
370         }
371
372         [EditorBrowsable(EditorBrowsableState.Never)]
373         public uint GetRefreshRate()
374         {
375             uint ret = Interop.RenderTask.RenderTaskGetRefreshRate(swigCPtr);
376             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
377             return ret;
378         }
379
380         [EditorBrowsable(EditorBrowsableState.Never)]
381         public bool WorldToViewport(Vector3 position, out float viewportX, out float viewportY)
382         {
383             bool ret = Interop.RenderTask.RenderTaskWorldToViewport(swigCPtr, Vector3.getCPtr(position), out viewportX, out viewportY);
384             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
385             return ret;
386         }
387
388         [EditorBrowsable(EditorBrowsableState.Never)]
389         public bool ViewportToLocal(View view, float viewportX, float viewportY, out float localX, out float localY)
390         {
391             bool ret = Interop.RenderTask.RenderTaskViewportToLocal(swigCPtr, View.getCPtr(view), viewportX, viewportY, out localX, out localY);
392             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
393             return ret;
394         }
395
396         internal RenderTaskSignal FinishedSignal()
397         {
398             RenderTaskSignal ret = new RenderTaskSignal(Interop.RenderTask.RenderTaskFinishedSignal(swigCPtr), false);
399             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
400             return ret;
401         }
402
403         /// <since_tizen> 3 </since_tizen>
404         public enum RefreshRate
405         {
406             REFRESH_ONCE = 0,
407             REFRESH_ALWAYS = 1
408         }
409
410         [EditorBrowsable(EditorBrowsableState.Never)]
411         public Vector2 ViewportPosition
412         {
413             get
414             {
415                 Vector2 temp = new Vector2(0.0f, 0.0f);
416                 GetProperty(RenderTask.Property.ViewportPosition).Get(temp);
417                 return temp;
418             }
419             set
420             {
421                 SetProperty(RenderTask.Property.ViewportPosition, new Tizen.NUI.PropertyValue(value));
422             }
423         }
424
425         [EditorBrowsable(EditorBrowsableState.Never)]
426         public Vector2 ViewportSize
427         {
428             get
429             {
430                 Vector2 temp = new Vector2(0.0f, 0.0f);
431                 GetProperty(RenderTask.Property.ViewportSize).Get(temp);
432                 return temp;
433             }
434             set
435             {
436                 SetProperty(RenderTask.Property.ViewportSize, new Tizen.NUI.PropertyValue(value));
437             }
438         }
439
440         [EditorBrowsable(EditorBrowsableState.Never)]
441         public Vector4 ClearColor
442         {
443             get
444             {
445                 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
446                 GetProperty(RenderTask.Property.ClearColor).Get(temp);
447                 return temp;
448             }
449             set
450             {
451                 SetProperty(RenderTask.Property.ClearColor, new Tizen.NUI.PropertyValue(value));
452             }
453         }
454
455         [EditorBrowsable(EditorBrowsableState.Never)]
456         public bool RequiresSync
457         {
458             get
459             {
460                 bool temp = false;
461                 GetProperty(RenderTask.Property.RequiresSync).Get(out temp);
462                 return temp;
463             }
464             set
465             {
466                 SetProperty(RenderTask.Property.RequiresSync, new Tizen.NUI.PropertyValue(value));
467             }
468         }
469     }
470 }