[dali_2.3.29] Merge branch 'devel/master'
[platform/core/uifw/dali-csharp-binder.git] / dali-csharp-binder / dali-toolkit / canvas-view-wrap.cpp
1 /*
2  * Copyright (c) 2022 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
18 // EXTERNAL INCLUDES
19 #include <dali/devel-api/adaptor-framework/canvas-renderer/canvas-renderer-drawable-group.h>
20 #include <dali/devel-api/adaptor-framework/canvas-renderer/canvas-renderer-gradient.h>
21 #include <dali/devel-api/adaptor-framework/canvas-renderer/canvas-renderer-linear-gradient.h>
22 #include <dali/devel-api/adaptor-framework/canvas-renderer/canvas-renderer-picture.h>
23 #include <dali/devel-api/adaptor-framework/canvas-renderer/canvas-renderer-radial-gradient.h>
24 #include <dali-toolkit/dali-toolkit.h>
25 #include <dali-toolkit/devel-api/controls/canvas-view/canvas-view.h>
26
27 // INTERNAL INCLUDES
28 #include <dali-csharp-binder/common/common.h>
29
30 using namespace Dali;
31 using namespace Dali::Toolkit;
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 SWIGEXPORT void *SWIGSTDCALL
38 CSharp_Dali_CanvasView_New__SWIG_0(char *pViewBox) {
39   Dali::ImageDimensions viewBox;
40   Dali::Toolkit::CanvasView result;
41
42   if (!pViewBox) {
43     SWIG_CSharpSetPendingExceptionArgument(
44         SWIG_CSharpArgumentNullException,
45         "Attempt to dereference null Dali::ImageDimensions", 0);
46     return 0;
47   }
48   viewBox = *(Dali::ImageDimensions *)pViewBox;
49   {
50     try {
51       result = Dali::Toolkit::CanvasView::New(
52           Vector2(viewBox.GetWidth(), viewBox.GetHeight()));
53     }
54     CALL_CATCH_EXCEPTION(0);
55   }
56
57   return new Dali::Toolkit::CanvasView(
58       (const Dali::Toolkit::CanvasView &)result);
59 }
60
61 SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_CanvasView_New__SWIG_1() {
62   Dali::Toolkit::CanvasView result;
63
64   {
65     try {
66       result = Dali::Toolkit::CanvasView::New();
67     }
68     CALL_CATCH_EXCEPTION(0);
69   }
70
71   return new Dali::Toolkit::CanvasView(
72       (const Dali::Toolkit::CanvasView &)result);
73 }
74
75 SWIGEXPORT bool SWIGSTDCALL
76 CSharp_Dali_CanvasView_AddDrawable(char *pCanvasView, char *pDrawable) {
77   Dali::Toolkit::CanvasView canvasView;
78   Dali::CanvasRenderer::Drawable drawable;
79   bool result = true;
80
81   if (!pCanvasView) {
82     SWIG_CSharpSetPendingExceptionArgument(
83         SWIG_CSharpArgumentNullException,
84         "Attempt to dereference null Dali::Toolkit::CanvasView", 0);
85     return false;
86   }
87   canvasView = *(Dali::Toolkit::CanvasView *)pCanvasView;
88
89   if (!pDrawable) {
90     SWIG_CSharpSetPendingExceptionArgument(
91         SWIG_CSharpArgumentNullException,
92         "Attempt to dereference null Dali::CanvasRenderer::Drawable", 0);
93     return false;
94   }
95   drawable = *(Dali::CanvasRenderer::Drawable *)pDrawable;
96   {
97     try {
98       canvasView.AddDrawable(drawable);
99     }
100     CALL_CATCH_EXCEPTION(0);
101   }
102
103   return result;
104 }
105
106 SWIGEXPORT bool SWIGSTDCALL
107 CSharp_Dali_CanvasView_RemoveDrawable(char *pCanvasView, char *pDrawable) {
108   Dali::Toolkit::CanvasView canvasView;
109   Dali::CanvasRenderer::Drawable drawable;
110   bool result = true;
111
112   if (!pCanvasView) {
113     SWIG_CSharpSetPendingExceptionArgument(
114         SWIG_CSharpArgumentNullException,
115         "Attempt to dereference null Dali::Toolkit::CanvasView", 0);
116     return false;
117   }
118   canvasView = *(Dali::Toolkit::CanvasView *)pCanvasView;
119
120   if (!pDrawable) {
121     SWIG_CSharpSetPendingExceptionArgument(
122         SWIG_CSharpArgumentNullException,
123         "Attempt to dereference null Dali::CanvasRenderer::Drawable", 0);
124     return false;
125   }
126   drawable = *(Dali::CanvasRenderer::Drawable *)pDrawable;
127   {
128     try {
129       canvasView.RemoveDrawable(drawable);
130     }
131     CALL_CATCH_EXCEPTION(0);
132   }
133
134   return result;
135 }
136
137 SWIGEXPORT void SWIGSTDCALL
138 CSharp_Dali_CanvasView_RemoveAllDrawables(char *pCanvasView) {
139   Dali::Toolkit::CanvasView canvasView;
140   Dali::CanvasRenderer::Drawable drawable;
141
142   if (!pCanvasView) {
143     SWIG_CSharpSetPendingExceptionArgument(
144         SWIG_CSharpArgumentNullException,
145         "Attempt to dereference null Dali::Toolkit::CanvasView", 0);
146     return;
147   }
148   canvasView = *(Dali::Toolkit::CanvasView *)pCanvasView;
149
150   {
151     try {
152       canvasView.RemoveAllDrawables();
153     }
154     CALL_CATCH_EXCEPTION();
155   }
156 }
157
158 SWIGEXPORT void SWIGSTDCALL CSharp_Dali_delete_CanvasView(void *pCanvasView) {
159   Dali::Toolkit::CanvasView *pTargetCanvasView = nullptr;
160
161   if (!pCanvasView) {
162     SWIG_CSharpSetPendingExceptionArgument(
163         SWIG_CSharpArgumentNullException,
164         "Attempt to dereference null Dali::Toolkit::CanvasView", 0);
165   }
166
167   pTargetCanvasView = (Dali::Toolkit::CanvasView *)pCanvasView;
168   {
169     try {
170       if (pTargetCanvasView) {
171         delete pTargetCanvasView;
172       }
173     }
174     CALL_CATCH_EXCEPTION();
175   }
176 }
177
178 SWIGEXPORT int SWIGSTDCALL CSharp_Dali_CanvasView_Property_VIEWBOX_get() {
179   return (int)Toolkit::CanvasView::Property::VIEW_BOX;
180 }
181
182 SWIGEXPORT int SWIGSTDCALL CSharp_Dali_CanvasView_Property_SYNCHRONOUS_LOADING_get() {
183   return (int)Toolkit::CanvasView::Property::SYNCHRONOUS_LOADING;
184 }
185
186 // Dali::CanvasRenderer::Drawable Wrapper
187
188 SWIGEXPORT void SWIGSTDCALL CSharp_Dali_Drawable_SetOpacity(char *pDrawable,
189                                                             float opacity) {
190   Dali::CanvasRenderer::Drawable drawable;
191
192   if (!pDrawable) {
193     SWIG_CSharpSetPendingExceptionArgument(
194         SWIG_CSharpArgumentNullException,
195         "Attempt to dereference null Dali::CanvasRenderer::Drawable", 0);
196     return;
197   }
198   drawable = *(Dali::CanvasRenderer::Drawable *)pDrawable;
199
200   {
201     try {
202       drawable.SetOpacity(opacity);
203     }
204     CALL_CATCH_EXCEPTION();
205   }
206 }
207
208 SWIGEXPORT float SWIGSTDCALL CSharp_Dali_Drawable_GetOpacity(char *pDrawable) {
209   Dali::CanvasRenderer::Drawable drawable;
210   float opacity = 0.0f;
211
212   if (!pDrawable) {
213     SWIG_CSharpSetPendingExceptionArgument(
214         SWIG_CSharpArgumentNullException,
215         "Attempt to dereference null Dali::CanvasRenderer::Drawable", 0);
216     return 0.0;
217   }
218   drawable = *(Dali::CanvasRenderer::Drawable *)pDrawable;
219   {
220     try {
221       opacity = drawable.GetOpacity();
222     }
223     CALL_CATCH_EXCEPTION(0);
224   }
225
226   return opacity;
227 }
228
229 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_Drawable_Translate(char *pDrawable,
230                                                            float x, float y) {
231   Dali::CanvasRenderer::Drawable drawable;
232   bool result = false;
233
234   if (!pDrawable) {
235     SWIG_CSharpSetPendingExceptionArgument(
236         SWIG_CSharpArgumentNullException,
237         "Attempt to dereference null Dali::CanvasRenderer::Drawable", 0);
238     return false;
239   }
240   drawable = *(Dali::CanvasRenderer::Drawable *)pDrawable;
241   {
242     try {
243       result = drawable.Translate(Vector2(x, y));
244     }
245     CALL_CATCH_EXCEPTION(false);
246   }
247   return result;
248 }
249
250 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_Drawable_Scale(char *pDrawable,
251                                                        float scale) {
252   Dali::CanvasRenderer::Drawable drawable;
253   bool result = false;
254
255   if (!pDrawable) {
256     SWIG_CSharpSetPendingExceptionArgument(
257         SWIG_CSharpArgumentNullException,
258         "Attempt to dereference null Dali::CanvasRenderer::Drawable", 0);
259     return false;
260   }
261   drawable = *(Dali::CanvasRenderer::Drawable *)pDrawable;
262
263   {
264     try {
265       result = drawable.Scale(scale);
266     }
267     CALL_CATCH_EXCEPTION(false);
268   }
269   return result;
270 }
271
272 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_Drawable_Rotate(char *pDrawable,
273                                                         float degree) {
274   Dali::CanvasRenderer::Drawable drawable;
275   bool result = false;
276
277   if (!pDrawable) {
278     SWIG_CSharpSetPendingExceptionArgument(
279         SWIG_CSharpArgumentNullException,
280         "Attempt to dereference null Dali::CanvasRenderer::Drawable", 0);
281     return false;
282   }
283   drawable = *(Dali::CanvasRenderer::Drawable *)pDrawable;
284   {
285     try {
286       result = drawable.Rotate(Dali::Degree(degree));
287     }
288     CALL_CATCH_EXCEPTION(false);
289   }
290   return result;
291 }
292
293 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_Drawable_Transform(char *pDrawable,
294                                                            float *pTransform) {
295   Dali::CanvasRenderer::Drawable drawable;
296   bool result = false;
297
298   if (!pDrawable) {
299     SWIG_CSharpSetPendingExceptionArgument(
300         SWIG_CSharpArgumentNullException,
301         "Attempt to dereference null Dali::CanvasRenderer::Drawable", 0);
302     return false;
303   }
304   drawable = *(Dali::CanvasRenderer::Drawable *)pDrawable;
305
306   if (!pTransform) {
307     SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException,
308                                            "Dali::Matrix3 const & type is null",
309                                            0);
310     return false;
311   }
312
313   {
314     try {
315       result = drawable.Transform(
316           Dali::Matrix3(pTransform[0], pTransform[1], pTransform[2],
317                         pTransform[3], pTransform[4], pTransform[5],
318                         pTransform[6], pTransform[7], pTransform[8]));
319     }
320     CALL_CATCH_EXCEPTION(0);
321   }
322
323   return result;
324 }
325
326 SWIGEXPORT void *SWIGSTDCALL
327 CSharp_Dali_Drawable_GetBoundingBox(char *pDrawable) {
328   Dali::CanvasRenderer::Drawable drawable;
329   Dali::Rect<float> result;
330
331   if (!pDrawable) {
332     SWIG_CSharpSetPendingExceptionArgument(
333         SWIG_CSharpArgumentNullException,
334         "Attempt to dereference null Dali::CanvasRenderer::Shape", 0);
335     return 0;
336   }
337   drawable = *(Dali::CanvasRenderer::Shape *)pDrawable;
338   {
339     try {
340       result = drawable.GetBoundingBox();
341     }
342     CALL_CATCH_EXCEPTION(0);
343   }
344
345   // Note: The float type Rectangle class is not ready yet.
346   //      Therefore, it transmits data in Vector4 class.
347   //      This type should later be changed to the appropriate data type.
348   return new Dali::Vector4(result.x, result.y, result.width, result.height);
349 }
350
351 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_Drawable_SetClipPath(char *pDrawable,
352                                                              char *pClip) {
353   Dali::CanvasRenderer::Drawable drawable;
354   Dali::CanvasRenderer::Drawable clip;
355   bool result = false;
356
357   if (!pDrawable) {
358     SWIG_CSharpSetPendingExceptionArgument(
359         SWIG_CSharpArgumentNullException,
360         "Attempt to dereference null Dali::CanvasRenderer::Drawable", 0);
361     return false;
362   }
363   drawable = *(Dali::CanvasRenderer::Drawable *)pDrawable;
364
365   if (!pClip) {
366     SWIG_CSharpSetPendingExceptionArgument(
367         SWIG_CSharpArgumentNullException,
368         "Attempt to dereference null Dali::CanvasRenderer::Drawable", 0);
369     return false;
370   }
371   clip = *(Dali::CanvasRenderer::Drawable *)pClip;
372
373   {
374     try {
375       result = drawable.SetClipPath(clip);
376     }
377     CALL_CATCH_EXCEPTION(0);
378   }
379
380   return result;
381 }
382
383 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_Drawable_SetMask(char *pDrawable,
384                                                          char *pMask,
385                                                          int maskType) {
386   Dali::CanvasRenderer::Drawable drawable;
387   Dali::CanvasRenderer::Drawable mask;
388   bool result = false;
389
390   if (!pDrawable) {
391     SWIG_CSharpSetPendingExceptionArgument(
392         SWIG_CSharpArgumentNullException,
393         "Attempt to dereference null Dali::CanvasRenderer::Drawable", 0);
394     return false;
395   }
396   drawable = *(Dali::CanvasRenderer::Drawable *)pDrawable;
397
398   if (!pMask) {
399     SWIG_CSharpSetPendingExceptionArgument(
400         SWIG_CSharpArgumentNullException,
401         "Attempt to dereference null Dali::CanvasRenderer::Drawable", 0);
402     return false;
403   }
404   mask = *(Dali::CanvasRenderer::Drawable *)pMask;
405
406   {
407     try {
408       result = drawable.SetMask(
409           mask,
410           static_cast<Dali::CanvasRenderer::Drawable::MaskType>(maskType));
411     }
412     CALL_CATCH_EXCEPTION(0);
413   }
414
415   return result;
416 }
417
418 // Dali::CanvasRenderer::Picture Wrapper
419
420 SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_Picture_New() {
421   Dali::CanvasRenderer::Picture picture;
422
423   {
424     try {
425       picture = Dali::CanvasRenderer::Picture::New();
426     }
427     CALL_CATCH_EXCEPTION(0);
428   }
429
430   return new Dali::CanvasRenderer::Picture(
431       (const Dali::CanvasRenderer::Picture &)picture);
432 }
433
434 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_Picture_Load(char *pPicture,
435                                                      char *pUrl) {
436   Dali::CanvasRenderer::Picture picture;
437   bool result = false;
438
439   if (!pPicture) {
440     SWIG_CSharpSetPendingExceptionArgument(
441         SWIG_CSharpArgumentNullException,
442         "Attempt to dereference null Dali::CanvasRenderer::Picture", 0);
443     return false;
444   }
445   picture = *(Dali::CanvasRenderer::Picture *)pPicture;
446
447   if (!pUrl) {
448     SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException,
449                                            "Attempt to dereference null string",
450                                            0);
451     return false;
452   }
453   std::string url(pUrl);
454
455   {
456     try {
457       result = picture.Load(url);
458     }
459     CALL_CATCH_EXCEPTION(0);
460   }
461
462   return result;
463 }
464
465 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_Picture_SetSize(char *pPicture,
466                                                         void *pSize) {
467   Dali::CanvasRenderer::Picture picture;
468   bool result = false;
469
470   if (!pPicture) {
471     SWIG_CSharpSetPendingExceptionArgument(
472         SWIG_CSharpArgumentNullException,
473         "Attempt to dereference null Dali::CanvasRenderer::Picture", 0);
474     return false;
475   }
476   picture = *(Dali::CanvasRenderer::Picture *)pPicture;
477
478   if (!pSize) {
479     SWIG_CSharpSetPendingExceptionArgument(
480         SWIG_CSharpArgumentNullException,
481         "Attempt to dereference null Dali::Vector2", 0);
482     return false;
483   }
484
485   {
486     try {
487       result = picture.SetSize(*(Dali::Vector2 *)pSize);
488     }
489     CALL_CATCH_EXCEPTION(0);
490   }
491
492   return result;
493 }
494
495 SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_Picture_GetSize(char *pPicture) {
496   Dali::CanvasRenderer::Picture picture;
497   Dali::Vector2 result;
498
499   if (!pPicture) {
500     SWIG_CSharpSetPendingExceptionArgument(
501         SWIG_CSharpArgumentNullException,
502         "Attempt to dereference null Dali::CanvasRenderer::Picture", 0);
503     return nullptr;
504   }
505   picture = *(Dali::CanvasRenderer::Picture *)pPicture;
506
507   {
508     try {
509       result = picture.GetSize();
510     }
511     CALL_CATCH_EXCEPTION(0);
512   }
513
514   return new Dali::Vector2((const Dali::Vector2 &)result);
515 }
516
517 // Dali::CanvasRenderer::Shape Wrapper
518
519 SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_Shape_New() {
520   Dali::CanvasRenderer::Shape shape;
521
522   {
523     try {
524       shape = Dali::CanvasRenderer::Shape::New();
525     }
526     CALL_CATCH_EXCEPTION(0);
527   }
528
529   return new Dali::CanvasRenderer::Shape(
530       (const Dali::CanvasRenderer::Shape &)shape);
531 }
532
533 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_Shape_AddRect(char *pShape, float x,
534                                                       float y, float width,
535                                                       float height,
536                                                       float roundX,
537                                                       float roundY) {
538   Dali::CanvasRenderer::Shape shape;
539   bool result = false;
540
541   if (!pShape) {
542     SWIG_CSharpSetPendingExceptionArgument(
543         SWIG_CSharpArgumentNullException,
544         "Attempt to dereference null Dali::CanvasRenderer::Shape", 0);
545     return false;
546   }
547   shape = *(Dali::CanvasRenderer::Shape *)pShape;
548
549   {
550     try {
551       result = shape.AddRect(Rect<float>(x, y, width, height),
552                              Vector2(roundX, roundY));
553     }
554     CALL_CATCH_EXCEPTION(0);
555   }
556
557   return result;
558 }
559
560 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_Shape_AddCircle(char *pShape, float x,
561                                                         float y, float radiusX,
562                                                         float radiusY) {
563   Dali::CanvasRenderer::Shape shape;
564   bool result = false;
565
566   if (!pShape) {
567     SWIG_CSharpSetPendingExceptionArgument(
568         SWIG_CSharpArgumentNullException,
569         "Attempt to dereference null Dali::CanvasRenderer::Shape", 0);
570     return false;
571   }
572   shape = *(Dali::CanvasRenderer::Shape *)pShape;
573
574   {
575     try {
576       result = shape.AddCircle(Vector2(x, y), Vector2(radiusX, radiusY));
577     }
578     CALL_CATCH_EXCEPTION(0);
579   }
580
581   return result;
582 }
583
584 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_Shape_AddArc(char *pShape, float x,
585                                                      float y, float radius,
586                                                      float startAngle,
587                                                      float sweep, bool pie) {
588   Dali::CanvasRenderer::Shape shape;
589   bool result = false;
590
591   if (!pShape) {
592     SWIG_CSharpSetPendingExceptionArgument(
593         SWIG_CSharpArgumentNullException,
594         "Attempt to dereference null Dali::CanvasRenderer::Shape", 0);
595     return false;
596   }
597   shape = *(Dali::CanvasRenderer::Shape *)pShape;
598
599   {
600     try {
601       result = shape.AddArc(Vector2(x, y), radius, startAngle, sweep, pie);
602     }
603     CALL_CATCH_EXCEPTION(0);
604   }
605
606   return result;
607 }
608
609 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_Shape_AddMoveTo(char *pShape, float x,
610                                                         float y) {
611   Dali::CanvasRenderer::Shape shape;
612   bool result = false;
613
614   if (!pShape) {
615     SWIG_CSharpSetPendingExceptionArgument(
616         SWIG_CSharpArgumentNullException,
617         "Attempt to dereference null Dali::CanvasRenderer::Shape", 0);
618     return false;
619   }
620   shape = *(Dali::CanvasRenderer::Shape *)pShape;
621
622   {
623     try {
624       result = shape.AddMoveTo(Vector2(x, y));
625     }
626     CALL_CATCH_EXCEPTION(0);
627   }
628
629   return result;
630 }
631
632 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_Shape_AddLineTo(char *pShape, float x,
633                                                         float y) {
634   Dali::CanvasRenderer::Shape shape;
635   bool result = false;
636
637   if (!pShape) {
638     SWIG_CSharpSetPendingExceptionArgument(
639         SWIG_CSharpArgumentNullException,
640         "Attempt to dereference null Dali::CanvasRenderer::Shape", 0);
641     return false;
642   }
643   shape = *(Dali::CanvasRenderer::Shape *)pShape;
644
645   {
646     try {
647       result = shape.AddLineTo(Vector2(x, y));
648     }
649     CALL_CATCH_EXCEPTION(0);
650   }
651
652   return result;
653 }
654
655 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_Shape_AddCubicTo(
656     char *pShape, float controlPoint1X, float controlPoint1Y,
657     float controlPoint2X, float controlPoint2Y, float endPointX,
658     float endPointY) {
659   Dali::CanvasRenderer::Shape shape;
660   bool result = false;
661
662   if (!pShape) {
663     SWIG_CSharpSetPendingExceptionArgument(
664         SWIG_CSharpArgumentNullException,
665         "Attempt to dereference null Dali::CanvasRenderer::Shape", 0);
666     return false;
667   }
668   shape = *(Dali::CanvasRenderer::Shape *)pShape;
669
670   {
671     try {
672       result = shape.AddCubicTo(Vector2(controlPoint1X, controlPoint1Y),
673                                 Vector2(controlPoint2X, controlPoint2Y),
674                                 Vector2(endPointX, endPointY));
675     }
676     CALL_CATCH_EXCEPTION(0);
677   }
678
679   return result;
680 }
681
682 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_Shape_AddPath(char *pShape,
683                                                       int *pCommands,
684                                                       unsigned int commandCount,
685                                                       float *pPoints,
686                                                       unsigned int pointCount) {
687   Dali::CanvasRenderer::Shape shape;
688   bool result = false;
689
690   if (!pShape) {
691     SWIG_CSharpSetPendingExceptionArgument(
692         SWIG_CSharpArgumentNullException,
693         "Attempt to dereference null Dali::CanvasRenderer::Shape", 0);
694     return false;
695   }
696   shape = *(Dali::CanvasRenderer::Shape *)pShape;
697
698   if (!pCommands) {
699     SWIG_CSharpSetPendingExceptionArgument(
700         SWIG_CSharpArgumentNullException,
701         "Attempt to dereference null Commands", 0);
702     return false;
703   }
704
705   if (!pPoints) {
706     SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException,
707                                            "Attempt to dereference null Points",
708                                            0);
709     return false;
710   }
711
712   {
713     try {
714       Dali::CanvasRenderer::Shape::PathCommands pathCommands = {
715           (Dali::CanvasRenderer::Shape::PathCommandType *)pCommands,
716           commandCount, pPoints, pointCount};
717
718       result = shape.AddPath(pathCommands);
719     }
720     CALL_CATCH_EXCEPTION(0);
721   }
722
723   return result;
724 }
725
726 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_Shape_Close(char *pShape) {
727   Dali::CanvasRenderer::Shape shape;
728   bool result = false;
729
730   if (!pShape) {
731     SWIG_CSharpSetPendingExceptionArgument(
732         SWIG_CSharpArgumentNullException,
733         "Attempt to dereference null Dali::CanvasRenderer::Shape", 0);
734     return false;
735   }
736   shape = *(Dali::CanvasRenderer::Shape *)pShape;
737
738   {
739     try {
740       result = shape.Close();
741     }
742     CALL_CATCH_EXCEPTION(0);
743   }
744
745   return result;
746 }
747
748 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_Shape_ResetPath(char *pShape) {
749   Dali::CanvasRenderer::Shape shape;
750   bool result = false;
751
752   if (!pShape) {
753     SWIG_CSharpSetPendingExceptionArgument(
754         SWIG_CSharpArgumentNullException,
755         "Attempt to dereference null Dali::CanvasRenderer::Shape", 0);
756     return false;
757   }
758   shape = *(Dali::CanvasRenderer::Shape *)pShape;
759
760   {
761     try {
762       result = shape.ResetPath();
763     }
764     CALL_CATCH_EXCEPTION(0);
765   }
766
767   return result;
768 }
769
770 SWIGEXPORT void SWIGSTDCALL CSharp_Dali_Shape_SetFillColor(char *pShape,
771                                                            char *pColor) {
772   Dali::CanvasRenderer::Shape shape;
773   Dali::Vector4 color;
774
775   if (!pShape) {
776     SWIG_CSharpSetPendingExceptionArgument(
777         SWIG_CSharpArgumentNullException,
778         "Attempt to dereference null Dali::CanvasRenderer::Shape", 0);
779     return;
780   }
781   shape = *(Dali::CanvasRenderer::Shape *)pShape;
782
783   if (!pColor) {
784     SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException,
785                                            "Dali::Vector4 const & type is null",
786                                            0);
787     return;
788   }
789   color = *(Dali::Vector4 *)pColor;
790
791   {
792     try {
793       shape.SetFillColor(color);
794     }
795     CALL_CATCH_EXCEPTION();
796   }
797 }
798
799 SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_Shape_GetFillColor(char *pShape) {
800   Dali::CanvasRenderer::Shape shape;
801   Dali::Vector4 result;
802
803   if (!pShape) {
804     SWIG_CSharpSetPendingExceptionArgument(
805         SWIG_CSharpArgumentNullException,
806         "Attempt to dereference null Dali::CanvasRenderer::Shape", 0);
807     return 0;
808   }
809   shape = *(Dali::CanvasRenderer::Shape *)pShape;
810
811   {
812     try {
813       result = shape.GetFillColor();
814     }
815     CALL_CATCH_EXCEPTION(0);
816   }
817
818   return new Dali::Vector4((const Dali::Vector4 &)result);
819 }
820
821 SWIGEXPORT void SWIGSTDCALL CSharp_Dali_Shape_SetFillRule(char *pShape,
822                                                           int rule) {
823   Dali::CanvasRenderer::Shape shape;
824
825   if (!pShape) {
826     SWIG_CSharpSetPendingExceptionArgument(
827         SWIG_CSharpArgumentNullException,
828         "Attempt to dereference null Dali::CanvasRenderer::Shape", 0);
829     return;
830   }
831   shape = *(Dali::CanvasRenderer::Shape *)pShape;
832
833   {
834     try {
835       shape.SetFillRule(
836           static_cast<Dali::CanvasRenderer::Shape::FillRule>(rule));
837     }
838     CALL_CATCH_EXCEPTION();
839   }
840 }
841
842 SWIGEXPORT int SWIGSTDCALL CSharp_Dali_Shape_GetFillRule(char *pShape) {
843   Dali::CanvasRenderer::Shape shape;
844   Dali::CanvasRenderer::Shape::FillRule result;
845
846   if (!pShape) {
847     SWIG_CSharpSetPendingExceptionArgument(
848         SWIG_CSharpArgumentNullException,
849         "Attempt to dereference null Dali::CanvasRenderer::Shape", 0);
850     return 0;
851   }
852   shape = *(Dali::CanvasRenderer::Shape *)pShape;
853
854   {
855     try {
856       result = shape.GetFillRule();
857     }
858     CALL_CATCH_EXCEPTION(0);
859   }
860
861   return (int)result;
862 }
863
864 SWIGEXPORT void SWIGSTDCALL CSharp_Dali_Shape_SetStrokeWidth(char *pShape,
865                                                              float width) {
866   Dali::CanvasRenderer::Shape shape;
867
868   if (!pShape) {
869     SWIG_CSharpSetPendingExceptionArgument(
870         SWIG_CSharpArgumentNullException,
871         "Attempt to dereference null Dali::CanvasRenderer::Shape", 0);
872     return;
873   }
874   shape = *(Dali::CanvasRenderer::Shape *)pShape;
875
876   {
877     try {
878       shape.SetStrokeWidth(width);
879     }
880     CALL_CATCH_EXCEPTION();
881   }
882 }
883
884 SWIGEXPORT float SWIGSTDCALL CSharp_Dali_Shape_GetStrokeWidth(char *pShape) {
885   Dali::CanvasRenderer::Shape shape;
886   float result;
887
888   if (!pShape) {
889     SWIG_CSharpSetPendingExceptionArgument(
890         SWIG_CSharpArgumentNullException,
891         "Attempt to dereference null Dali::CanvasRenderer::Shape", 0);
892     return 0;
893   }
894   shape = *(Dali::CanvasRenderer::Shape *)pShape;
895
896   {
897     try {
898       result = shape.GetStrokeWidth();
899     }
900     CALL_CATCH_EXCEPTION(0);
901   }
902
903   return result;
904 }
905
906 SWIGEXPORT void SWIGSTDCALL CSharp_Dali_Shape_SetStrokeColor(char *pShape,
907                                                              char *pColor) {
908   Dali::CanvasRenderer::Shape shape;
909   Dali::Vector4 color;
910
911   if (!pShape) {
912     SWIG_CSharpSetPendingExceptionArgument(
913         SWIG_CSharpArgumentNullException,
914         "Attempt to dereference null Dali::CanvasRenderer::Shape", 0);
915     return;
916   }
917   shape = *(Dali::CanvasRenderer::Shape *)pShape;
918
919   if (!pColor) {
920     SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException,
921                                            "Dali::Vector4 const & type is null",
922                                            0);
923     return;
924   }
925   color = *(Dali::Vector4 *)pColor;
926   {
927     try {
928       shape.SetStrokeColor(color);
929     }
930     CALL_CATCH_EXCEPTION();
931   }
932 }
933
934 SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_Shape_GetStrokeColor(char *pShape) {
935   Dali::CanvasRenderer::Shape shape;
936   Dali::Vector4 result;
937
938   if (!pShape) {
939     SWIG_CSharpSetPendingExceptionArgument(
940         SWIG_CSharpArgumentNullException,
941         "Attempt to dereference null Dali::CanvasRenderer::Shape", 0);
942     return 0;
943   }
944   shape = *(Dali::CanvasRenderer::Shape *)pShape;
945   {
946     try {
947       result = shape.GetStrokeColor();
948     }
949     CALL_CATCH_EXCEPTION(0);
950   }
951
952   return new Dali::Vector4((const Dali::Vector4 &)result);
953 }
954
955 SWIGEXPORT void SWIGSTDCALL CSharp_Dali_Shape_SetStrokeDash(
956     char *pShape, float *pDashPattern, unsigned int patternLength) {
957   Dali::CanvasRenderer::Shape shape;
958
959   if (!pShape) {
960     SWIG_CSharpSetPendingExceptionArgument(
961         SWIG_CSharpArgumentNullException,
962         "Attempt to dereference null Dali::CanvasRenderer::Shape", 0);
963     return;
964   }
965   shape = *(Dali::CanvasRenderer::Shape *)pShape;
966
967   if (!pDashPattern) {
968     SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException,
969                                            "Dash pattern is null", 0);
970     return;
971   }
972
973   {
974     try {
975       Vector<float> dashPattern;
976       for (unsigned int count = 0; count < patternLength; count++) {
977         dashPattern.PushBack(pDashPattern[count]);
978       }
979       shape.SetStrokeDash(dashPattern);
980     }
981     CALL_CATCH_EXCEPTION();
982   }
983 }
984
985 SWIGEXPORT unsigned int SWIGSTDCALL
986 CSharp_Dali_Shape_GetStrokeDashCount(char *pShape) {
987   Dali::CanvasRenderer::Shape shape;
988   unsigned int result;
989
990   if (!pShape) {
991     SWIG_CSharpSetPendingExceptionArgument(
992         SWIG_CSharpArgumentNullException,
993         "Attempt to dereference null Dali::CanvasRenderer::Shape", 0);
994     return 0;
995   }
996   shape = *(Dali::CanvasRenderer::Shape *)pShape;
997
998   {
999     try {
1000
1001       Dali::Vector<float> dashPattern = shape.GetStrokeDash();
1002       result = dashPattern.Size();
1003     }
1004     CALL_CATCH_EXCEPTION(0);
1005   }
1006
1007   return result;
1008 }
1009
1010 SWIGEXPORT float SWIGSTDCALL
1011 CSharp_Dali_Shape_GetStrokeDashIndexOf(char *pShape, unsigned int index) {
1012   Dali::CanvasRenderer::Shape shape;
1013   float result = 0.0f;
1014
1015   if (!pShape) {
1016     SWIG_CSharpSetPendingExceptionArgument(
1017         SWIG_CSharpArgumentNullException,
1018         "Attempt to dereference null Dali::CanvasRenderer::Shape", 0);
1019     return 0;
1020   }
1021   shape = *(Dali::CanvasRenderer::Shape *)pShape;
1022
1023   {
1024     try {
1025       Dali::Vector<float> dashPattern = shape.GetStrokeDash();
1026       if (index >= dashPattern.Size()) {
1027         throw std::invalid_argument("invalid index");
1028       }
1029       result = dashPattern[index];
1030     }
1031     CALL_CATCH_EXCEPTION(0);
1032   }
1033
1034   return result;
1035 }
1036
1037 SWIGEXPORT void SWIGSTDCALL CSharp_Dali_Shape_SetStrokeCap(char *pShape,
1038                                                            int cap) {
1039   Dali::CanvasRenderer::Shape shape;
1040
1041   if (!pShape) {
1042     SWIG_CSharpSetPendingExceptionArgument(
1043         SWIG_CSharpArgumentNullException,
1044         "Attempt to dereference null Dali::CanvasRenderer::Shape", 0);
1045     return;
1046   }
1047   shape = *(Dali::CanvasRenderer::Shape *)pShape;
1048
1049   {
1050     try {
1051       shape.SetStrokeCap(
1052           static_cast<Dali::CanvasRenderer::Shape::StrokeCap>(cap));
1053     }
1054     CALL_CATCH_EXCEPTION();
1055   }
1056 }
1057
1058 SWIGEXPORT int SWIGSTDCALL CSharp_Dali_Shape_GetStrokeCap(char *pShape) {
1059   Dali::CanvasRenderer::Shape shape;
1060   Dali::CanvasRenderer::Shape::StrokeCap result;
1061
1062   if (!pShape) {
1063     SWIG_CSharpSetPendingExceptionArgument(
1064         SWIG_CSharpArgumentNullException,
1065         "Attempt to dereference null Dali::CanvasRenderer::Shape", 0);
1066     return 0;
1067   }
1068   shape = *(Dali::CanvasRenderer::Shape *)pShape;
1069
1070   {
1071     try {
1072       result = shape.GetStrokeCap();
1073     }
1074     CALL_CATCH_EXCEPTION(0);
1075   }
1076
1077   return (int)result;
1078 }
1079
1080 SWIGEXPORT void SWIGSTDCALL CSharp_Dali_Shape_SetStrokeJoin(char *pShape,
1081                                                             int join) {
1082   Dali::CanvasRenderer::Shape shape;
1083
1084   if (!pShape) {
1085     SWIG_CSharpSetPendingExceptionArgument(
1086         SWIG_CSharpArgumentNullException,
1087         "Attempt to dereference null Dali::CanvasRenderer::Shape", 0);
1088     return;
1089   }
1090   shape = *(Dali::CanvasRenderer::Shape *)pShape;
1091
1092   {
1093     try {
1094       shape.SetStrokeJoin(
1095           static_cast<Dali::CanvasRenderer::Shape::StrokeJoin>(join));
1096     }
1097     CALL_CATCH_EXCEPTION();
1098   }
1099 }
1100
1101 SWIGEXPORT int SWIGSTDCALL CSharp_Dali_Shape_GetStrokeJoin(char *pShape) {
1102   Dali::CanvasRenderer::Shape shape;
1103   Dali::CanvasRenderer::Shape::StrokeJoin result;
1104
1105   if (!pShape) {
1106     SWIG_CSharpSetPendingExceptionArgument(
1107         SWIG_CSharpArgumentNullException,
1108         "Attempt to dereference null Dali::CanvasRenderer::Shape", 0);
1109     return 0;
1110   }
1111   shape = *(Dali::CanvasRenderer::Shape *)pShape;
1112   {
1113     try {
1114       result = shape.GetStrokeJoin();
1115     }
1116     CALL_CATCH_EXCEPTION(0);
1117   }
1118
1119   return (int)result;
1120 }
1121
1122 SWIGEXPORT bool SWIGSTDCALL
1123 CSharp_Dali_Shapep_SetFillGradient(char *pShape, char *pGradient) {
1124   Dali::CanvasRenderer::Shape shape;
1125   Dali::CanvasRenderer::Gradient gradient;
1126   bool result = true;
1127
1128   if (!pShape) {
1129     SWIG_CSharpSetPendingExceptionArgument(
1130         SWIG_CSharpArgumentNullException,
1131         "Attempt to dereference null Dali::CanvasRenderer::Shape", 0);
1132     return false;
1133   }
1134   shape = *(Dali::CanvasRenderer::Shape *)pShape;
1135
1136   if (!pGradient) {
1137     SWIG_CSharpSetPendingExceptionArgument(
1138         SWIG_CSharpArgumentNullException,
1139         "Attempt to dereference null Dali::CanvasRenderer::Gradient", 0);
1140     return false;
1141   }
1142   gradient = *(Dali::CanvasRenderer::Gradient *)pGradient;
1143   {
1144     try {
1145       result = shape.SetFillGradient(gradient);
1146     }
1147     CALL_CATCH_EXCEPTION(0);
1148   }
1149
1150   return result;
1151 }
1152
1153 SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_Shapep_GetFillGradient(char *pShape) {
1154   Dali::CanvasRenderer::Shape shape;
1155   Dali::CanvasRenderer::Gradient gradient;
1156
1157   if (!pShape) {
1158     SWIG_CSharpSetPendingExceptionArgument(
1159         SWIG_CSharpArgumentNullException,
1160         "Attempt to dereference null Dali::CanvasRenderer::Shape", 0);
1161     return nullptr;
1162   }
1163   shape = *(Dali::CanvasRenderer::Shape *)pShape;
1164
1165   {
1166     try {
1167       gradient = shape.GetFillGradient();
1168     }
1169     CALL_CATCH_EXCEPTION(nullptr);
1170   }
1171
1172   return new Dali::CanvasRenderer::Gradient(
1173       (const Dali::CanvasRenderer::Gradient &)gradient);
1174 }
1175
1176 SWIGEXPORT bool SWIGSTDCALL
1177 CSharp_Dali_Shapep_SetStrokeGradient(char *pShape, char *pGradient) {
1178   Dali::CanvasRenderer::Shape shape;
1179   Dali::CanvasRenderer::Gradient gradient;
1180   bool result = true;
1181
1182   if (!pShape) {
1183     SWIG_CSharpSetPendingExceptionArgument(
1184         SWIG_CSharpArgumentNullException,
1185         "Attempt to dereference null Dali::CanvasRenderer::Shape", 0);
1186     return false;
1187   }
1188   shape = *(Dali::CanvasRenderer::Shape *)pShape;
1189
1190   if (!pGradient) {
1191     SWIG_CSharpSetPendingExceptionArgument(
1192         SWIG_CSharpArgumentNullException,
1193         "Attempt to dereference null Dali::CanvasRenderer::Gradient", 0);
1194     return false;
1195   }
1196   gradient = *(Dali::CanvasRenderer::Gradient *)pGradient;
1197   {
1198     try {
1199       shape.SetStrokeGradient(gradient);
1200     }
1201     CALL_CATCH_EXCEPTION(0);
1202   }
1203
1204   return result;
1205 }
1206
1207 SWIGEXPORT void *SWIGSTDCALL
1208 CSharp_Dali_Shapep_GetStrokeGradient(char *pShape) {
1209   Dali::CanvasRenderer::Shape shape;
1210   Dali::CanvasRenderer::Gradient gradient;
1211
1212   if (!pShape) {
1213     SWIG_CSharpSetPendingExceptionArgument(
1214         SWIG_CSharpArgumentNullException,
1215         "Attempt to dereference null Dali::CanvasRenderer::Shape", 0);
1216     return nullptr;
1217   }
1218   shape = *(Dali::CanvasRenderer::Shape *)pShape;
1219
1220   {
1221     try {
1222       gradient = shape.GetStrokeGradient();
1223     }
1224     CALL_CATCH_EXCEPTION(nullptr);
1225   }
1226
1227   return new Dali::CanvasRenderer::Gradient(
1228       (const Dali::CanvasRenderer::Gradient &)gradient);
1229 }
1230
1231 // Dali::CanvasRenderer::DrawableGroup Wrapper
1232
1233 SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_DrawableGroup_New() {
1234   Dali::CanvasRenderer::DrawableGroup drawableGroup;
1235
1236   {
1237     try {
1238       drawableGroup = Dali::CanvasRenderer::DrawableGroup::New();
1239     }
1240     CALL_CATCH_EXCEPTION(0);
1241   }
1242
1243   return new Dali::CanvasRenderer::DrawableGroup(
1244       (const Dali::CanvasRenderer::DrawableGroup &)drawableGroup);
1245 }
1246
1247 SWIGEXPORT bool SWIGSTDCALL
1248 CSharp_Dali_DrawableGroup_AddDrawable(char *pDrawableGroup, char *pDrawable) {
1249   Dali::CanvasRenderer::DrawableGroup drawableGroup;
1250   Dali::CanvasRenderer::Drawable drawable;
1251   bool result = true;
1252
1253   if (!pDrawableGroup) {
1254     SWIG_CSharpSetPendingExceptionArgument(
1255         SWIG_CSharpArgumentNullException,
1256         "Attempt to dereference null Dali::CanvasRenderer::DrawableGroup", 0);
1257     return false;
1258   }
1259   drawableGroup = *(Dali::CanvasRenderer::DrawableGroup *)pDrawableGroup;
1260
1261   if (!pDrawable) {
1262     SWIG_CSharpSetPendingExceptionArgument(
1263         SWIG_CSharpArgumentNullException,
1264         "Attempt to dereference null Dali::CanvasRenderer::Drawable", 0);
1265     return false;
1266   }
1267   drawable = *(Dali::CanvasRenderer::Drawable *)pDrawable;
1268   {
1269     try {
1270       drawableGroup.AddDrawable(drawable);
1271     }
1272     CALL_CATCH_EXCEPTION(0);
1273   }
1274
1275   return result;
1276 }
1277
1278 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_DrawableGroup_RemoveDrawable(
1279     char *pDrawableGroup, char *pDrawable) {
1280   Dali::CanvasRenderer::DrawableGroup drawableGroup;
1281   Dali::CanvasRenderer::Drawable drawable;
1282   bool result = true;
1283
1284   if (!pDrawableGroup) {
1285     SWIG_CSharpSetPendingExceptionArgument(
1286         SWIG_CSharpArgumentNullException,
1287         "Attempt to dereference null Dali::CanvasRenderer::DrawableGroup", 0);
1288     return false;
1289   }
1290   drawableGroup = *(Dali::CanvasRenderer::DrawableGroup *)pDrawableGroup;
1291
1292   if (!pDrawable) {
1293     SWIG_CSharpSetPendingExceptionArgument(
1294         SWIG_CSharpArgumentNullException,
1295         "Attempt to dereference null Dali::CanvasRenderer::Drawable", 0);
1296     return false;
1297   }
1298   drawable = *(Dali::CanvasRenderer::Drawable *)pDrawable;
1299   {
1300     try {
1301       drawableGroup.RemoveDrawable(drawable);
1302     }
1303     CALL_CATCH_EXCEPTION(0);
1304   }
1305
1306   return result;
1307 }
1308
1309 SWIGEXPORT bool SWIGSTDCALL
1310 CSharp_Dali_DrawableGroup_RemoveAllDrawables(char *pDrawableGroup) {
1311   Dali::CanvasRenderer::DrawableGroup drawableGroup;
1312   bool result = false;
1313
1314   if (!pDrawableGroup) {
1315     SWIG_CSharpSetPendingExceptionArgument(
1316         SWIG_CSharpArgumentNullException,
1317         "Attempt to dereference null Dali::CanvasRenderer::DrawableGroup", 0);
1318     return false;
1319   }
1320   drawableGroup = *(Dali::CanvasRenderer::DrawableGroup *)pDrawableGroup;
1321
1322   {
1323     try {
1324       result = drawableGroup.RemoveAllDrawables();
1325     }
1326     CALL_CATCH_EXCEPTION(0);
1327   }
1328
1329   return result;
1330 }
1331
1332 // Dali::CanvasRenderer::Gradient Wrapper
1333
1334 SWIGEXPORT void SWIGSTDCALL CSharp_Dali_Gradient_SetColorStops(
1335     char *pGradient, float *pStops, unsigned int stopsLength) {
1336   Dali::CanvasRenderer::Gradient gradient;
1337
1338   if (!pGradient) {
1339     SWIG_CSharpSetPendingExceptionArgument(
1340         SWIG_CSharpArgumentNullException,
1341         "Attempt to dereference null Dali::CanvasRenderer::Gradient", 0);
1342     return;
1343   }
1344   gradient = *(Dali::CanvasRenderer::Gradient *)pGradient;
1345
1346   if (!pStops) {
1347     SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException,
1348                                            "Stops is null", 0);
1349     return;
1350   }
1351
1352   {
1353     try {
1354       Dali::CanvasRenderer::Gradient::ColorStops stops;
1355       for (unsigned int count = 0; count < stopsLength; count++) {
1356         Dali::CanvasRenderer::Gradient::ColorStop stop;
1357         stop.offset = pStops[count * 5];
1358         stop.color = Vector4(pStops[(count * 5) + 1], pStops[(count * 5) + 2],
1359                              pStops[(count * 5) + 3], pStops[(count * 5) + 4]);
1360         stops.PushBack(stop);
1361       }
1362       gradient.SetColorStops(stops);
1363     }
1364     CALL_CATCH_EXCEPTION();
1365   }
1366 }
1367
1368 SWIGEXPORT unsigned int SWIGSTDCALL
1369 CSharp_Dali_Gradient_GetColorStopsCount(char *pGradient) {
1370   Dali::CanvasRenderer::Gradient gradient;
1371   unsigned int result = 0;
1372
1373   if (!pGradient) {
1374     SWIG_CSharpSetPendingExceptionArgument(
1375         SWIG_CSharpArgumentNullException,
1376         "Attempt to dereference null Dali::CanvasRenderer::Gradient", 0);
1377     return 0;
1378   }
1379   gradient = *(Dali::CanvasRenderer::Gradient *)pGradient;
1380
1381   {
1382     try {
1383       Dali::CanvasRenderer::Gradient::ColorStops colorStops =
1384           gradient.GetColorStops();
1385       result = colorStops.Size();
1386     }
1387     CALL_CATCH_EXCEPTION(0);
1388   }
1389
1390   return result;
1391 }
1392
1393 SWIGEXPORT float SWIGSTDCALL CSharp_Dali_Gradient_GetColorStopsOffsetIndexOf(
1394     char *pGradient, unsigned int index) {
1395   Dali::CanvasRenderer::Gradient gradient;
1396   float result = 0.0f;
1397
1398   if (!pGradient) {
1399     SWIG_CSharpSetPendingExceptionArgument(
1400         SWIG_CSharpArgumentNullException,
1401         "Attempt to dereference null Dali::CanvasRenderer::Gradient", 0);
1402     return 0.0f;
1403   }
1404   gradient = *(Dali::CanvasRenderer::Gradient *)pGradient;
1405
1406   {
1407     try {
1408       Dali::CanvasRenderer::Gradient::ColorStops colorStops =
1409           gradient.GetColorStops();
1410       if (index >= colorStops.Size()) {
1411         throw std::invalid_argument("invalid index");
1412       }
1413       result = colorStops[index].offset;
1414     }
1415     CALL_CATCH_EXCEPTION(0.0f);
1416   }
1417
1418   return result;
1419 }
1420
1421 SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_Gradient_GetColorStopsColorIndexOf(
1422     char *pGradient, unsigned int index) {
1423   Dali::CanvasRenderer::Gradient gradient;
1424   Dali::Vector4 result;
1425
1426   if (!pGradient) {
1427     SWIG_CSharpSetPendingExceptionArgument(
1428         SWIG_CSharpArgumentNullException,
1429         "Attempt to dereference null Dali::CanvasRenderer::Gradient", 0);
1430     return nullptr;
1431   }
1432   gradient = *(Dali::CanvasRenderer::Gradient *)pGradient;
1433
1434   {
1435     try {
1436       Dali::CanvasRenderer::Gradient::ColorStops colorStops =
1437           gradient.GetColorStops();
1438       if (index >= colorStops.Size()) {
1439         throw std::invalid_argument("invalid index");
1440       }
1441       result = colorStops[index].color;
1442     }
1443     CALL_CATCH_EXCEPTION(nullptr);
1444   }
1445
1446   return new Dali::Vector4((const Dali::Vector4 &)result);
1447 }
1448
1449 SWIGEXPORT void SWIGSTDCALL CSharp_Dali_Gradient_SetSpread(char *pGradient,
1450                                                            int spread) {
1451   Dali::CanvasRenderer::Gradient gradient;
1452
1453   if (!pGradient) {
1454     SWIG_CSharpSetPendingExceptionArgument(
1455         SWIG_CSharpArgumentNullException,
1456         "Attempt to dereference null Dali::CanvasRenderer::Gradient", 0);
1457     return;
1458   }
1459   gradient = *(Dali::CanvasRenderer::Gradient *)pGradient;
1460
1461   {
1462     try {
1463       gradient.SetSpread(
1464           static_cast<Dali::CanvasRenderer::Gradient::Spread>(spread));
1465     }
1466     CALL_CATCH_EXCEPTION();
1467   }
1468 }
1469
1470 SWIGEXPORT int SWIGSTDCALL CSharp_Dali_Gradient_GetSpread(char *pGradient) {
1471   Dali::CanvasRenderer::Gradient gradient;
1472   Dali::CanvasRenderer::Gradient::Spread result;
1473
1474   if (!pGradient) {
1475     SWIG_CSharpSetPendingExceptionArgument(
1476         SWIG_CSharpArgumentNullException,
1477         "Attempt to dereference null Dali::CanvasRenderer::Gradient", 0);
1478     return 0;
1479   }
1480   gradient = *(Dali::CanvasRenderer::Gradient *)pGradient;
1481
1482   {
1483     try {
1484       result = gradient.GetSpread();
1485     }
1486     CALL_CATCH_EXCEPTION(0);
1487   }
1488
1489   return (int)result;
1490 }
1491
1492 // Dali::CanvasRenderer::LinearGradient Wrapper
1493
1494 SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_LinearGradient_New() {
1495   Dali::CanvasRenderer::LinearGradient linearGradient;
1496
1497   {
1498     try {
1499       linearGradient = Dali::CanvasRenderer::LinearGradient::New();
1500     }
1501     CALL_CATCH_EXCEPTION(0);
1502   }
1503
1504   return new Dali::CanvasRenderer::LinearGradient(
1505       (const Dali::CanvasRenderer::LinearGradient &)linearGradient);
1506 }
1507
1508 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_LinearGradient_SetBounds(
1509     char *pLinearGradient, void *pFirstPoint, void *pSecondPoint) {
1510   Dali::CanvasRenderer::LinearGradient linearGradient;
1511   bool result = false;
1512
1513   if (!pLinearGradient) {
1514     SWIG_CSharpSetPendingExceptionArgument(
1515         SWIG_CSharpArgumentNullException,
1516         "Attempt to dereference null Dali::CanvasRenderer::LinearGradient", 0);
1517     return false;
1518   }
1519   linearGradient = *(Dali::CanvasRenderer::LinearGradient *)pLinearGradient;
1520
1521   if (!pFirstPoint) {
1522     SWIG_CSharpSetPendingExceptionArgument(
1523         SWIG_CSharpArgumentNullException,
1524         "Attempt to dereference null Dali::Vector2", 0);
1525     return false;
1526   }
1527
1528   if (!pSecondPoint) {
1529     SWIG_CSharpSetPendingExceptionArgument(
1530         SWIG_CSharpArgumentNullException,
1531         "Attempt to dereference null Dali::Vector2", 0);
1532     return false;
1533   }
1534
1535   {
1536     try {
1537       result = linearGradient.SetBounds(*(Dali::Vector2 *)pFirstPoint,
1538                                         *(Dali::Vector2 *)pSecondPoint);
1539     }
1540     CALL_CATCH_EXCEPTION(false);
1541   }
1542   return result;
1543 }
1544
1545 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_LinearGradient_GetBounds(
1546     char *pLinearGradient, void *pFirstPoint, void *pSecondPoint) {
1547   Dali::CanvasRenderer::LinearGradient linearGradient;
1548   bool result = false;
1549
1550   if (!pLinearGradient) {
1551     SWIG_CSharpSetPendingExceptionArgument(
1552         SWIG_CSharpArgumentNullException,
1553         "Attempt to dereference null Dali::CanvasRenderer::LinearGradient", 0);
1554     return false;
1555   }
1556   linearGradient = *(Dali::CanvasRenderer::LinearGradient *)pLinearGradient;
1557
1558   if (!pFirstPoint) {
1559     SWIG_CSharpSetPendingExceptionArgument(
1560         SWIG_CSharpArgumentNullException,
1561         "Attempt to dereference null Dali::Vector2", 0);
1562     return false;
1563   }
1564
1565   if (!pSecondPoint) {
1566     SWIG_CSharpSetPendingExceptionArgument(
1567         SWIG_CSharpArgumentNullException,
1568         "Attempt to dereference null Dali::Vector2", 0);
1569     return false;
1570   }
1571
1572   {
1573     try {
1574       result = linearGradient.GetBounds(*(Dali::Vector2 *)pFirstPoint,
1575                                         *(Dali::Vector2 *)pSecondPoint);
1576     }
1577     CALL_CATCH_EXCEPTION(false);
1578   }
1579   return result;
1580 }
1581
1582 // Dali::CanvasRenderer::RadialGradient Wrapper
1583
1584 SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_RadialGradient_New() {
1585   Dali::CanvasRenderer::RadialGradient radialGradient;
1586
1587   {
1588     try {
1589       radialGradient = Dali::CanvasRenderer::RadialGradient::New();
1590     }
1591     CALL_CATCH_EXCEPTION(0);
1592   }
1593
1594   return new Dali::CanvasRenderer::RadialGradient(
1595       (const Dali::CanvasRenderer::RadialGradient &)radialGradient);
1596 }
1597
1598 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_RadialGradient_SetBounds(
1599     char *pRadialGradient, void *pCenterPoint, float radius) {
1600   Dali::CanvasRenderer::RadialGradient radialGradient;
1601   bool result = false;
1602
1603   if (!pRadialGradient) {
1604     SWIG_CSharpSetPendingExceptionArgument(
1605         SWIG_CSharpArgumentNullException,
1606         "Attempt to dereference null Dali::CanvasRenderer::RadialGradient", 0);
1607     return false;
1608   }
1609   radialGradient = *(Dali::CanvasRenderer::RadialGradient *)pRadialGradient;
1610
1611   if (!pCenterPoint) {
1612     SWIG_CSharpSetPendingExceptionArgument(
1613         SWIG_CSharpArgumentNullException,
1614         "Attempt to dereference null Dali::Vector2", 0);
1615     return false;
1616   }
1617
1618   {
1619     try {
1620       result = radialGradient.SetBounds(*(Dali::Vector2 *)pCenterPoint, radius);
1621     }
1622     CALL_CATCH_EXCEPTION(false);
1623   }
1624   return result;
1625 }
1626
1627 SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_RadialGradient_GetBounds(
1628     char *pRadialGradient, void *pCenterPoint, void *radius) {
1629   Dali::CanvasRenderer::RadialGradient radialGradient;
1630   bool result = false;
1631
1632   if (!pRadialGradient) {
1633     SWIG_CSharpSetPendingExceptionArgument(
1634         SWIG_CSharpArgumentNullException,
1635         "Attempt to dereference null Dali::CanvasRenderer::RadialGradient", 0);
1636     return false;
1637   }
1638   radialGradient = *(Dali::CanvasRenderer::RadialGradient *)pRadialGradient;
1639
1640   if (!pCenterPoint) {
1641     SWIG_CSharpSetPendingExceptionArgument(
1642         SWIG_CSharpArgumentNullException,
1643         "Attempt to dereference null Dali::Vector2", 0);
1644     return false;
1645   }
1646
1647   {
1648     try {
1649       result = radialGradient.GetBounds(*(Dali::Vector2 *)pCenterPoint,
1650                                         *(float *)radius);
1651     }
1652     CALL_CATCH_EXCEPTION(false);
1653   }
1654   return result;
1655 }
1656 #ifdef __cplusplus
1657 } // end extern "C"
1658 #endif