Fork for IVI: mesa fixing
[profile/ivi/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 BufferInfo& bufferInfo)
106 {
107         CHECK_NOT_CONSTRUCTED;
108
109         result r = this->__pImpl->Construct(bufferInfo);
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::Clear(void)
118 {
119         CHECK_CONSTRUCTED;
120
121         result r = this->__pImpl->Clear();
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(const Rectangle& vcRect)
130 {
131         CHECK_CONSTRUCTED;
132
133         result r = this->__pImpl->Clear(vcRect);
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::Copy(const Point& vcDestPoint, const Canvas& canvas, const Rectangle& vcSrcRect)
142 {
143         CHECK_CONSTRUCTED;
144
145         SysTryReturnResult(NID_GRP, _Util::CheckValidity(&canvas), E_INVALID_ARG, "The source canvas is invalid.\n");
146
147         const Tizen::Graphics::_CanvasImpl& impl = *canvas.__pImpl;
148
149         result r = this->__pImpl->Copy(vcDestPoint, impl, vcSrcRect);
150
151         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
152
153         return E_SUCCESS;
154 }
155
156 result
157 Canvas::Copy(const Rectangle& vcDestRect, const Canvas& canvas, const Rectangle& vcSrcRect)
158 {
159         CHECK_CONSTRUCTED;
160
161         SysTryReturnResult(NID_GRP, _Util::CheckValidity(&canvas), E_INVALID_ARG, "The source canvas is invalid.\n");
162
163         const Tizen::Graphics::_CanvasImpl& impl = *canvas.__pImpl;
164
165         result r = this->__pImpl->Copy(vcDestRect, impl, vcSrcRect);
166
167         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
168
169         return E_SUCCESS;
170 }
171
172 result
173 Canvas::DrawArc(const Rectangle& vcBounds, int startAngle, int endAngle, ArcStyle arcStyle)
174 {
175         CHECK_CONSTRUCTED;
176
177         result r = this->__pImpl->DrawArc(vcBounds, startAngle, endAngle, arcStyle);
178
179         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
180
181         return E_SUCCESS;
182 }
183
184 result
185 Canvas::DrawBitmap(const Rectangle& vcRect, const Bitmap& bitmap)
186 {
187         CHECK_CONSTRUCTED;
188
189         SysTryReturnResult(NID_GRP, _Util::CheckValidity(&bitmap), E_INVALID_ARG, "The source bitmap is invalid.\n");
190
191         const Tizen::Graphics::_BitmapImpl& impl = *bitmap.__pImpl;
192
193         result r = this->__pImpl->DrawBitmap(vcRect, impl);
194
195         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
196
197         return E_SUCCESS;
198 }
199
200 result
201 Canvas::DrawBitmap(const Point& vcPoint, const Bitmap& bitmap)
202 {
203         CHECK_CONSTRUCTED;
204
205         SysTryReturnResult(NID_GRP, _Util::CheckValidity(&bitmap), E_INVALID_ARG, "The source bitmap is invalid.\n");
206
207         const Tizen::Graphics::_BitmapImpl& impl = *bitmap.__pImpl;
208
209         result r = this->__pImpl->DrawBitmap(vcPoint, impl);
210
211         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
212
213         return E_SUCCESS;
214 }
215
216 result
217 Canvas::DrawBitmap(const Rectangle& vcDestRect, const Bitmap& srcBitmap, const Rectangle& vcSrcRect)
218 {
219         CHECK_CONSTRUCTED;
220
221         SysTryReturnResult(NID_GRP, _Util::CheckValidity(&srcBitmap), E_INVALID_ARG, "The source bitmap is invalid.\n");
222
223         const Tizen::Graphics::_BitmapImpl& impl = *srcBitmap.__pImpl;
224
225         result r = this->__pImpl->DrawBitmap(vcDestRect, impl, vcSrcRect);
226
227         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
228
229         return E_SUCCESS;
230 }
231
232 result
233 Canvas::DrawBitmap(const Point& vcPoint, const Bitmap& bitmap, FlipDirection dir)
234 {
235         CHECK_CONSTRUCTED;
236
237         SysTryReturnResult(NID_GRP, _Util::CheckValidity(&bitmap), E_INVALID_ARG, "The source bitmap is invalid.\n");
238
239         const Tizen::Graphics::_BitmapImpl& impl = *bitmap.__pImpl;
240
241         result r = this->__pImpl->DrawBitmap(vcPoint, impl, dir);
242
243         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
244
245         return E_SUCCESS;
246 }
247
248 result
249 Canvas::DrawBitmap(const Point& vcPoint, const Bitmap& bitmap, const Point& vcPivot, int degree)
250 {
251         CHECK_CONSTRUCTED;
252
253         SysTryReturnResult(NID_GRP, _Util::CheckValidity(&bitmap), E_INVALID_ARG, "The source bitmap is invalid.\n");
254
255         const Tizen::Graphics::_BitmapImpl& impl = *bitmap.__pImpl;
256
257         result r = this->__pImpl->DrawBitmap(vcPoint, impl, vcPivot, degree);
258
259         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
260
261         return E_SUCCESS;
262 }
263
264 result
265 Canvas::DrawNinePatchedBitmap(const Rectangle& vcRect, const Bitmap& bitmap)
266 {
267         CHECK_CONSTRUCTED;
268
269         SysTryReturnResult(NID_GRP, _Util::CheckValidity(&bitmap), E_INVALID_ARG, "The source bitmap is invalid.\n");
270
271         const Tizen::Graphics::_BitmapImpl& impl = *bitmap.__pImpl;
272
273         result r = this->__pImpl->DrawNinePatchedBitmap(vcRect, impl);
274
275         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
276
277         return E_SUCCESS;
278 }
279
280 result
281 Canvas::DrawEllipse(const Rectangle& vcBounds)
282 {
283         CHECK_CONSTRUCTED;
284
285         result r = this->__pImpl->DrawEllipse(vcBounds);
286
287         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
288
289         return E_SUCCESS;
290 }
291
292 result
293 Canvas::DrawLine(const Point& vcPoint1, const Point& vcPoint2)
294 {
295         CHECK_CONSTRUCTED;
296
297         result r = this->__pImpl->DrawLine(vcPoint1, vcPoint2);
298
299         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
300
301         return E_SUCCESS;
302 }
303
304 result
305 Canvas::DrawPolygon(const Tizen::Base::Collection::IList& vcPoints)
306 {
307         CHECK_CONSTRUCTED;
308
309         result r = this->__pImpl->DrawPolygon(vcPoints);
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::DrawPolyline(const Tizen::Base::Collection::IList& vcPoints)
318 {
319         CHECK_CONSTRUCTED;
320
321         result r = this->__pImpl->DrawPolyline(vcPoints);
322
323         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
324
325         return E_SUCCESS;
326 }
327
328 result
329 Canvas::DrawRectangle(const Rectangle& vcRect)
330 {
331         CHECK_CONSTRUCTED;
332
333         result r = this->__pImpl->DrawRectangle(vcRect);
334
335         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
336
337         return E_SUCCESS;
338 }
339
340 result
341 Canvas::DrawRoundRectangle(const Rectangle& vcRect, const Dimension& vcArcDim)
342 {
343         CHECK_CONSTRUCTED;
344
345         result r = this->__pImpl->DrawRoundRectangle(vcRect, vcArcDim);
346
347         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
348
349         return E_SUCCESS;
350 }
351
352 result
353 Canvas::DrawTriangle(const Point& vcPoint1, const Point& vcPoint2, const Point& vcPoint3)
354 {
355         CHECK_CONSTRUCTED;
356
357         result r = this->__pImpl->DrawTriangle(vcPoint1, vcPoint2, vcPoint3);
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::FillEllipse(const Color& color, const Rectangle& vcBounds)
366 {
367         CHECK_CONSTRUCTED;
368
369         result r = this->__pImpl->FillEllipse(color, vcBounds);
370
371         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
372
373         return E_SUCCESS;
374 }
375
376 result
377 Canvas::FillPolygon(const Color& color, const Tizen::Base::Collection::IList& vcPoints)
378 {
379         CHECK_CONSTRUCTED;
380
381         result r = this->__pImpl->FillPolygon(color, vcPoints);
382
383         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
384
385         return E_SUCCESS;
386 }
387
388 result
389 Canvas::FillRectangle(const Color& color, const Rectangle& vcRect)
390 {
391         CHECK_CONSTRUCTED;
392
393         result r = this->__pImpl->FillRectangle(color, vcRect);
394
395         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
396
397         return E_SUCCESS;
398 }
399
400 result
401 Canvas::FillRoundRectangle(const Color& color, const Rectangle& vcRect, const Dimension& vcArcDim)
402 {
403         CHECK_CONSTRUCTED;
404
405         result r = this->__pImpl->FillRoundRectangle(color, vcRect, vcArcDim);
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::FillTriangle(const Color& color, const Point& vcPoint1, const Point& vcPoint2, const Point& vcPoint3)
414 {
415         CHECK_CONSTRUCTED;
416
417         result r = this->__pImpl->FillTriangle(color, vcPoint1, vcPoint2, vcPoint3);
418
419         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
420
421         return E_SUCCESS;
422 }
423
424 result
425 Canvas::DrawText(const Point& vcPoint, const Tizen::Base::String& text)
426 {
427         CHECK_CONSTRUCTED;
428
429         result r = this->__pImpl->DrawText(vcPoint, text);
430
431         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
432
433         return E_SUCCESS;
434 }
435
436 result
437 Canvas::DrawText(const Point& vcPoint, const Tizen::Base::String& text, int length)
438 {
439         CHECK_CONSTRUCTED;
440
441         result r = this->__pImpl->DrawText(vcPoint, text, 0, length);
442
443         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
444
445         return E_SUCCESS;
446 }
447
448 result
449 Canvas::DrawText(const Point& vcPoint, const Tizen::Base::String& text, const Color& outlineColor)
450 {
451         CHECK_CONSTRUCTED;
452
453         result r = this->__pImpl->DrawText(vcPoint, text, 0, outlineColor);
454
455         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
456
457         return E_SUCCESS;
458 }
459
460 result
461 Canvas::DrawText(const Point& vcPoint, const Tizen::Base::String& text, int length, const Color& outlineColor)
462 {
463         CHECK_CONSTRUCTED;
464
465         result r = this->__pImpl->DrawText(vcPoint, text, 0, length, outlineColor);
466
467         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
468
469         return E_SUCCESS;
470 }
471
472 result
473 Canvas::DrawText(const Point& vcPoint, const EnrichedText& etext)
474 {
475         CHECK_CONSTRUCTED;
476
477         SysTryReturnResult(NID_GRP, _Util::CheckValidity(&etext), E_INVALID_ARG, "The source enriched text is invalid.\n");
478
479         result r = this->__pImpl->DrawText(vcPoint, etext);
480
481         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
482
483         return E_SUCCESS;
484 }
485
486 Rectangle
487 Canvas::GetBounds(void) const
488 {
489         CHECK_CONSTRUCTED_EX(Rectangle());
490
491         return this->__pImpl->GetBounds();
492 }
493
494 LineStyle
495 Canvas::GetLineStyle() const
496 {
497         CHECK_CONSTRUCTED_EX(LINE_STYLE_MAX);
498
499         return this->__pImpl->GetLineStyle();
500 }
501
502 int
503 Canvas::GetLineWidth() const
504 {
505         CHECK_CONSTRUCTED_EX(-1);
506
507         return this->__pImpl->GetLineWidth();
508 }
509
510 result
511 Canvas::SetLineStyle(LineStyle style)
512 {
513         CHECK_CONSTRUCTED;
514
515         result r = this->__pImpl->SetLineStyle(style);
516
517         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
518
519         return E_SUCCESS;
520 }
521
522 result
523 Canvas::SetLineWidth(int vcWidth)
524 {
525         CHECK_CONSTRUCTED;
526
527         result r = this->__pImpl->SetLineWidth(vcWidth);
528
529         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
530
531         return E_SUCCESS;
532 }
533
534 result
535 Canvas::GetDashPattern(Tizen::Base::Collection::IListT<int>& pattern, int& offset) const
536 {
537         CHECK_CONSTRUCTED;
538
539         result r = this->__pImpl->GetDashPattern(pattern, offset);
540
541         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
542
543         return E_SUCCESS;
544 }
545
546 result
547 Canvas::SetDashPattern(const Tizen::Base::Collection::IListT<int>& pattern, int offset)
548 {
549         CHECK_CONSTRUCTED;
550
551         result r = this->__pImpl->SetDashPattern(pattern, offset);
552
553         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
554
555         return E_SUCCESS;
556 }
557
558 #if 0 // Not public feature yet
559
560 result
561 Canvas::SetDrawingQuality(BitmapDrawingQuality quality)
562 {
563         CHECK_CONSTRUCTED;
564
565         result r = this->__pImpl->SetDrawingQuality(quality);
566
567         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r,"[%s] Propagating.", GetErrorMessage(r));
568
569         return E_SUCCESS;
570 }
571
572 BitmapDrawingQuality
573 Canvas::GetDrawingQuality(void) const
574 {
575         CHECK_CONSTRUCTED_EX(BITMAP_DRAWING_QUALITY_LOW);
576
577         return this->__pImpl->GetDrawingQuality();
578 }
579
580 #endif
581
582 result
583 Canvas::GetPixel(const Point& vcPoint, Color& color) const
584 {
585         CHECK_CONSTRUCTED;
586
587         result r = this->__pImpl->GetPixel(vcPoint, color);
588
589         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
590
591         return E_SUCCESS;
592 }
593
594 result
595 Canvas::SetPixel(const Point& vcPoint)
596 {
597         CHECK_CONSTRUCTED;
598
599         result r = this->__pImpl->SetPixel(vcPoint);
600
601         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
602
603         return E_SUCCESS;
604 }
605
606 result
607 Canvas::Show()
608 {
609         CHECK_CONSTRUCTED;
610
611         result r = this->__pImpl->Show();
612
613         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
614
615         return E_SUCCESS;
616 }
617
618 result
619 Canvas::Show(const Rectangle& vcRect)
620 {
621         CHECK_CONSTRUCTED;
622
623         result r = this->__pImpl->Show(vcRect);
624
625         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
626
627         return E_SUCCESS;
628 }
629
630 result
631 Canvas::SetFont(const Font& font)
632 {
633         CHECK_CONSTRUCTED;
634
635         SysTryReturnResult(NID_GRP, _Util::CheckValidity(&font), E_INVALID_ARG, "The source font is invalid.\n");
636
637         result r = this->__pImpl->SetFont(font);
638
639         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
640
641         return E_SUCCESS;
642 }
643
644 Font*
645 Canvas::GetFontN(void) const
646 {
647         CHECK_CONSTRUCTED_EX(null);
648
649         Font* pReturnFont = this->__pImpl->GetFontN();
650
651         if (pReturnFont == null)
652         {
653                 result r = GetLastResult();
654
655                 SysTryReturn(NID_GRP, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
656
657                 return null;
658         }
659
660         return pReturnFont;
661 }
662
663 result
664 Canvas::SetClipBounds(const Rectangle& vcRect)
665 {
666         CHECK_CONSTRUCTED;
667
668         result r = this->__pImpl->SetClipBounds(vcRect);
669
670         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
671
672         return E_SUCCESS;
673 }
674
675 Rectangle
676 Canvas::GetClipBounds(void) const
677 {
678         CHECK_CONSTRUCTED_EX(Rectangle());
679
680         return this->__pImpl->GetClipBounds();
681 }
682
683 result
684 Canvas::Lock(BufferInfo& info, long timeout)
685 {
686         CHECK_CONSTRUCTED;
687
688         result r = this->__pImpl->Lock(info, timeout);
689
690         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
691
692         return E_SUCCESS;
693 }
694
695 result
696 Canvas::Unlock()
697 {
698         CHECK_CONSTRUCTED;
699
700         result r = this->__pImpl->Unlock();
701
702         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
703
704         return E_SUCCESS;
705 }
706
707 void
708 Canvas::SetForegroundColor(const Color& fgColor)
709 {
710         CHECK_CONSTRUCTED_VOID;
711
712         return this->__pImpl->SetForegroundColor(fgColor);
713 }
714
715 Color
716 Canvas::GetForegroundColor(void) const
717 {
718         CHECK_CONSTRUCTED_EX(Color::GetColor(COLOR_ID_BLACK));
719
720         return this->__pImpl->GetForegroundColor();
721 }
722
723 void
724 Canvas::SetBackgroundColor(const Color& bgColor)
725 {
726         CHECK_CONSTRUCTED_VOID;
727
728         return this->__pImpl->SetBackgroundColor(bgColor);
729 }
730
731 Color
732 Canvas::GetBackgroundColor(void) const
733 {
734         CHECK_CONSTRUCTED_EX(Color::GetColor(COLOR_ID_BLACK));
735
736         return this->__pImpl->GetBackgroundColor();
737 }
738
739 result
740 Canvas::SetPosition(const Point& vcPoint)
741 {
742         CHECK_CONSTRUCTED;
743
744         result r = this->__pImpl->SetPosition(vcPoint);
745
746         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
747
748         return E_SUCCESS;
749 }
750
751 result
752 Canvas::SetPosition(int vcX, int vcY)
753 {
754         CHECK_CONSTRUCTED;
755
756         result r = this->__pImpl->SetPosition(vcX, vcY);
757
758         SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
759
760         return E_SUCCESS;
761 }
762
763 }} // Tizen::Graphics