Adjust the position of the partial Frame
[platform/framework/native/uifw.git] / src / graphics / FGrpCanvas.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /*
19  * @file        FGrpCanvas.cpp
20  * @brief       This is the implementation file for Canvas class.
21  *
22  */
23
24 #include <new>
25
26 #include <FGrpCanvas.h>
27
28 #include <FBaseSysLog.h>
29
30 #include "FGrp_CanvasImpl.h"
31 #include "util/FGrp_Util.h"
32
33
34 #define CHECK_INSTANCE \
35         SysTryReturnResult(NID_GRP, this->__pImpl, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Fails to allocate memory.")
36
37 #define CHECK_INSTANCE_EX(_result) \
38         SysTryReturn(NID_GRP, this->__pImpl, _result, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Fails to allocate memory.")
39
40 #define CHECK_INSTANCE_VOID     \
41         SysTryReturnVoidResult(NID_GRP, this->__pImpl, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Fails to allocate memory.")
42
43
44 #define CHECK_NOT_CONSTRUCTED \
45         ClearLastResult(); \
46         CHECK_INSTANCE; \
47         SysAssertf(!this->__pImpl->IsConstructed(), \
48                 "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class");
49
50 #define CHECK_CONSTRUCTED \
51         ClearLastResult(); \
52         SysAssertf((this->__pImpl != null) && this->__pImpl->IsConstructed(), \
53                 "Not yet constructed. Construct() should be called before use.");
54
55 #define CHECK_CONSTRUCTED_EX(_result) \
56         ClearLastResult(); \
57         SysAssertf((this->__pImpl != null) && this->__pImpl->IsConstructed(), \
58                 "Not yet constructed. Construct() should be called before use.");
59
60 #define CHECK_CONSTRUCTED_VOID \
61         ClearLastResult(); \
62         SysAssertf((this->__pImpl != null) && this->__pImpl->IsConstructed(), \
63                 "Not yet constructed. Construct() should be called before use.");
64
65
66 namespace Tizen { namespace Graphics
67 {
68
69 Canvas::Canvas(void)
70         : __pImpl(0)
71 {
72         __pImpl = new (std::nothrow) _CanvasImpl;
73 }
74
75 Canvas::~Canvas(void)
76 {
77         delete __pImpl;
78 }
79
80 result
81 Canvas::Construct(void)
82 {
83         CHECK_NOT_CONSTRUCTED;
84
85         result r = this->__pImpl->Construct();
86
87         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
88
89         return E_SUCCESS;
90 }
91
92 result
93 Canvas::Construct(const Rectangle& vcRect)
94 {
95         CHECK_NOT_CONSTRUCTED;
96
97         result r = this->__pImpl->Construct(vcRect);
98
99         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
100
101         return E_SUCCESS;
102 }
103
104 result
105 Canvas::Construct(const FloatRectangle& vcRect)
106 {
107         CHECK_NOT_CONSTRUCTED;
108
109         result r = this->__pImpl->Construct(vcRect);
110
111         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
112
113         return E_SUCCESS;
114 }
115
116 result
117 Canvas::Construct(const BufferInfo& bufferInfo)
118 {
119         CHECK_NOT_CONSTRUCTED;
120
121         result r = this->__pImpl->Construct(bufferInfo);
122
123         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
124
125         return E_SUCCESS;
126 }
127
128 result
129 Canvas::Clear(void)
130 {
131         CHECK_CONSTRUCTED;
132
133         result r = this->__pImpl->Clear();
134
135         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
136
137         return E_SUCCESS;
138 }
139
140 result
141 Canvas::Clear(const Rectangle& vcRect)
142 {
143         CHECK_CONSTRUCTED;
144
145         result r = this->__pImpl->Clear(vcRect);
146
147         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
148
149         return E_SUCCESS;
150 }
151
152 result
153 Canvas::Clear(const FloatRectangle& vcRect)
154 {
155         CHECK_CONSTRUCTED;
156
157         result r = this->__pImpl->Clear(vcRect);
158
159         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
160
161         return E_SUCCESS;
162 }
163
164 result
165 Canvas::Copy(const Point& vcDestPoint, const Canvas& canvas, const Rectangle& vcSrcRect)
166 {
167         CHECK_CONSTRUCTED;
168
169         SysTryReturnResult(NID_GRP, _Util::CheckValidity(&canvas), E_INVALID_ARG, "The source canvas is invalid.\n");
170
171         const Tizen::Graphics::_CanvasImpl& impl = *canvas.__pImpl;
172
173         result r = this->__pImpl->Copy(vcDestPoint, impl, vcSrcRect);
174
175         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
176
177         return E_SUCCESS;
178 }
179
180 result
181 Canvas::Copy(const FloatPoint& vcDestPoint, const Canvas& canvas, const FloatRectangle& vcSrcRect)
182 {
183         CHECK_CONSTRUCTED;
184
185         SysTryReturnResult(NID_GRP, _Util::CheckValidity(&canvas), E_INVALID_ARG, "The source canvas is invalid.\n");
186
187         const Tizen::Graphics::_CanvasImpl& impl = *canvas.__pImpl;
188
189         result r = this->__pImpl->Copy(vcDestPoint, impl, vcSrcRect);
190
191         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
192
193         return E_SUCCESS;
194 }
195
196 result
197 Canvas::Copy(const Rectangle& vcDestRect, const Canvas& canvas, const Rectangle& vcSrcRect)
198 {
199         CHECK_CONSTRUCTED;
200
201         SysTryReturnResult(NID_GRP, _Util::CheckValidity(&canvas), E_INVALID_ARG, "The source canvas is invalid.\n");
202
203         const Tizen::Graphics::_CanvasImpl& impl = *canvas.__pImpl;
204
205         result r = this->__pImpl->Copy(vcDestRect, impl, vcSrcRect);
206
207         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
208
209         return E_SUCCESS;
210 }
211
212 result
213 Canvas::Copy(const FloatRectangle& vcDestRect, const Canvas& canvas, const FloatRectangle& vcSrcRect)
214 {
215         CHECK_CONSTRUCTED;
216
217         SysTryReturnResult(NID_GRP, _Util::CheckValidity(&canvas), E_INVALID_ARG, "The source canvas is invalid.\n");
218
219         const Tizen::Graphics::_CanvasImpl& impl = *canvas.__pImpl;
220
221         result r = this->__pImpl->Copy(vcDestRect, impl, vcSrcRect);
222
223         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
224
225         return E_SUCCESS;
226 }
227
228 result
229 Canvas::DrawArc(const Rectangle& vcBounds, int startAngle, int endAngle, ArcStyle arcStyle)
230 {
231         CHECK_CONSTRUCTED;
232
233         result r = this->__pImpl->DrawArc(vcBounds, startAngle, endAngle, arcStyle);
234
235         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
236
237         return E_SUCCESS;
238 }
239
240 result
241 Canvas::DrawArc(const FloatRectangle& vcBounds, float startAngle, float endAngle, ArcStyle arcStyle)
242 {
243         CHECK_CONSTRUCTED;
244
245         result r = this->__pImpl->DrawArc(vcBounds, startAngle, endAngle, arcStyle);
246
247         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
248
249         return E_SUCCESS;
250 }
251
252 result
253 Canvas::DrawBitmap(const Rectangle& vcRect, const Bitmap& bitmap)
254 {
255         CHECK_CONSTRUCTED;
256
257         SysTryReturnResult(NID_GRP, _Util::CheckValidity(&bitmap), E_INVALID_ARG, "The source bitmap is invalid.\n");
258
259         const Tizen::Graphics::_BitmapImpl& impl = *bitmap.__pImpl;
260
261         result r = this->__pImpl->DrawBitmap(vcRect, impl);
262
263         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
264
265         return E_SUCCESS;
266 }
267
268 result
269 Canvas::DrawBitmap(const FloatRectangle& vcRect, const Bitmap& bitmap)
270 {
271         CHECK_CONSTRUCTED;
272
273         SysTryReturnResult(NID_GRP, _Util::CheckValidity(&bitmap), E_INVALID_ARG, "The source bitmap is invalid.\n");
274
275         const Tizen::Graphics::_BitmapImpl& impl = *bitmap.__pImpl;
276
277         result r = this->__pImpl->DrawBitmap(vcRect, impl);
278
279         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
280
281         return E_SUCCESS;
282 }
283
284 result
285 Canvas::DrawBitmap(const Point& vcPoint, const Bitmap& bitmap)
286 {
287         CHECK_CONSTRUCTED;
288
289         SysTryReturnResult(NID_GRP, _Util::CheckValidity(&bitmap), E_INVALID_ARG, "The source bitmap is invalid.\n");
290
291         const Tizen::Graphics::_BitmapImpl& impl = *bitmap.__pImpl;
292
293         result r = this->__pImpl->DrawBitmap(vcPoint, impl);
294
295         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
296
297         return E_SUCCESS;
298 }
299
300 result
301 Canvas::DrawBitmap(const FloatPoint& vcPoint, const Bitmap& bitmap)
302 {
303         CHECK_CONSTRUCTED;
304
305         SysTryReturnResult(NID_GRP, _Util::CheckValidity(&bitmap), E_INVALID_ARG, "The source bitmap is invalid.\n");
306
307         const Tizen::Graphics::_BitmapImpl& impl = *bitmap.__pImpl;
308
309         result r = this->__pImpl->DrawBitmap(vcPoint, impl);
310
311         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
312
313         return E_SUCCESS;
314 }
315
316 result
317 Canvas::DrawBitmap(const Rectangle& vcDestRect, const Bitmap& srcBitmap, const Rectangle& vcSrcRect)
318 {
319         CHECK_CONSTRUCTED;
320
321         SysTryReturnResult(NID_GRP, _Util::CheckValidity(&srcBitmap), E_INVALID_ARG, "The source bitmap is invalid.\n");
322
323         const Tizen::Graphics::_BitmapImpl& impl = *srcBitmap.__pImpl;
324
325         result r = this->__pImpl->DrawBitmap(vcDestRect, impl, vcSrcRect);
326
327         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
328
329         return E_SUCCESS;
330 }
331
332 result
333 Canvas::DrawBitmap(const FloatRectangle& vcDestRect, const Bitmap& srcBitmap, const FloatRectangle& vcSrcRect)
334 {
335         CHECK_CONSTRUCTED;
336
337         SysTryReturnResult(NID_GRP, _Util::CheckValidity(&srcBitmap), E_INVALID_ARG, "The source bitmap is invalid.\n");
338
339         const Tizen::Graphics::_BitmapImpl& impl = *srcBitmap.__pImpl;
340
341         result r = this->__pImpl->DrawBitmap(vcDestRect, impl, vcSrcRect);
342
343         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
344
345         return E_SUCCESS;
346 }
347
348 result
349 Canvas::DrawBitmap(const Point& vcPoint, const Bitmap& bitmap, FlipDirection dir)
350 {
351         CHECK_CONSTRUCTED;
352
353         SysTryReturnResult(NID_GRP, _Util::CheckValidity(&bitmap), E_INVALID_ARG, "The source bitmap is invalid.\n");
354
355         const Tizen::Graphics::_BitmapImpl& impl = *bitmap.__pImpl;
356
357         result r = this->__pImpl->DrawBitmap(vcPoint, impl, dir);
358
359         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
360
361         return E_SUCCESS;
362 }
363
364 result
365 Canvas::DrawBitmap(const FloatPoint& vcPoint, const Bitmap& bitmap, FlipDirection dir)
366 {
367         CHECK_CONSTRUCTED;
368
369         SysTryReturnResult(NID_GRP, _Util::CheckValidity(&bitmap), E_INVALID_ARG, "The source bitmap is invalid.\n");
370
371         const Tizen::Graphics::_BitmapImpl& impl = *bitmap.__pImpl;
372
373         result r = this->__pImpl->DrawBitmap(vcPoint, impl, dir);
374
375         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
376
377         return E_SUCCESS;
378 }
379
380 result
381 Canvas::DrawBitmap(const Point& vcPoint, const Bitmap& bitmap, const Point& vcPivot, int degree)
382 {
383         CHECK_CONSTRUCTED;
384
385         SysTryReturnResult(NID_GRP, _Util::CheckValidity(&bitmap), E_INVALID_ARG, "The source bitmap is invalid.\n");
386
387         const Tizen::Graphics::_BitmapImpl& impl = *bitmap.__pImpl;
388
389         result r = this->__pImpl->DrawBitmap(vcPoint, impl, vcPivot, degree);
390
391         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
392
393         return E_SUCCESS;
394 }
395
396 result
397 Canvas::DrawBitmap(const FloatPoint& vcPoint, const Bitmap& bitmap, const FloatPoint& vcPivot, float degree)
398 {
399         CHECK_CONSTRUCTED;
400
401         SysTryReturnResult(NID_GRP, _Util::CheckValidity(&bitmap), E_INVALID_ARG, "The source bitmap is invalid.\n");
402
403         const Tizen::Graphics::_BitmapImpl& impl = *bitmap.__pImpl;
404
405         result r = this->__pImpl->DrawBitmap(vcPoint, impl, vcPivot, degree);
406
407         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
408
409         return E_SUCCESS;
410 }
411
412 result
413 Canvas::DrawNinePatchedBitmap(const Rectangle& vcRect, const Bitmap& bitmap)
414 {
415         CHECK_CONSTRUCTED;
416
417         SysTryReturnResult(NID_GRP, _Util::CheckValidity(&bitmap), E_INVALID_ARG, "The source bitmap is invalid.\n");
418
419         const Tizen::Graphics::_BitmapImpl& impl = *bitmap.__pImpl;
420
421         result r = this->__pImpl->DrawNinePatchedBitmap(vcRect, impl);
422
423         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
424
425         return E_SUCCESS;
426 }
427
428 result
429 Canvas::DrawNinePatchedBitmap(const FloatRectangle& vcRect, const Bitmap& bitmap)
430 {
431         CHECK_CONSTRUCTED;
432
433         SysTryReturnResult(NID_GRP, _Util::CheckValidity(&bitmap), E_INVALID_ARG, "The source bitmap is invalid.\n");
434
435         const Tizen::Graphics::_BitmapImpl& impl = *bitmap.__pImpl;
436
437         result r = this->__pImpl->DrawNinePatchedBitmap(vcRect, impl);
438
439         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
440
441         return E_SUCCESS;
442 }
443
444 result
445 Canvas::DrawEllipse(const Rectangle& vcBounds)
446 {
447         CHECK_CONSTRUCTED;
448
449         result r = this->__pImpl->DrawEllipse(vcBounds);
450
451         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
452
453         return E_SUCCESS;
454 }
455
456 result
457 Canvas::DrawEllipse(const FloatRectangle& vcBounds)
458 {
459         CHECK_CONSTRUCTED;
460
461         result r = this->__pImpl->DrawEllipse(vcBounds);
462
463         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
464
465         return E_SUCCESS;
466 }
467
468 result
469 Canvas::DrawLine(const Point& vcPoint1, const Point& vcPoint2)
470 {
471         CHECK_CONSTRUCTED;
472
473         result r = this->__pImpl->DrawLine(vcPoint1, vcPoint2);
474
475         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
476
477         return E_SUCCESS;
478 }
479
480 result
481 Canvas::DrawLine(const FloatPoint& vcPoint1, const FloatPoint& vcPoint2)
482 {
483         CHECK_CONSTRUCTED;
484
485         result r = this->__pImpl->DrawLine(vcPoint1, vcPoint2);
486
487         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
488
489         return E_SUCCESS;
490 }
491
492 result
493 Canvas::DrawPolygon(const Tizen::Base::Collection::IList& vcPoints)
494 {
495         CHECK_CONSTRUCTED;
496
497         result r = this->__pImpl->DrawPolygon(vcPoints);
498
499         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
500
501         return E_SUCCESS;
502 }
503
504 result
505 Canvas::DrawPolyline(const Tizen::Base::Collection::IList& vcPoints)
506 {
507         CHECK_CONSTRUCTED;
508
509         result r = this->__pImpl->DrawPolyline(vcPoints);
510
511         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
512
513         return E_SUCCESS;
514 }
515
516 result
517 Canvas::DrawRectangle(const Rectangle& vcRect)
518 {
519         CHECK_CONSTRUCTED;
520
521         result r = this->__pImpl->DrawRectangle(vcRect);
522
523         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
524
525         return E_SUCCESS;
526 }
527
528 result
529 Canvas::DrawRectangle(const FloatRectangle& vcRect)
530 {
531         CHECK_CONSTRUCTED;
532
533         result r = this->__pImpl->DrawRectangle(vcRect);
534
535         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
536
537         return E_SUCCESS;
538 }
539
540 result
541 Canvas::DrawRoundRectangle(const Rectangle& vcRect, const Dimension& vcArcDim)
542 {
543         CHECK_CONSTRUCTED;
544
545         result r = this->__pImpl->DrawRoundRectangle(vcRect, vcArcDim);
546
547         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
548
549         return E_SUCCESS;
550 }
551
552 result
553 Canvas::DrawRoundRectangle(const FloatRectangle& vcRect, const FloatDimension& vcArcDim)
554 {
555         CHECK_CONSTRUCTED;
556
557         result r = this->__pImpl->DrawRoundRectangle(vcRect, vcArcDim);
558
559         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
560
561         return E_SUCCESS;
562 }
563
564 result
565 Canvas::DrawTriangle(const Point& vcPoint1, const Point& vcPoint2, const Point& vcPoint3)
566 {
567         CHECK_CONSTRUCTED;
568
569         result r = this->__pImpl->DrawTriangle(vcPoint1, vcPoint2, vcPoint3);
570
571         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
572
573         return E_SUCCESS;
574 }
575
576 result
577 Canvas::DrawTriangle(const FloatPoint& vcPoint1, const FloatPoint& vcPoint2, const FloatPoint& vcPoint3)
578 {
579         CHECK_CONSTRUCTED;
580
581         result r = this->__pImpl->DrawTriangle(vcPoint1, vcPoint2, vcPoint3);
582
583         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
584
585         return E_SUCCESS;
586 }
587
588 result
589 Canvas::FillEllipse(const Color& color, const Rectangle& vcBounds)
590 {
591         CHECK_CONSTRUCTED;
592
593         result r = this->__pImpl->FillEllipse(color, vcBounds);
594
595         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
596
597         return E_SUCCESS;
598 }
599
600 result
601 Canvas::FillEllipse(const Color& color, const FloatRectangle& vcBounds)
602 {
603         CHECK_CONSTRUCTED;
604
605         result r = this->__pImpl->FillEllipse(color, vcBounds);
606
607         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
608
609         return E_SUCCESS;
610 }
611
612 result
613 Canvas::FillPolygon(const Color& color, const Tizen::Base::Collection::IList& vcPoints)
614 {
615         CHECK_CONSTRUCTED;
616
617         result r = this->__pImpl->FillPolygon(color, vcPoints);
618
619         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
620
621         return E_SUCCESS;
622 }
623
624 result
625 Canvas::FillRectangle(const Color& color, const Rectangle& vcRect)
626 {
627         CHECK_CONSTRUCTED;
628
629         result r = this->__pImpl->FillRectangle(color, vcRect);
630
631         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
632
633         return E_SUCCESS;
634 }
635
636 result
637 Canvas::FillRectangle(const Color& color, const FloatRectangle& vcRect)
638 {
639         CHECK_CONSTRUCTED;
640
641         result r = this->__pImpl->FillRectangle(color, vcRect);
642
643         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
644
645         return E_SUCCESS;
646 }
647
648 result
649 Canvas::FillRoundRectangle(const Color& color, const Rectangle& vcRect, const Dimension& vcArcDim)
650 {
651         CHECK_CONSTRUCTED;
652
653         result r = this->__pImpl->FillRoundRectangle(color, vcRect, vcArcDim);
654
655         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
656
657         return E_SUCCESS;
658 }
659
660 result
661 Canvas::FillRoundRectangle(const Color& color, const FloatRectangle& vcRect, const FloatDimension& vcArcDim)
662 {
663         CHECK_CONSTRUCTED;
664
665         result r = this->__pImpl->FillRoundRectangle(color, vcRect, vcArcDim);
666
667         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
668
669         return E_SUCCESS;
670 }
671
672 result
673 Canvas::FillTriangle(const Color& color, const Point& vcPoint1, const Point& vcPoint2, const Point& vcPoint3)
674 {
675         CHECK_CONSTRUCTED;
676
677         result r = this->__pImpl->FillTriangle(color, vcPoint1, vcPoint2, vcPoint3);
678
679         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
680
681         return E_SUCCESS;
682 }
683
684 result
685 Canvas::FillTriangle(const Color& color, const FloatPoint& vcPoint1, const FloatPoint& vcPoint2, const FloatPoint& vcPoint3)
686 {
687         CHECK_CONSTRUCTED;
688
689         result r = this->__pImpl->FillTriangle(color, vcPoint1, vcPoint2, vcPoint3);
690
691         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
692
693         return E_SUCCESS;
694 }
695
696 result
697 Canvas::DrawText(const Point& vcPoint, const Tizen::Base::String& text)
698 {
699         CHECK_CONSTRUCTED;
700
701         result r = this->__pImpl->DrawText(vcPoint, text);
702
703         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
704
705         return E_SUCCESS;
706 }
707
708 result
709 Canvas::DrawText(const FloatPoint& vcPoint, const Tizen::Base::String& text)
710 {
711         CHECK_CONSTRUCTED;
712
713         result r = this->__pImpl->DrawText(vcPoint, text);
714
715         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
716
717         return E_SUCCESS;
718 }
719
720 result
721 Canvas::DrawText(const Point& vcPoint, const Tizen::Base::String& text, int length)
722 {
723         CHECK_CONSTRUCTED;
724
725         result r = this->__pImpl->DrawText(vcPoint, text, 0, length);
726
727         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
728
729         return E_SUCCESS;
730 }
731
732 result
733 Canvas::DrawText(const FloatPoint& vcPoint, const Tizen::Base::String& text, int length)
734 {
735         CHECK_CONSTRUCTED;
736
737         result r = this->__pImpl->DrawText(vcPoint, text, 0, length);
738
739         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
740
741         return E_SUCCESS;
742 }
743
744 result
745 Canvas::DrawText(const Point& vcPoint, const Tizen::Base::String& text, const Color& outlineColor)
746 {
747         CHECK_CONSTRUCTED;
748
749         result r = this->__pImpl->DrawText(vcPoint, text, 0, outlineColor);
750
751         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
752
753         return E_SUCCESS;
754 }
755
756 result
757 Canvas::DrawText(const FloatPoint& vcPoint, const Tizen::Base::String& text, const Color& outlineColor)
758 {
759         CHECK_CONSTRUCTED;
760
761         result r = this->__pImpl->DrawText(vcPoint, text, 0, outlineColor);
762
763         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
764
765         return E_SUCCESS;
766 }
767
768 result
769 Canvas::DrawText(const Point& vcPoint, const Tizen::Base::String& text, int length, const Color& outlineColor)
770 {
771         CHECK_CONSTRUCTED;
772
773         result r = this->__pImpl->DrawText(vcPoint, text, 0, length, outlineColor);
774
775         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
776
777         return E_SUCCESS;
778 }
779
780 result
781 Canvas::DrawText(const FloatPoint& vcPoint, const Tizen::Base::String& text, int length, const Color& outlineColor)
782 {
783         CHECK_CONSTRUCTED;
784
785         result r = this->__pImpl->DrawText(vcPoint, text, 0, length, outlineColor);
786
787         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
788
789         return E_SUCCESS;
790 }
791
792 result
793 Canvas::DrawText(const Point& vcPoint, const EnrichedText& etext)
794 {
795         CHECK_CONSTRUCTED;
796
797         SysTryReturnResult(NID_GRP, _Util::CheckValidity(&etext), E_INVALID_ARG, "The source enriched text is invalid.\n");
798
799         result r = this->__pImpl->DrawText(vcPoint, etext);
800
801         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
802
803         return E_SUCCESS;
804 }
805
806 result
807 Canvas::DrawText(const FloatPoint& vcPoint, const EnrichedText& etext)
808 {
809         CHECK_CONSTRUCTED;
810
811         SysTryReturnResult(NID_GRP, _Util::CheckValidity(&etext), E_INVALID_ARG, "The source enriched text is invalid.\n");
812
813         result r = this->__pImpl->DrawText(vcPoint, etext);
814
815         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
816
817         return E_SUCCESS;
818 }
819
820 Rectangle
821 Canvas::GetBounds(void) const
822 {
823         CHECK_CONSTRUCTED_EX(Rectangle());
824
825         return this->__pImpl->GetBounds();
826 }
827
828 FloatRectangle
829 Canvas::GetBoundsF(void) const
830 {
831         CHECK_CONSTRUCTED_EX(FloatRectangle());
832
833         return this->__pImpl->GetBoundsF();
834 }
835
836 FloatRectangle
837 Canvas::GetActualBounds(void) const
838 {
839         CHECK_CONSTRUCTED_EX(FloatRectangle());
840
841         return this->__pImpl->GetActualBounds();
842 }
843
844 LineStyle
845 Canvas::GetLineStyle() const
846 {
847         CHECK_CONSTRUCTED_EX(LINE_STYLE_MAX);
848
849         return this->__pImpl->GetLineStyle();
850 }
851
852 int
853 Canvas::GetLineWidth() const
854 {
855         CHECK_CONSTRUCTED_EX(-1);
856
857         return this->__pImpl->GetLineWidth();
858 }
859
860 float
861 Canvas::GetLineWidthF() const
862 {
863         CHECK_CONSTRUCTED_EX(-1);
864
865         return this->__pImpl->GetLineWidthF();
866 }
867
868 result
869 Canvas::SetLineStyle(LineStyle style)
870 {
871         CHECK_CONSTRUCTED;
872
873         result r = this->__pImpl->SetLineStyle(style);
874
875         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
876
877         return E_SUCCESS;
878 }
879
880 result
881 Canvas::SetLineWidth(int vcWidth)
882 {
883         CHECK_CONSTRUCTED;
884
885         result r = this->__pImpl->SetLineWidth(vcWidth);
886
887         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
888
889         return E_SUCCESS;
890 }
891
892 result
893 Canvas::SetLineWidth(float vcWidth)
894 {
895         CHECK_CONSTRUCTED;
896
897         result r = this->__pImpl->SetLineWidth(vcWidth);
898
899         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
900
901         return E_SUCCESS;
902 }
903
904 result
905 Canvas::GetDashPattern(Tizen::Base::Collection::IListT<int>& pattern, int& offset) const
906 {
907         CHECK_CONSTRUCTED;
908
909         result r = this->__pImpl->GetDashPattern(pattern, offset);
910
911         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
912
913         return E_SUCCESS;
914 }
915
916 result
917 Canvas::GetDashPattern(Tizen::Base::Collection::IListT<float>& pattern, float& offset) const
918 {
919         CHECK_CONSTRUCTED;
920
921         result r = this->__pImpl->GetDashPattern(pattern, offset);
922
923         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
924
925         return E_SUCCESS;
926 }
927
928 result
929 Canvas::SetDashPattern(const Tizen::Base::Collection::IListT<int>& pattern, int offset)
930 {
931         CHECK_CONSTRUCTED;
932
933         result r = this->__pImpl->SetDashPattern(pattern, offset);
934
935         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
936
937         return E_SUCCESS;
938 }
939
940 result
941 Canvas::SetDashPattern(const Tizen::Base::Collection::IListT<float>& pattern, float offset)
942 {
943         CHECK_CONSTRUCTED;
944
945         result r = this->__pImpl->SetDashPattern(pattern, offset);
946
947         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
948
949         return E_SUCCESS;
950 }
951
952 LineCapStyle
953 Canvas::GetLineCapStyle(void) const
954 {
955         CHECK_CONSTRUCTED_EX(LINE_CAP_STYLE_ROUND);
956
957         return this->__pImpl->GetLineCapStyle();
958 }
959
960 result
961 Canvas::SetLineCapStyle(LineCapStyle lineCapStyle)
962 {
963         CHECK_CONSTRUCTED;
964
965         result r = this->__pImpl->SetLineCapStyle(lineCapStyle);
966
967         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
968
969         return E_SUCCESS;
970 }
971
972 LineJoinStyle
973 Canvas::GetLineJoinStyle(void) const
974 {
975         CHECK_CONSTRUCTED_EX(LINE_JOIN_STYLE_ROUND);
976
977         return this->__pImpl->GetLineJoinStyle();
978 }
979
980 result
981 Canvas::SetLineJoinStyle(LineJoinStyle lineJoinStyle)
982 {
983         CHECK_CONSTRUCTED;
984
985         result r = this->__pImpl->SetLineJoinStyle(lineJoinStyle);
986
987         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
988
989         return E_SUCCESS;
990 }
991
992 #if 0 // Not public feature yet
993
994 result
995 Canvas::SetDrawingQuality(BitmapDrawingQuality quality)
996 {
997         CHECK_CONSTRUCTED;
998
999         result r = this->__pImpl->SetDrawingQuality(quality);
1000
1001         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r,"[%s] Propagating.", GetErrorMessage(r));
1002
1003         return E_SUCCESS;
1004 }
1005
1006 BitmapDrawingQuality
1007 Canvas::GetDrawingQuality(void) const
1008 {
1009         CHECK_CONSTRUCTED_EX(BITMAP_DRAWING_QUALITY_LOW);
1010
1011         return this->__pImpl->GetDrawingQuality();
1012 }
1013
1014 #endif
1015
1016 result
1017 Canvas::GetPixel(const Point& vcPoint, Color& color) const
1018 {
1019         CHECK_CONSTRUCTED;
1020
1021         result r = this->__pImpl->GetPixel(vcPoint, color);
1022
1023         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1024
1025         return E_SUCCESS;
1026 }
1027
1028 result
1029 Canvas::GetPixel(const FloatPoint& vcPoint, Color& color) const
1030 {
1031         CHECK_CONSTRUCTED;
1032
1033         result r = this->__pImpl->GetPixel(vcPoint, color);
1034
1035         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1036
1037         return E_SUCCESS;
1038 }
1039
1040 result
1041 Canvas::SetPixel(const Point& vcPoint)
1042 {
1043         CHECK_CONSTRUCTED;
1044
1045         result r = this->__pImpl->SetPixel(vcPoint);
1046
1047         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1048
1049         return E_SUCCESS;
1050 }
1051
1052 result
1053 Canvas::SetPixel(const FloatPoint& vcPoint)
1054 {
1055         CHECK_CONSTRUCTED;
1056
1057         result r = this->__pImpl->SetPixel(vcPoint);
1058
1059         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1060
1061         return E_SUCCESS;
1062 }
1063
1064 result
1065 Canvas::Show()
1066 {
1067         CHECK_CONSTRUCTED;
1068
1069         result r = this->__pImpl->Show();
1070
1071         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1072
1073         return E_SUCCESS;
1074 }
1075
1076 result
1077 Canvas::Show(const Rectangle& vcRect)
1078 {
1079         CHECK_CONSTRUCTED;
1080
1081         result r = this->__pImpl->Show(vcRect);
1082
1083         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1084
1085         return E_SUCCESS;
1086 }
1087
1088 result
1089 Canvas::SetFont(const Font& font)
1090 {
1091         CHECK_CONSTRUCTED;
1092
1093         SysTryReturnResult(NID_GRP, _Util::CheckValidity(&font), E_INVALID_ARG, "The source font is invalid.\n");
1094
1095         result r = this->__pImpl->SetFont(font);
1096
1097         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1098
1099         return E_SUCCESS;
1100 }
1101
1102 Font*
1103 Canvas::GetFontN(void) const
1104 {
1105         CHECK_CONSTRUCTED_EX(null);
1106
1107         Font* pReturnFont = this->__pImpl->GetFontN();
1108
1109         if (pReturnFont == null)
1110         {
1111                 result r = GetLastResult();
1112
1113                 SysTryReturn(NID_GRP, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1114
1115                 return null;
1116         }
1117
1118         return pReturnFont;
1119 }
1120
1121 result
1122 Canvas::SetClipBounds(const Rectangle& vcRect)
1123 {
1124         CHECK_CONSTRUCTED;
1125
1126         result r = this->__pImpl->SetClipBounds(vcRect);
1127
1128         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1129
1130         return E_SUCCESS;
1131 }
1132
1133 result
1134 Canvas::SetClipBounds(const FloatRectangle& vcRect)
1135 {
1136         CHECK_CONSTRUCTED;
1137
1138         result r = this->__pImpl->SetClipBounds(vcRect);
1139
1140         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1141
1142         return E_SUCCESS;
1143 }
1144
1145 Rectangle
1146 Canvas::GetClipBounds(void) const
1147 {
1148         CHECK_CONSTRUCTED_EX(Rectangle());
1149
1150         return this->__pImpl->GetClipBounds();
1151 }
1152
1153 FloatRectangle
1154 Canvas::GetClipBoundsF(void) const
1155 {
1156         CHECK_CONSTRUCTED_EX(FloatRectangle());
1157
1158         return this->__pImpl->GetClipBoundsF();
1159 }
1160
1161 result
1162 Canvas::Lock(BufferInfo& info, long timeout)
1163 {
1164         CHECK_CONSTRUCTED;
1165
1166         result r = this->__pImpl->Lock(info, timeout);
1167
1168         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1169
1170         return E_SUCCESS;
1171 }
1172
1173 result
1174 Canvas::Unlock()
1175 {
1176         CHECK_CONSTRUCTED;
1177
1178         result r = this->__pImpl->Unlock();
1179
1180         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1181
1182         return E_SUCCESS;
1183 }
1184
1185 void
1186 Canvas::SetForegroundColor(const Color& fgColor)
1187 {
1188         CHECK_CONSTRUCTED_VOID;
1189
1190         return this->__pImpl->SetForegroundColor(fgColor);
1191 }
1192
1193 Color
1194 Canvas::GetForegroundColor(void) const
1195 {
1196         CHECK_CONSTRUCTED_EX(Color::GetColor(COLOR_ID_BLACK));
1197
1198         return this->__pImpl->GetForegroundColor();
1199 }
1200
1201 void
1202 Canvas::SetBackgroundColor(const Color& bgColor)
1203 {
1204         CHECK_CONSTRUCTED_VOID;
1205
1206         return this->__pImpl->SetBackgroundColor(bgColor);
1207 }
1208
1209 Color
1210 Canvas::GetBackgroundColor(void) const
1211 {
1212         CHECK_CONSTRUCTED_EX(Color::GetColor(COLOR_ID_BLACK));
1213
1214         return this->__pImpl->GetBackgroundColor();
1215 }
1216
1217 result
1218 Canvas::SetPosition(const Point& vcPoint)
1219 {
1220         CHECK_CONSTRUCTED;
1221
1222         result r = this->__pImpl->SetPosition(vcPoint);
1223
1224         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1225
1226         return E_SUCCESS;
1227 }
1228
1229 result
1230 Canvas::SetPosition(int vcX, int vcY)
1231 {
1232         CHECK_CONSTRUCTED;
1233
1234         result r = this->__pImpl->SetPosition(vcX, vcY);
1235
1236         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1237
1238         return E_SUCCESS;
1239 }
1240
1241 result
1242 Canvas::SetCompositeMode(CompositeMode compositeMode)
1243 {
1244         CHECK_CONSTRUCTED;
1245
1246         result r = this->__pImpl->SetCompositeMode(compositeMode);
1247
1248         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1249
1250         return E_SUCCESS;
1251 }
1252
1253 CompositeMode
1254 Canvas::GetCompositeMode(void) const
1255 {
1256         CHECK_CONSTRUCTED_EX(COMPOSITE_MODE_SRC_OVER);
1257
1258         return this->__pImpl->GetCompositeMode();
1259 }
1260
1261 }} // Tizen::Graphics