modified doxygen comment
[framework/osp/uifw.git] / inc / FGrpCanvas.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0/
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.h
20  * @brief       This is the header file for the %Canvas class.
21  *
22  * This header file contains the declarations of the %Canvas class.
23  *
24  */
25
26 #ifndef _FGRP_CANVAS_H_
27 #define _FGRP_CANVAS_H_
28
29 #include <FBase.h>
30 #include <FBaseObject.h>
31 #include <FBaseColArrayListT.h>
32 #include <FGrpRectangle.h>
33 #include <FGrpFloatRectangle.h>
34 #include <FGrpColor.h>
35 #include <FGrpPixelFormat.h>
36 #include <FGrpBufferInfo.h>
37 #include <FGrpBitmap.h>
38 #include <FGrpCanvasCommon.h>
39
40 namespace Tizen { namespace Graphics
41 {
42 class Font;
43 class EnrichedText;
44
45 /**
46  * @class       Canvas
47  * @brief       This class provides methods for drawing objects.
48  *
49  * @since       2.0
50  *
51  * @final       This class is not intended for extension.
52  *
53  * The %Canvas class provides a rectangular region to draw objects on the display device. The %Canvas instance is
54  * associated with a specific context.
55  * @n
56  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/graphics/canvas.htm">Canvas</a>.
57  *
58  */
59 class _OSP_EXPORT_ Canvas
60         : public Tizen::Base::Object
61 {
62 public:
63         /**
64          * This is the default constructor for this class.
65          *
66          * @since               2.0
67          * @remarks             After creating an instance of this class, one of the Construct() methods must be
68          *                              called explicitly to initialize this instance.
69          */
70         Canvas(void);
71
72         /**
73          * This is the destructor for this class.
74          *
75          * @since       2.0
76          */
77         virtual ~Canvas(void);
78
79         /**
80          * Initializes this instance of %Canvas to create a canvas control of the same size as that of the
81          * device screen.
82          *
83          * @since               2.0
84          *
85          * @return              An error code
86          * @exception   E_SUCCESS                       The method is successful.
87          * @exception   E_OUT_OF_MEMORY                 The memory is insufficient.
88          */
89         result Construct(void);
90
91         /**
92          * Initializes this instance of %Canvas with the specified parameter.
93          *
94          * @since               2.0
95          *
96          * @return              An error code
97          * @param[in]   rect                    The location and size of the canvas control on the device screen @n
98          *                                                              The width and height of the rectangle must be greater than @c 0.
99          *                                                              If this condition is not satisfied, the @c E_OUT_OF_RANGE exception is returned.
100          * @exception   E_SUCCESS               The method is successful.
101          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
102          */
103         result Construct(const Rectangle& rect);
104
105         /**
106          * Initializes this instance of %Canvas with a specified parameter.
107          *
108          * @since               2.1
109          *
110          * @return              An error code
111          * @param[in]   rect                    The location and size of the canvas control on the device screen @n
112          *                                                              The width and height of the rectangle must be greater than @c 0.0f.
113          *                                                              If this condition is not satisfied, the @c E_OUT_OF_RANGE exception is returned.
114          * @exception   E_SUCCESS               The method is successful.
115          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
116          */
117         result Construct(const FloatRectangle& rect);
118
119         /**
120          * Initializes this instance of %Canvas with the buffer information.
121          *
122          * @since 2.0
123          *
124          * @return              An error code
125          * @param[in]   bufferInfo           The information of the buffer to use by the canvas
126          * @exception   E_SUCCESS            The method is successful.
127          * @exception   E_INVALID_ARG        The buffer information is invalid.
128          * @exception   E_UNSUPPORTED_FORMAT The given buffer information is a format unsupported by the canvas.
129          * @exception   E_SYSTEM             An unknown operating system error has occurred
130          * @remarks Only ::PIXEL_FORMAT_ARGB8888 is supported.
131          */
132         result Construct(const BufferInfo& bufferInfo);
133
134 public:
135         /**
136          * Clears the current instance of %Canvas with the background color.
137          *
138          * @since               2.0
139          *
140          * @return              An error code
141          * @exception   E_SUCCESS                       The method is successful.
142          */
143         result Clear(void);
144
145         /**
146          * Clears a rectangular region of the current instance of %Canvas with the background color.
147          *
148          * @since               2.0
149          *
150          * @return              An error code
151          * @param[in]   rect                    The location and size of the rectangular region @n
152          *                                                              The width and height of the rectangle must be greater than or equal to @c 0.
153          *                                                              The rectangular region must not fall outside the edges of the
154          *                                                              current instance of %Canvas entirely.If these conditions are not
155          *                                                              satisfied, the @c E_OUT_OF_RANGE exception is returned.
156          * @exception   E_SUCCESS               The method is successful.
157          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
158          */
159         result Clear(const Rectangle& rect);
160
161         /**
162          * Clears a rectangular region of the current instance of %Canvas with the background color.
163          *
164          * @since               2.1
165          *
166          * @return              An error code
167          * @param[in]   rect                    The location and size of the rectangular region @n
168          *                                                              The width and height of the rectangle must be greater than or equal to @c 0.0f.
169          *                                                              The rectangular region must not fall outside the edges of the
170          *                                                              current instance of %Canvas entirely.If these conditions are not
171          *                                                              satisfied, the @c E_OUT_OF_RANGE exception is returned.
172          * @exception   E_SUCCESS               The method is successful.
173          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
174          */
175         result Clear(const FloatRectangle& rect);
176
177         /**
178          * Copies the specified rectangular region from the specified instance of %Canvas to the current instance of
179          * %Canvas at the specified location.
180          *
181          * @since               2.0
182          *
183          * @return              An error code
184          * @param[in]   destPoint                       The location to copy the rectangular region
185          * @param[in]   srcCanvas                       The source %Canvas
186          * @param[in]   srcRect                         The location and size of the rectangular region on the source %Canvas @n
187          *                                                                      The rectangular region must not fall outside the edges of
188          *                                                                      the current instance of %Canvas entirely. If this condition is
189          *                                                                      not satisfied, the @c E_OUT_OF_RANGE exception is returned.
190          * @exception   E_SUCCESS                       The method is successful.
191          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
192          * @exception   E_OUT_OF_RANGE          The value of the argument is outside the valid range defined by the method.
193          */
194         result Copy(const Point& destPoint, const Canvas& srcCanvas, const Rectangle& srcRect);
195
196         /**
197          * Copies a specified rectangular region from a specified instance of %Canvas to the current instance of
198          * %Canvas at a specified location.
199          *
200          * @since               2.1
201          *
202          * @return              An error code
203          * @param[in]   destPoint                       The location to copy the rectangular region
204          * @param[in]   srcCanvas                       The source %Canvas
205          * @param[in]   srcRect                         The location and size of the rectangular region on the source %Canvas @n
206          *                                                                      The rectangular region must not fall outside the edges of
207          *                                                                      the current instance of %Canvas entirely. If this condition is
208          *                                                                      not satisfied, the @c E_OUT_OF_RANGE exception is returned.
209          * @exception   E_SUCCESS                       The method is successful.
210          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
211          * @exception   E_OUT_OF_RANGE          The value of the argument is outside the valid range defined by the method.
212          */
213         result Copy(const FloatPoint& destPoint, const Canvas& srcCanvas, const FloatRectangle& srcRect);
214
215         /**
216          * Copies the scaled image of the specified rectangular region from the specified instance of
217          * %Canvas to the current instance of %Canvas.
218          *
219          * @since               2.0
220          *
221          * @return              An error code
222          * @param[in]   destRect                        The location and size of the destination image @n
223          *                                                                      The value of @c destRect must not fall outside the edges of
224          *                                                                      the current instance of %Canvas entirely. If this condition is
225          *                                                                      not satisfied, the @c E_OUT_OF_RANGE exception is returned.
226          * @param[in]   srcCanvas                       The source %Canvas
227          * @param[in]   srcRect                         The location and size of the source image @n
228          *                                                                      The value of @c srcRect must not fall outside the edges of
229          *                                                                      the current instance of %Canvas entirely. If this condition is
230          *                                                                      not satisfied, the @c E_OUT_OF_RANGE exception is returned.
231          * @exception   E_SUCCESS                       The method is successful.
232          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
233          * @exception   E_OUT_OF_RANGE          The value of the argument is outside the valid range defined by the method.
234          * @exception   E_INVALID_OPERATION     The current state of the instance prohibits the execution of this operation.
235          */
236         result Copy(const Rectangle& destRect, const Canvas& srcCanvas, const Rectangle& srcRect);
237
238         /**
239          * Copies the scaled image of a specified rectangular region from a specified instance of
240          * %Canvas to the current instance of %Canvas.
241          *
242          * @since               2.1
243          *
244          * @return              An error code
245          * @param[in]   destRect                        The location and size of the destination image @n
246          *                                                                      The value of @c destRect must not fall outside the edges of
247          *                                                                      the current instance of %Canvas entirely. If this condition is
248          *                                                                      not satisfied, the @c E_OUT_OF_RANGE exception is returned.
249          * @param[in]   srcCanvas                       The source %Canvas
250          * @param[in]   srcRect                         The location and size of the source image @n
251          *                                                                      The value of @c srcRect must not fall outside the edges of
252          *                                                                      the current instance of %Canvas entirely. If this condition is
253          *                                                                      not satisfied, the @c E_OUT_OF_RANGE exception is returned.
254          * @exception   E_SUCCESS                       The method is successful.
255          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
256          * @exception   E_OUT_OF_RANGE          The value of the argument is outside the valid range defined by the method.
257          * @exception   E_INVALID_OPERATION     The current state of the instance prohibits the execution of this operation.
258          */
259         result Copy(const FloatRectangle& destRect, const Canvas& srcCanvas, const FloatRectangle& srcRect);
260
261         /**
262          * Gets the line style set for the current instance of %Canvas.
263          *
264          * @since               2.0
265          *
266          * @return              An instance of LineStyle
267          * @remarks The default value is @c LINE_STYLE_SOLID.
268          */
269         LineStyle GetLineStyle(void) const;
270
271         /**
272          * Gets the line width of the current instance of %Canvas.
273          *
274          * @since               2.0
275          *
276          * @return              The line width, @n
277          *                              else @c -1 if the method fails
278          * @remarks The default value is @c 1.
279          */
280         int GetLineWidth(void) const;
281
282         /**
283          * Gets the line width of the current instance of %Canvas.
284          *
285          * @since               2.1
286          *
287          * @return              The line width, @n
288          *                              else @c -1.0f if the method fails
289          * @remarks The default value is @c 1.0f.
290          */
291         float GetLineWidthF(void) const;
292
293         /**
294          * Sets the line style for the current instance of %Canvas.
295          *
296          * @since               2.0
297          *
298          * @return              An error code
299          * @param[in]   style                           The new line style for the %Canvas control
300          * @exception   E_SUCCESS                       The method is successful.
301          * @exception   E_INVALID_ARG           The specified input parameter is invalid.
302          */
303         result SetLineStyle(LineStyle style);
304
305         /**
306          * Sets the line width for the current instance of %Canvas.
307          *
308          * @since               2.0
309          *
310          * @return              An error code
311          * @param[in]   width                           The new width for the %Canvas control @n
312          *                                                                      The width for the %Canvas control must be greater than @c 0.
313          * @exception   E_SUCCESS                       The method is successful.
314          * @exception   E_OUT_OF_RANGE          The value of the argument is outside the valid range defined by the method.
315          */
316         result SetLineWidth(int width);
317
318         /**
319          * Sets the line width for the current instance of %Canvas.
320          *
321          * @since               2.1
322          *
323          * @return              An error code
324          * @param[in]   width                           The new width for the %Canvas control @n
325          *                                                                      The width for the %Canvas control must be greater than @c 0.0f.
326          * @exception   E_SUCCESS                       The method is successful.
327          * @exception   E_OUT_OF_RANGE          The value of the argument is outside the valid range defined by the method.
328          */
329         result SetLineWidth(float width);
330
331         /**
332          * Gets the dash pattern of the current instance of %Canvas.
333          *
334          * @since 2.0
335          *
336          * @return              An error code
337          * @param[out]  pattern                 The list containing the information of dash pattern.
338          * @param[out]  offset                  The offset into the dash pattern at which the stroke must start
339          * @exception   E_SUCCESS               The method is successful.
340          * @exception   E_INVALID_ARG   A specific input parameter is invalid.
341          */
342         result GetDashPattern(Tizen::Base::Collection::IListT<int>& pattern, int& offset) const;
343
344         /**
345          * Gets the dash pattern of the current instance of %Canvas.
346          *
347          * @since 2.1
348          *
349          * @return              An error code
350          * @param[out]  pattern                 The list containing the information of dash pattern
351          * @param[out]  offset                  The offset into the dash pattern at which the stroke must start
352          * @exception   E_SUCCESS               The method is successful.
353          * @exception   E_INVALID_ARG   A specific input parameter is invalid.
354          */
355         result GetDashPattern(Tizen::Base::Collection::IListT<float>& pattern, float& offset) const;
356
357         /**
358          * Sets the dash pattern for the current instance of %Canvas.
359          *
360          * @since 2.0
361          *
362          * @return              An error code
363          * @param[in]   pattern                 The list containing the information of dash pattern.
364          * @param[in]   offset                  The offset into the dash pattern at which the stroke must start
365          * @exception   E_SUCCESS               The method is successful.
366          * @exception   E_INVALID_ARG   A specific input parameter is invalid.
367          */
368         result SetDashPattern(const Tizen::Base::Collection::IListT<int>& pattern, int offset);
369
370         /**
371          * Sets the dash pattern for the current instance of %Canvas.
372          *
373          * @since 2.1
374          *
375          * @return              An error code
376          * @param[in]   pattern                 The list containing the information of dash pattern
377          * @param[in]   offset                  The offset into the dash pattern at which the stroke must start
378          * @exception   E_SUCCESS               The method is successful.
379          * @exception   E_INVALID_ARG   A specific input parameter is invalid.
380          */
381         result SetDashPattern(const Tizen::Base::Collection::IListT<float>& pattern, float offset);
382
383         /**
384          * Sets the line cap style.
385          *
386          * @since 2.1
387          *
388          * @return              An error code
389          * @param[in]   lineCapStyle    The new line cap style
390          * @exception   E_SUCCESS               The method is successful.
391          * @exception   E_INVALID_ARG   The specified input parameter is invalid.
392          */
393         result SetLineCapStyle(LineCapStyle lineCapStyle);
394
395         /**
396          * Gets the line cap style for the current instance.
397          *
398          * @since 2.1
399          *
400          * @return              The current line cap style
401          * @remarks             The default style is @c LINE_CAP_STYLE_ROUND.
402          */
403         LineCapStyle GetLineCapStyle(void) const;
404
405         /**
406          * Sets the line join style.
407          *
408          * @since 2.1
409          *
410          * @return              An error code
411          * @param[in]   lineJoinStyle   The new line join style
412          * @exception   E_SUCCESS               The method is successful.
413          * @exception   E_INVALID_ARG   The specified input parameter is invalid.
414          */
415         result SetLineJoinStyle(LineJoinStyle lineJoinStyle);
416
417         /**
418          * Gets the line join style for the current instance.
419          *
420          * @since 2.1
421          *
422          * @return              The current line join style
423          * @remarks             The default style is @c LINE_JOIN_STYLE_ROUND.
424          */
425         LineJoinStyle GetLineJoinStyle(void) const;
426
427         /**
428          * Gets the color information at the specified point.
429          *
430          * @since               2.0
431          *
432          * @return              An error code
433          * @param[in]   point                   The location of the point relative to the upper-left corner of the current instance of %Canvas @n
434          *                                                              The point must not fall outside the edges of %Canvas. If this
435          *                                                              condition is not satisfied, the @c E_OUT_OF_RANGE exception is returned.
436          * @param[out]  color                   An instance of Color
437          * @exception   E_SUCCESS               The method is successful.
438          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
439          */
440         result GetPixel(const Point& point, Color& color) const;
441
442         /**
443          * Gets the color information at a specified point.
444          *
445          * @since               2.1
446          *
447          * @return              An error code
448          * @param[in]   point                   The location of the point relative to the upper-left corner of the current instance of %Canvas @n
449          *                                                              The point must not fall outside the edges of %Canvas. If this
450          *                                                              condition is not satisfied, the @c E_OUT_OF_RANGE exception is returned.
451          * @param[out]  color                   An instance of Color
452          * @exception   E_SUCCESS               The method is successful.
453          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
454          */
455         result GetPixel(const FloatPoint& point, Color& color) const;
456
457         /**
458          * Sets a point at the specified coordinate.
459          *
460          * @since               2.0
461          *
462          * @return              An error code
463          * @param[in]   point                   The location of the point relative to the upper-left corner of the current instance of %Canvas @n
464          *                                                              The point must not entirely fall outside the edges of %Canvas.
465          *                                                              If this condition is not satisfied, the @c E_OUT_OF_RANGE exception
466          *                                                              is returned.
467          * @exception   E_SUCCESS               The method is successful.
468          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
469          */
470         result SetPixel(const Point& point);
471
472         /**
473          * Sets a point at a specified coordinate.
474          *
475          * @since               2.0
476          *
477          * @return              An error code
478          * @param[in]   point                   The location of the point relative to the upper-left corner of the current instance of %Canvas @n
479          *                                                              The point must not entirely fall outside the edges of %Canvas.
480          *                                                              If this condition is not satisfied, the @c E_OUT_OF_RANGE exception
481          *                                                              is returned.
482          * @exception   E_SUCCESS               The method is successful.
483          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
484          */
485         result SetPixel(const FloatPoint& point);
486
487         /**
488          * Draws a line between the two specified points.
489          *
490          * @since               2.0
491          *
492          * @return              An error code
493          * @param[in]   point1                          The starting point
494          * @param[in]   point2                          The end point
495          * @exception   E_SUCCESS                       The method is successful.
496          */
497         result DrawLine(const Point& point1, const Point& point2);
498
499         /**
500          * Draws a line between the two specified points.
501          *
502          * @since               2.1
503          *
504          * @return              An error code
505          * @param[in]   point1                          The starting point
506          * @param[in]   point2                          The end point
507          * @exception   E_SUCCESS                       The method is successful.
508          */
509         result DrawLine(const FloatPoint& point1, const FloatPoint& point2);
510
511         /**
512          * Draws a rectangle.
513          *
514          * @since               2.0
515          *
516          * @return              An error code
517          * @param[in]   rect                            The rectangle to draw on the %Canvas control @n
518          *                                                                      The width and height of the rectangle must be greater than or equal to @c 0.
519          *                                                                      The rectangle must not entirely fall outside the edges of
520          *                                                                      the %Canvas control. If these conditions are not satisfied,
521          *                                                                      the @c E_OUT_OF_RANGE exception is returned.
522          * @exception   E_SUCCESS                       The method is successful.
523          * @exception   E_OUT_OF_RANGE          The value of the argument is outside the valid range defined by the method.
524          */
525         result DrawRectangle(const Rectangle& rect);
526
527         /**
528          * Draws a rectangle.
529          *
530          * @since               2.1
531          *
532          * @return              An error code
533          * @param[in]   rect                            The rectangle that is drawn on the %Canvas control @n
534          *                                                                      The width and height of the rectangle must be greater than or equal to @c 0.0f.
535          *                                                                      The rectangle must not entirely fall outside the edges of
536          *                                                                      the %Canvas control. If these conditions are not satisfied,
537          *                                                                      the @c E_OUT_OF_RANGE exception is returned.
538          * @exception   E_SUCCESS                       The method is successful.
539          * @exception   E_OUT_OF_RANGE          The value of the argument is outside the valid range defined by the method.
540          */
541         result DrawRectangle(const FloatRectangle& rect);
542
543         /**
544          * Fills a rectangular region of the current instance of %Canvas with the specified color.
545          *
546          * @since               2.0
547          *
548          * @return              An error code
549          * @param[in]   color                   The fill color
550          * @param[in]   rect                    The rectangular region on the %Canvas control @n
551          *                                                              The width and height of the rectangle must be greater than or equal to @c 0.
552          *                                                              The rectangle must not entirely fall outside the edges of the
553          *                                                              %Canvas control. If these conditions are not satisfied, the
554          *                                                              @c E_OUT_OF_RANGE exception is returned.
555          * @exception   E_SUCCESS               The method is successful.
556          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
557          */
558         result FillRectangle(const Color& color, const Rectangle& rect);
559
560         /**
561          * Fills a rectangular region of the current instance of %Canvas with a specified color.
562          *
563          * @since               2.1
564          *
565          * @return              An error code
566          * @param[in]   color                   The fill color
567          * @param[in]   rect                    The rectangular region on the %Canvas control @n
568          *                                                              The width and height of the rectangle must be greater than or equal to @c 0.0f.
569          *                                                              The rectangle must not entirely fall outside the edges of the
570          *                                                              %Canvas control. If these conditions are not satisfied, the
571          *                                                              @c E_OUT_OF_RANGE exception is returned.
572          * @exception   E_SUCCESS               The method is successful.
573          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
574          */
575         result FillRectangle(const Color& color, const FloatRectangle& rect);
576
577         /**
578          * Draws a round-edged rectangle.
579          *
580          * @since               2.0
581          *
582          * @return              An error code
583          * @param[in]   rect                    The location and size of the rectangle @n
584          *                                                              The width and height of the rectangle must be greater than or equal to @c 0.
585          *                                                              The rectangle must not entirely fall outside the edges of the
586          *                                                              %Canvas control. If these conditions are not satisfied, the
587          *                                                              @c E_OUT_OF_RANGE exception is returned.
588          * @param[in]   arcDim                  The width and height of the round edge @n
589          *                                                      The width and height in the @c arcDim parameter must be greater than or equal to @c 0.
590          * @exception   E_SUCCESS               The method is successful.
591          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
592          */
593         result DrawRoundRectangle(const Rectangle& rect, const Dimension& arcDim);
594
595         /**
596          * Draws a round-edged rectangle.
597          *
598          * @since               2.1
599          *
600          * @return              An error code
601          * @param[in]   rect                    The location and size of the rectangle @n
602          *                                                              The width and height of the rectangle must be greater than or equal to @c 0.0f.
603          *                                                              The rectangle must not entirely fall outside the edges of the
604          *                                                              %Canvas control. If these conditions are not satisfied, the
605          *                                                              @c E_OUT_OF_RANGE exception is returned.
606          * @param[in]   arcDim                  The width and height of the round edge @n
607          *                                                      The width and height in the @c arcDim parameter must be greater than or equal to @c 0.0f.
608          * @exception   E_SUCCESS               The method is successful.
609          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
610          */
611         result DrawRoundRectangle(const FloatRectangle& rect, const FloatDimension& arcDim);
612
613         /**
614          * Draws a filled rectangle.
615          *
616          * @since               2.0
617          *
618          * @return              An error code
619          * @param[in]   color                   The fill color
620          * @param[in]   rect                    The location and size of the rectangle @n
621          *                                                              The width and height of the rectangle must be greater than or equal to @c 0.
622          *                                                              The rectangle must not entirely fall outside the edges of the
623          *                                                              %Canvas control. If these conditions are not satisfied, the
624          *                                                              @c E_OUT_OF_RANGE exception is returned.
625          * @param[in]   arcDim                  The width and height of the round edge @n
626          *                                                      The width and height mentioned in the @c arcDim parameter must be greater than or equal to @c 0.
627          * @exception   E_SUCCESS               The method is successful.
628          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
629          */
630         result FillRoundRectangle(const Color& color, const Rectangle& rect, const Dimension& arcDim);
631
632         /**
633          * Draws a filled rectangle.
634          *
635          * @since               2.1
636          *
637          * @return              An error code
638          * @param[in]   color                   The fill color
639          * @param[in]   rect                    The location and size of the rectangle @n
640          *                                                              The width and height of the rectangle must be greater than or equal to @c 0.0f.
641          *                                                              The rectangle must not entirely fall outside the edges of the
642          *                                                              %Canvas control. If these conditions are not satisfied, the
643          *                                                              @c E_OUT_OF_RANGE exception is returned.
644          * @param[in]   arcDim                  The width and height of the round edge @n
645          *                                                      The width and height mentioned in the @c arcDim parameter must be greater than or equal to @c 0.0f.
646          * @exception   E_SUCCESS               The method is successful.
647          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
648          */
649         result FillRoundRectangle(const Color& color, const FloatRectangle& rect, const FloatDimension& arcDim);
650
651         /**
652          * Draws an ellipse.
653          *
654          * @since               2.0
655          *
656          * @return              An error code
657          * @param[in]   rect                    The location and size of the bounding rectangle @n
658          *                                                              The width and height of the rectangle must be greater than or equal to @c 0.
659          *                                                              The rectangle must not entirely fall outside the edges of the
660          *                                                              %Canvas control. If these conditions are not satisfied, the
661          *                                                              @c E_OUT_OF_RANGE exception is returned.
662          * @exception   E_SUCCESS               The method is successful.
663          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
664          */
665         result DrawEllipse(const Rectangle& rect);
666
667         /**
668          * Draws an ellipse.
669          *
670          * @since               2.1
671          *
672          * @return              An error code
673          * @param[in]   rect                    The location and size of the bounding rectangle @n
674          *                                                              The width and height of the rectangle must be greater than or equal to @c 0.0f.
675          *                                                              The rectangle must not entirely fall outside the edges of the
676          *                                                              %Canvas control. If these conditions are not satisfied, the
677          *                                                              @c E_OUT_OF_RANGE exception is returned.
678          * @exception   E_SUCCESS               The method is successful.
679          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
680          */
681         result DrawEllipse(const FloatRectangle& rect);
682
683         /**
684          * Draws a filled ellipse with the specified color.
685          *
686          * @since               2.0
687          *
688          * @return              An error code
689          * @param[in]   color                   The fill color
690          * @param[in]   rect                    The location and size of the bounding rectangle @n
691          *                                                              The width and height of the rectangle must be greater than or equal to @c 0. @n
692          *                                                              The rectangle must not entirely fall outside the edges of the
693          *                                                              %Canvas control. If these conditions are not satisfied, the
694          *                                                              @c E_OUT_OF_RANGE exception is returned.
695          * @exception   E_SUCCESS               The method is successful.
696          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
697          */
698         result FillEllipse(const Color& color, const Rectangle& rect);
699
700         /**
701          * Draws a filled ellipse with a specified color.
702          *
703          * @since               2.1
704          *
705          * @return              An error code
706          * @param[in]   color                   The fill color
707          * @param[in]   rect                    The location and size of the bounding rectangle @n
708          *                                                              The width and height of the rectangle must be greater than or equal to @c 0.0f. @n
709          *                                                              The rectangle must not entirely fall outside the edges of the
710          *                                                              %Canvas control. If these conditions are not satisfied, the
711          *                                                              @c E_OUT_OF_RANGE exception is returned.
712          * @exception   E_SUCCESS               The method is successful.
713          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
714          */
715         result FillEllipse(const Color& color, const FloatRectangle& rect);
716
717         /**
718          * Draws a circular arc.
719          *
720          * @since               2.0
721          *
722          * @return              An error code
723          * @param[in]   rect                    The location and size of the bounding rectangle @n
724          *                                                              The width and height of the rectangle must be greater than or equal to @c 0.
725          *                                                              The rectangle must not entirely fall outside the edges of the
726          *                                                              %Canvas control. If these conditions are not satisfied, the
727          *                                                              @c E_OUT_OF_RANGE exception is returned.
728          * @param[in]   startAngle              The starting angle
729          * @param[in]   endAngle                The ending angle
730          * @param[in]   arcStyle                The arc style
731          * @exception   E_SUCCESS               The method is successful.
732          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
733          * @exception   E_INVALID_ARG   A specified input parameter is invalid.
734          */
735         result DrawArc(const Rectangle& rect, int startAngle, int endAngle, ArcStyle arcStyle);
736
737         /**
738          * Draws a circular arc.
739          *
740          * @since               2.1
741          *
742          * @return              An error code
743          * @param[in]   rect                    The location and size of the bounding rectangle @n
744          *                                                              The width and height of the rectangle must be greater than or equal to @c 0.0f.
745          *                                                              The rectangle must not entirely fall outside the edges of the
746          *                                                              %Canvas control. If these conditions are not satisfied, the
747          *                                                              @c E_OUT_OF_RANGE exception is returned.
748          * @param[in]   startAngle              The starting angle
749          * @param[in]   endAngle                The ending angle
750          * @param[in]   arcStyle                The arc style
751          * @exception   E_SUCCESS               The method is successful.
752          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
753          * @exception   E_INVALID_ARG   A specified input parameter is invalid.
754          */
755         result DrawArc(const FloatRectangle& rect, float startAngle, float endAngle, ArcStyle arcStyle);
756
757         /**
758          * Draws a triangle.
759          *
760          * @since               2.0
761          *
762          * @return              An error code
763          * @param[in]   point1                          The location of the first vertex
764          * @param[in]   point2                          The location of the second vertex
765          * @param[in]   point3                          The location of the third vertex
766          * @exception   E_SUCCESS                       The method is successful.
767          */
768         result DrawTriangle(const Point& point1, const Point& point2, const Point& point3);
769
770         /**
771          * Draws a triangle.
772          *
773          * @since               2.1
774          *
775          * @return              An error code
776          * @param[in]   point1                          The location of the first vertex
777          * @param[in]   point2                          The location of the second vertex
778          * @param[in]   point3                          The location of the third vertex
779          * @exception   E_SUCCESS                       The method is successful.
780          */
781         result DrawTriangle(const FloatPoint& point1, const FloatPoint& point2, const FloatPoint& point3);
782
783         /**
784          * Draw a filled triangle with the specified color.
785          *
786          * @since               2.0
787          *
788          * @return              An error code
789          * @param[in]   color                           The fill color
790          * @param[in]   point1                          The location of the first vertex
791          * @param[in]   point2                          The location of the second vertex
792          * @param[in]   point3                          The location of the third vertex
793          * @exception   E_SUCCESS                       The method is successful.
794          */
795         result FillTriangle(const Color& color, const Point& point1, const Point& point2, const Point& point3);
796
797         /**
798          * Draw a filled triangle with a specified color.
799          *
800          * @since               2.1
801          *
802          * @return              An error code
803          * @param[in]   color                           The fill color
804          * @param[in]   point1                          The location of the first vertex
805          * @param[in]   point2                          The location of the second vertex
806          * @param[in]   point3                          The location of the third vertex
807          * @exception   E_SUCCESS                       The method is successful.
808          */
809         result FillTriangle(const Color& color, const FloatPoint& point1, const FloatPoint& point2, const FloatPoint& point3);
810
811         /**
812          * Draws a poly-line.
813          *
814          * @since               2.0
815          *
816          * @return              An error code
817          * @param[in]   points                          A list containing the location of points @n
818          *                                                                      The number of points must be greater than or equal to @c 0.
819          * @exception   E_SUCCESS                       The method is successful.
820          * @exception   E_INVALID_ARG           The specified input parameter is invalid.
821          */
822         result DrawPolyline(const Tizen::Base::Collection::IList& points);
823
824         /**
825          * Draws a polygon.
826          *
827          * @since               2.0
828          *
829          * @return              An error code
830          * @param[in]   points                          A list containing the locations of the vertices of the polygon @n
831          *                                                                      The number of points must be greater than or equal to @c 0.
832          * @exception   E_SUCCESS                       The method is successful.
833          * @exception   E_INVALID_ARG           The specified input parameter is invalid.
834          */
835         result DrawPolygon(const Tizen::Base::Collection::IList& points);
836
837         /**
838          * Draws a filled polygon with the specified color.
839          *
840          * @since               2.0
841          *
842          * @return              An error code
843          * @param[in]   color                           The fill color
844          * @param[in]   points                          A list containing the locations of the vertices of the polygon @n
845          *                                                                      The number of points must be greater than or equal to @c 0.
846          * @exception   E_SUCCESS                       The method is successful.
847          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
848          */
849         result FillPolygon(const Color& color, const Tizen::Base::Collection::IList& points);
850
851         /**
852          * Sets a font to the %Canvas control.
853          *
854          * @since               2.0
855          *
856          * @return              An error code
857          * @param[in]   font                            The font @n
858          *                                                                      It must be constructed before being passed to this method.
859          * @exception   E_SUCCESS                       The method is successful.
860          * @exception   E_INVALID_ARG           The specified input parameter is invalid.
861          */
862         result SetFont(const Font& font);
863
864         /**
865          * Gets a font of the %Canvas control.
866          *
867          * @since               2.0
868          *
869          * @return              The font of the %Canvas control, @n
870          *                              else @c null if the method fails
871          * @exception           E_SUCCESS                       The method is successful.
872          * @exception           E_OUT_OF_MEMORY                 The memory is insufficient.
873          * @remarks
874          *                      - The specific error code can be accessed using the GetLastResult() method.
875          *                      - If a font is not set with the SetFont() method, this method returns the system default font.
876          */
877         Font* GetFontN(void) const;
878
879         /**
880          * Draws a text at the specified location.
881          *
882          * @since               2.0
883          *
884          * @return              An error code
885          * @param[in]   point                           The location to draw the text
886          * @param[in]   text                            The text to draw
887          * @exception   E_SUCCESS                       The method is successful.
888          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
889          * @exception   E_OPERATION_FAILED  The operation has failed.
890          * @remarks
891          *                      - The foreground color (RGB value only) of the %Canvas control is used as the text color.
892          *                      - The em square has a defined font size. As a result, if the font's glyph exceeds its em square, it will be scaled down when it is drawn.
893          */
894         result DrawText(const Point& point, const Tizen::Base::String& text);
895
896         /**
897          * Draws a text at a specified location.
898          *
899          * @since               2.1
900          *
901          * @return              An error code
902          * @param[in]   point                           The location to draw the text
903          * @param[in]   text                            The text to draw
904          * @exception   E_SUCCESS                       The method is successful.
905          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
906          * @exception   E_OPERATION_FAILED  The operation has failed.
907          * @remarks
908          *                      - The foreground color (RGB value only) of the %Canvas control is used as the text color.
909          *                      - The em square has a defined font size. As a result, if the font's glyph exceeds its em square, it will be scaled down when it is drawn.
910          */
911         result DrawText(const FloatPoint& point, const Tizen::Base::String& text);
912
913         /**
914          * Draws a text at the specified location and length.
915          *
916          * @since               2.0
917          *
918          * @return              An error code
919          * @param[in]   point                           The location to draw the text
920          * @param[in]   text                            The text to draw
921          * @param[in]   length                          The number of characters in the string @n
922          *                                                                      It must be greater than or equal to @c 0.
923          * @exception   E_SUCCESS                       The method is successful.
924          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
925          * @exception   E_OUT_OF_RANGE          The value of the argument is outside the valid range defined by the method.
926          * @exception   E_OPERATION_FAILED  The operation has failed.
927          * @remarks
928          *                      - The foreground color (RGB value only) of the %Canvas control is used as the text color.
929          *                      - The em square has a defined font size. As a result, if the font's glyph exceeds its em square, it will be scaled down when it is drawn.
930          */
931         result DrawText(const Point& point, const Tizen::Base::String& text, int length);
932
933         /**
934          * Draws a text at a specified location and length.
935          *
936          * @since               2.1
937          *
938          * @return              An error code
939          * @param[in]   point                           The location to draw the text
940          * @param[in]   text                            The text to draw
941          * @param[in]   length                          The number of characters in the string @n
942          *                                                                      It must be greater than or equal to @c 0.
943          * @exception   E_SUCCESS                       The method is successful.
944          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
945          * @exception   E_OUT_OF_RANGE          The value of the argument is outside the valid range defined by the method.
946          * @exception   E_OPERATION_FAILED  The operation has failed.
947          * @remarks
948          *                      - The foreground color (RGB value only) of the %Canvas control is used as the text color.
949          *                      - The em square has a defined font size. As a result, if the font's glyph exceeds its em square, it will be scaled down when it is drawn.
950          */
951         result DrawText(const FloatPoint& point, const Tizen::Base::String& text, int length);
952
953         /**
954          * Draws a text with an outline rendering at the specified location.
955          *
956          * @since        2.0
957          *
958          * @return       An error code
959          * @param[in]    point               The location to draw the text
960          * @param[in]    text                The text to draw @n
961          * @param[in]    outlineColor        The color that is set as outline color
962          * @exception    E_SUCCESS           The method is successful.
963          * @exception    E_INVALID_ARG       A specified input parameter is invalid.
964          * @exception    E_OUT_OF_RANGE      The value of the argument is outside the valid range defined by the method.
965          * @exception    E_OPERATION_FAILED  The operation has failed.
966          * @remarks
967          *                      - The foreground color (RGB value only) of the %Canvas control is used as the text color.
968          *                      - The em square has a defined font size. As a result, if the font's glyph exceeds its em square, it will be scaled down when it is drawn.
969          */
970         result DrawText(const Point& point, const Tizen::Base::String& text, const Color& outlineColor);
971
972         /**
973          * Draws a text with an outline rendering at a specified location.
974          *
975          * @since        2.1
976          *
977          * @return       An error code
978          * @param[in]    point               The location to draw the text
979          * @param[in]    text                The text to draw
980          * @param[in]    outlineColor        The color that is set as outline color
981          * @exception    E_SUCCESS           The method is successful.
982          * @exception    E_INVALID_ARG       A specified input parameter is invalid.
983          * @exception    E_OUT_OF_RANGE      The value of the argument is outside the valid range defined by the method.
984          * @exception    E_OPERATION_FAILED  The operation has failed.
985          * @remarks
986          *                      - The foreground color (RGB value only) of the %Canvas control is used as the text color.
987          *                      - The em square has a defined font size. As a result, if the font's glyph exceeds its em square, it will be scaled down when it is drawn.
988          */
989         result DrawText(const FloatPoint& point, const Tizen::Base::String& text, const Color& outlineColor);
990
991         /**
992          * Draws a text with an outline rendering at the specified location and length.
993          *
994          * @since        2.0
995          *
996          * @return       An error code
997          * @param[in]    point               The location to draw the text
998          * @param[in]    text                The text to draw
999          * @param[in]    length              The number of characters in the string @n
1000          *                                   It must be greater than or equal to @c 0.
1001          * @param[in]    outlineColor        The color that is set as outline color
1002          * @exception    E_SUCCESS           The method is successful.
1003          * @exception    E_INVALID_ARG       A specified input parameter is invalid.
1004          * @exception    E_OUT_OF_RANGE      The value of the argument is outside the valid range defined by the method.
1005          * @exception    E_OPERATION_FAILED  The operation has failed.
1006          * @remarks
1007          *                      - The foreground color (RGB value only) of the %Canvas control is used as the text color.
1008          *                      - The em square has a defined font size. As a result, if the font's glyph exceeds its em square, it will be scaled down when it is drawn.
1009          */
1010         result DrawText(const Point& point, const Tizen::Base::String& text, int length, const Color& outlineColor);
1011
1012         /**
1013          * Draws a text with an outline rendering at a specified location and length.
1014          *
1015          * @since        2.1
1016          *
1017          * @return       An error code
1018          * @param[in]    point               The location to draw the text
1019          * @param[in]    text                The text to draw
1020          * @param[in]    length              The number of characters in the string @n
1021          *                                   It must be greater than or equal to @c 0.
1022          * @param[in]    outlineColor        The color that is set as outline color
1023          * @exception    E_SUCCESS           The method is successful.
1024          * @exception    E_INVALID_ARG       A specified input parameter is invalid.
1025          * @exception    E_OUT_OF_RANGE      The value of the argument is outside the valid range defined by the method.
1026          * @exception    E_OPERATION_FAILED  The operation has failed.
1027          * @remarks
1028          *                      - The foreground color (RGB value only) of the %Canvas control is used as the text color.
1029          *                      - The em square has a defined font size. As a result, if the font's glyph exceeds its em square, it will be scaled down when it is drawn.
1030          */
1031         result DrawText(const FloatPoint& point, const Tizen::Base::String& text, int length, const Color& outlineColor);
1032
1033         /**
1034          * Draws an enriched text at the specified area.
1035          *
1036          * @since               2.0
1037          *
1038          * @return              An error code
1039          * @param[in]   point                                   The location to draw the text
1040          * @param[in]   enrichedText                    The TextElement to draw
1041          * @exception   E_SUCCESS                               The method is successful.
1042          * @exception   E_DEVICE_UNAVAILABLE    A specified device is invalid.
1043          * @remarks
1044          *                      - The foreground color (RGB value only) of the %Canvas control is used as the text color.
1045          *                      - The em square has a defined font size. As a result, if the font's glyph exceeds its em square, it will be scaled down when it is drawn.
1046          */
1047         result DrawText(const Point& point, const EnrichedText& enrichedText);
1048
1049         /**
1050          * Draws an enriched text at a specified area.
1051          *
1052          * @since               2.1
1053          *
1054          * @return              An error code
1055          * @param[in]   point                                   The location to draw the text
1056          * @param[in]   enrichedText                    The TextElement to draw
1057          * @exception   E_SUCCESS                               The method is successful.
1058          * @exception   E_DEVICE_UNAVAILABLE    A specified device is invalid.
1059          * @remarks
1060          *                      - The foreground color (RGB value only) of the %Canvas control is used as the text color.
1061          *                      - The em square has a defined font size. As a result, if the font's glyph exceeds its em square, it will be scaled down when it is drawn.
1062          */
1063         result DrawText(const FloatPoint& point, const EnrichedText& enrichedText);
1064
1065         /**
1066          * Draws a bitmap image at the specified location.
1067          *
1068          * @since               2.0
1069          *
1070          * @return              An error code
1071          * @param[in]   point                           The location of the upper-left corner of the bitmap
1072          * @param[in]   bitmap                          The bitmap to draw @n
1073          *                                                                      It must be constructed before being passed into this
1074          *                                                                      method. ::BITMAP_PIXEL_FORMAT_R8G8B8A8 is
1075          *                                                                      not applicable for this method. The bitmap must not
1076          *                                                                      entirely fall outside the edges of the %Canvas control. If
1077          *                                                                      this condition is not satisfied, the @c E_OUT_OF_RANGE exception
1078          *                                                                      is returned.
1079          * @exception   E_SUCCESS                       The method is successful.
1080          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
1081          */
1082         result DrawBitmap(const Point& point, const Bitmap& bitmap);
1083
1084         /**
1085          * Draws a bitmap image at a specified location.
1086          *
1087          * @since               2.1
1088          *
1089          * @return              An error code
1090          * @param[in]   point                           The location of the upper-left corner of the bitmap
1091          * @param[in]   bitmap                          The bitmap to draw @n
1092          *                                                                      It must be constructed before being passed into this
1093          *                                                                      method. ::BITMAP_PIXEL_FORMAT_R8G8B8A8 is
1094          *                                                                      not applicable for this method. The bitmap must not
1095          *                                                                      entirely fall outside the edges of the %Canvas control. If
1096          *                                                                      this condition is not satisfied, the @c E_OUT_OF_RANGE exception
1097          *                                                                      is returned.
1098          * @exception   E_SUCCESS                       The method is successful.
1099          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
1100          */
1101         result DrawBitmap(const FloatPoint& point, const Bitmap& bitmap);
1102
1103         /**
1104          * Draws a bitmap image at the specified location.
1105          *
1106          * @since               2.0
1107          *
1108          * @return              An error code
1109          * @param[in]   rect                    The location and size of the scaled bitmap @n
1110          *                                                              The rectangle must not entirely fall outside the edges of the
1111          *                                                              %Canvas control. If this condition is not satisfied, the
1112          *                                                              @c E_OUT_OF_RANGE exception is returned.
1113          * @param[in]   bitmap                  The bitmap to draw @n
1114          *                                                              It must be constructed well before being passed into this
1115          *                                                              method.
1116          * @exception   E_SUCCESS               The method is successful.
1117          * @exception   E_INVALID_ARG   A specified input parameter is invalid.
1118          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
1119          * @remarks BitmapPixelFormat::BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method.
1120          */
1121         result DrawBitmap(const Rectangle& rect, const Bitmap& bitmap);
1122
1123         /**
1124          * Draws a bitmap image at a specified location.
1125          *
1126          * @since               2.1
1127          *
1128          * @return              An error code
1129          * @param[in]   rect                    The location and size of the scaled bitmap @n
1130          *                                                              The rectangle must not entirely fall outside the edges of the
1131          *                                                              %Canvas control. If this condition is not satisfied, the
1132          *                                                              @c E_OUT_OF_RANGE exception is returned.
1133          * @param[in]   bitmap                  The bitmap to draw @n
1134          *                                                              It must be constructed well before being passed into this
1135          *                                                              method.
1136          * @exception   E_SUCCESS               The method is successful.
1137          * @exception   E_INVALID_ARG   A specified input parameter is invalid.
1138          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
1139          * @remarks ::BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method.
1140          */
1141         result DrawBitmap(const FloatRectangle& rect, const Bitmap& bitmap);
1142
1143         /**
1144          * Draws a color data corresponding to a rectangle of pixels from the specified bitmap onto %Canvas.
1145          *
1146          * @since               2.0
1147          *
1148          * @return              An error code
1149          * @param[in]   destRect                        The destination rectangle of %Canvas @n
1150          *                                                              The width and height of the rectangle must be greater than or equal to @c 0.
1151          *                                                              The rectangle defined by @c destRect will be clipped at the edges
1152          *                                                              of the %Canvas control to prevent the rectangle from falling
1153          *                                                              outside the edges of the %Canvas control. The destination
1154          *                                                              rectangle of a %Canvas control must not fall outside the edges
1155          *                                                              of the %Canvas control entirely. If these conditions are not
1156          *                                                              satisfied, the @c E_OUT_OF_RANGE exception is returned.
1157          * @param[in]   srcBitmap               The bitmap to draw
1158          * @param[in]   srcRect                 The source rectangle of a bitmap @n
1159          *                                                              The width and height of the rectangle must be greater than or equal to @c 0.
1160          *                                                              The rectangle defined by @c srcRect will be clipped at the edges
1161          *                                                              of the bitmap to prevent the rectangle from falling outside the
1162          *                                                              edges of the bitmap. The source rectangle of a bitmap must not
1163          *                                                              fall outside the edges of the bitmap entirely. If these
1164          *                                                              conditions are not satisfied, the @c E_OUT_OF_RANGE exception is
1165          *                                                              thrown.
1166          * @exception   E_SUCCESS               The method is successful.
1167          * @exception   E_INVALID_ARG   A specified input parameter is invalid.
1168          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
1169          * @remarks             If the source and destination rectangles are not of the same size,
1170          *                              the source bitmap is stretched to match the destination rectangle. @n
1171          *                              ::BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method.
1172          */
1173         result DrawBitmap(const Rectangle& destRect, const Bitmap& srcBitmap, const Rectangle& srcRect);
1174
1175         /**
1176          * Draws a color data corresponding to a rectangle of pixels from a specified bitmap onto %Canvas.
1177          *
1178          * @since               2.1
1179          *
1180          * @return              An error code
1181          * @param[in]   destRect                        The destination rectangle of %Canvas @n
1182          *                                                              The width and height of the rectangle must be greater than or equal to @c 0.0f.
1183          *                                                              The rectangle defined by @c destRect will be clipped at the edges
1184          *                                                              of the %Canvas control to prevent the rectangle from falling
1185          *                                                              outside the edges of the %Canvas control. The destination
1186          *                                                              rectangle of a %Canvas control must not fall outside the edges
1187          *                                                              of the %Canvas control entirely. If these conditions are not
1188          *                                                              satisfied, the @c E_OUT_OF_RANGE exception is returned.
1189          * @param[in]   srcBitmap               The bitmap to draw
1190          * @param[in]   srcRect                 The source rectangle of a bitmap @n
1191          *                                                              The width and height of the rectangle must be greater than or equal to @c 0.0f.
1192          *                                                              The rectangle defined by @c srcRect will be clipped at the edges
1193          *                                                              of the bitmap to prevent the rectangle from falling outside the
1194          *                                                              edges of the bitmap. The source rectangle of a bitmap must not
1195          *                                                              fall outside the edges of the bitmap entirely. If these
1196          *                                                              conditions are not satisfied, the @c E_OUT_OF_RANGE exception is
1197          *                                                              thrown.
1198          * @exception   E_SUCCESS               The method is successful.
1199          * @exception   E_INVALID_ARG   A specified input parameter is invalid.
1200          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
1201          * @remarks             If the source and destination rectangles are not of the same size,
1202          *                              the source bitmap is stretched to match the destination rectangle. @n
1203          *                              ::BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method.
1204          */
1205         result DrawBitmap(const FloatRectangle& destRect, const Bitmap& srcBitmap, const FloatRectangle& srcRect);
1206
1207         /**
1208          * Draws a flipped bitmap image at the specified location.
1209          *
1210          * @since               2.0
1211          *
1212          * @return      An error code
1213          * @param[in]   point                   The location to draw the bitmap
1214          * @param[in]   bitmap          The bitmap to draw @n
1215          *                              It must be constructed before being passed to this method.
1216          * @param[in]   dir             The flip direction
1217          * @exception   E_SUCCESS       The method is successful.
1218          * @exception   E_INVALID_ARG   A specified input parameter is invalid.
1219          * @remarks             ::BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method.
1220          */
1221         result DrawBitmap(const Point& point, const Bitmap& bitmap, FlipDirection dir);
1222
1223         /**
1224          * Draws a flipped bitmap image at a specified location.
1225          *
1226          * @since               2.1
1227          *
1228          * @return      An error code
1229          * @param[in]   point                   The location to draw the bitmap
1230          * @param[in]   bitmap          The bitmap to draw @n
1231          *                              It must be constructed before being passed to this method.
1232          * @param[in]   dir             The flip direction
1233          * @exception   E_SUCCESS       The method is successful.
1234          * @exception   E_INVALID_ARG   A specified input parameter is invalid.
1235          * @remarks             ::BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method.
1236          */
1237         result DrawBitmap(const FloatPoint& point, const Bitmap& bitmap, FlipDirection dir);
1238
1239         /**
1240          * Draws a rotated bitmap image at the specified location.
1241          *
1242          * @since               2.0
1243          *
1244          * @return              An error code
1245          * @param[in]   point                   A location to draw a bitmap image @n
1246          *                              This location is relatively defined from the origin (upper-left
1247          *                                                              corner) of the %Canvas control.
1248          * @param[in]   bitmap           The bitmap to draw @n
1249          *                               It must be constructed before being passed to this method.
1250          * @param[in]   pivot            The center of rotation of a bitmap image @n
1251          *                               This center is relatively defined from the origin (upper-left
1252          *                                                              corner) of the bitmap.
1253          * @param[in]   degree           The amount of rotation in degrees
1254          * @exception   E_SUCCESS        The method is successful.
1255          * @exception   E_INVALID_ARG    A specified input parameter is invalid.
1256          * @remarks     ::BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method.
1257          *                               This method faces a problem while working in an unbounded region and it affects the whole Canvas pixels in the case of ::COMPOSITE_MODE_SRC or ::COMPOSITE_MODE_CLEAR.
1258          * @image               html    graphics_rotatebitmap.PNG
1259          */
1260         result DrawBitmap(const Point& point, const Bitmap& bitmap, const Point& pivot, int degree);
1261
1262         /**
1263          * Draws a rotated bitmap image at a specified location.
1264          *
1265          * @since               2.1
1266          *
1267          * @return              An error code
1268          * @param[in]   point                   A location to draw a bitmap image @n
1269          *                              This location is relatively defined from the origin (upper-left
1270          *                                                              corner) of the %Canvas control.
1271          * @param[in]   bitmap           The bitmap to draw @n
1272          *                               It must be constructed before being passed to this method.
1273          * @param[in]   pivot            The center of rotation of a bitmap image @n
1274          *                               This center is relatively defined from the origin (upper-left
1275          *                                                              corner) of the bitmap.
1276          * @param[in]   degree           The amount of rotation in degrees
1277          * @exception   E_SUCCESS        The method is successful.
1278          * @exception   E_INVALID_ARG    A specified input parameter is invalid.
1279          * @remarks     ::BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method.
1280          *                               This method faces a problem while working in an unbounded region and it affects the whole %Canvas pixels in the case of ::COMPOSITE_MODE_SRC or ::COMPOSITE_MODE_CLEAR.
1281          * @image               html    graphics_rotatebitmap.PNG
1282          */
1283         result DrawBitmap(const FloatPoint& point, const Bitmap& bitmap, const FloatPoint& pivot, float degree);
1284
1285         /**
1286          * Draws a nine-patched bitmap at the specified location.
1287          *
1288          * @since               2.0
1289          *
1290          * @return              An error code
1291          * @param[in]   rect                    The location and size of the nine-patched bitmap @n
1292          *                                                              The rectangle must not entirely fall outside the edges of the
1293          *                                                              %Canvas control. If this condition is not satisfied, the
1294          *                                                              @c E_OUT_OF_RANGE exception is returned.
1295          * @param[in]   bitmap                  The bitmap to draw @n
1296          *                                                              It must be constructed before being passed to this method.
1297          * @exception   E_SUCCESS       The method is successful.
1298          * @exception   E_INVALID_ARG   A specified input parameter is invalid.
1299          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
1300          * @remarks    ::BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method. @n
1301          *             The nine-patched bitmap must have a stretchable section by drawing one (or more) 1-pixel-wide black line(s) in the
1302          *             left and top part of the border.
1303          * @image                       html    graphics_ninepatchedbitmap.PNG
1304          *
1305          */
1306         result DrawNinePatchedBitmap(const Rectangle& rect, const Bitmap& bitmap);
1307
1308         /**
1309          * Draws a nine-patched bitmap at a specified location.
1310          *
1311          * @since               2.1
1312          *
1313          * @return              An error code
1314          * @param[in]   rect                    The location and size of the nine-patched bitmap @n
1315          *                                                              The rectangle must not entirely fall outside the edges of the
1316          *                                                              %Canvas control. If this condition is not satisfied, the
1317          *                                                              @c E_OUT_OF_RANGE exception is returned.
1318          * @param[in]   bitmap                  The bitmap to draw @n
1319          *                                                              It must be constructed before being passed to this method.
1320          * @exception   E_SUCCESS       The method is successful.
1321          * @exception   E_INVALID_ARG   A specified input parameter is invalid.
1322          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
1323          * @remarks    ::BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method. @n
1324          *             The nine-patched bitmap must have a stretchable section by drawing one (or more) 1-pixel-wide black line(s) in the
1325          *             left and top part of the border.
1326          * @image                       html    graphics_ninepatchedbitmap.PNG
1327          *
1328          */
1329         result DrawNinePatchedBitmap(const FloatRectangle& rect, const Bitmap& bitmap);
1330
1331         /**
1332          * Shows the current instance of %Canvas on the device screen.
1333          *
1334          * @if OSPCOMPAT
1335          * @brief       <i> [Compatibility] </i>
1336          * @endif
1337          * @since                       2.0
1338          * @if OSPCOMPAT
1339          * @compatibility       This method has compatibility issues with OSP compatible applications @n
1340          *                                      For more information, see the issue description for @ref CompCanvasShowPage "here".
1341          * @endif
1342          *
1343          * @return              An error code
1344          * @exception   E_SUCCESS                                       The method is successful.
1345          * @exception   E_UNSUPPORTED_OPERATION         This operation is not supported.
1346          *
1347          */
1348         result Show(void);
1349
1350         /**
1351          * @if OSPCOMPAT
1352          * @page                        CompCanvasShowPage Compatibility for Show().
1353          * @section                     CompCanvasShowPageIssueSection Issues
1354          *                                      In Tizen, memory canvas is not fully supported, and we cannot guarantee that Show() for memory canvas of Tizen does the same operation with that of OSP.
1355          *
1356          * -# In OSP, when Show() is called for a Memory Canvas, the canvas was copied to the screen and E_SUCCESS was returned, but the canvas is not guaranteed to be displayed properly.
1357          * -# In Tizen, Show() does not function for a Memory Canvas, so E_UNSUPPORTED_OPERATION is returned. Memory Canvases cannot be used to directly show its content on screen.
1358          *
1359          * @endif
1360          */
1361
1362
1363         /**
1364          * @if OSPDEPREC
1365          * Shows the specified rectangle of the current instance of %Canvas on the device screen.
1366          *
1367          * @brief       <i> [Deprecated] </i>
1368          * @deprecated  This method is deprecated. Instead of this method, use the Show().
1369          * @since               2.0
1370          *
1371          * @return              An error code
1372          * @param[in]   rect                    The bounds of the %Canvas control to display @n
1373          *                                                              The width and height of the rectangle must be greater than or equal to @c 0.
1374          *                                                              The rectangle must not entirely fall outside the edges of the
1375          *                                                              %Canvas control. If these conditions are not satisfied, the
1376          *                                                              @c E_OUT_OF_RANGE exception is returned.
1377          * @exception   E_SUCCESS               The method is successful.
1378          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
1379          *
1380          * @remark      If you use Show(Rectangle&) in Tizen, this method works differently. @n
1381          *              This method shows the screen entirely not partially in Tizen.
1382          * @endif
1383          */
1384         result Show(const Rectangle& rect);
1385
1386         /**
1387          * Gets the location and size of the current %Canvas instance on the device screen.
1388          *
1389          * @since       2.0
1390          *
1391          * @return      The Rectangle instance containing the location and size of the current %Canvas instance
1392          * @remarks If this %Canvas instance is a Window %Canvas, it returns Rectangle(0, 0, w, h).
1393          */
1394         Rectangle GetBounds(void) const;
1395
1396         /**
1397          * Gets the location and size of the current %Canvas instance on the device screen.
1398          *
1399          * @since       2.1
1400          *
1401          * @return      The FloatRectangle instance containing the location and size of the current %Canvas instance
1402          * @remarks If this %Canvas instance is a Window %Canvas, it returns FloatRectangle(0.0f, 0.0f, w, h).
1403          */
1404         FloatRectangle GetBoundsF(void) const;
1405
1406         /**
1407          * Gets the actual location and size of the current %Canvas instance on the device screen.
1408          *
1409          * @since       2.1
1410          *
1411          * @return      The FloatRectangle instance containing the actual location and size of the current %Canvas instance
1412          * @remarks If this %Canvas instance is a Window %Canvas, it returns FloatRectangle(0.0f, 0.0f, w, h).
1413          */
1414         FloatRectangle GetActualBounds(void) const;
1415
1416         /**
1417          * Sets the clip rectangle for a %Canvas control. @n
1418          * When a clip rectangle is set, any drawing is restricted within the specified rectangular area. The
1419          * rectangular area defined is clipped at the edges of the %Canvas control so as to prevent the clipped rectangle
1420          * from falling outside the %Canvas control.
1421          *
1422          * @since               2.0
1423          *
1424          * @return              An error code
1425          * @param[in]   rect                    The bounds of the clip rectangle @n
1426          *                                                              The width and height of the rectangle must be greater than or equal to @c 0.
1427          *                                                              The clip rectangle for a %Canvas control must not entirely fall
1428          *                                                              outside the edges of the %Canvas control. If these conditions are
1429          *                                                              not satisfied, the @c E_OUT_OF_RANGE exception is returned.
1430          * @exception   E_SUCCESS               The method is successful.
1431          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
1432          */
1433         result SetClipBounds(const Rectangle& rect);
1434
1435         /**
1436          * Sets the clip rectangle for a %Canvas control. @n
1437          * When a clip rectangle is set, any drawing is restricted within a specified rectangular area. The
1438          * rectangular area defined is clipped at the edges of the %Canvas control so as to prevent the clipped rectangle
1439          * from falling outside the %Canvas control.
1440          *
1441          * @since               2.1
1442          *
1443          * @return              An error code
1444          * @param[in]   rect                    The bounds of the clip rectangle @n
1445          *                                                              The width and height of the rectangle must be greater than or equal to @c 0.0f.
1446          *                                                              The clip rectangle for a %Canvas control must not entirely fall
1447          *                                                              outside the edges of the %Canvas control. If these conditions are
1448          *                                                              not satisfied, the @c E_OUT_OF_RANGE exception is returned.
1449          * @exception   E_SUCCESS               The method is successful.
1450          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
1451          */
1452         result SetClipBounds(const FloatRectangle& rect);
1453
1454         /**
1455          * Gets the bounds of the clip rectangle of a %Canvas control.
1456          *
1457          * @since               2.0
1458          *
1459          * @return              An instance of Rectangle indicating the bounds of the clip rectangle
1460          */
1461         Rectangle GetClipBounds(void) const;
1462
1463         /**
1464          * Gets the bounds of the clip rectangle of a %Canvas control.
1465          *
1466          * @since               2.1
1467          *
1468          * @return              An instance of FloatRectangle indicating the bounds of the clip rectangle
1469          */
1470         FloatRectangle GetClipBoundsF(void) const;
1471
1472         /**
1473          * Locks the %Canvas control for direct pixel access. @n
1474          * This sets up a %Canvas control for accessing the pixels directly. Between the calls to the
1475          * %Canvas::Lock() and Canvas::Unlock() methods, the data can be written to and read from the
1476          * %Canvas control's pixels. Once the operations on the %Canvas control's pixels are finished, the
1477          * %Canvas::Unlock() method must be called to release the lock.
1478          *
1479          * @since               2.0
1480          *
1481          * @return              An error code
1482          * @param[out]  info                    The information of the %Canvas control
1483          * @param[in]   timeout                 The time, in milliseconds, that the caller waits to obtain the lock @n
1484          *                                                              If the lock attempt fails, @c E_TIMEOUT is returned. The default value
1485          *                                                              is @c INFINITE, which means that the method does not return until the lock
1486          *                                                              is acquired.
1487          * @exception   E_SUCCESS               The method is successful.
1488          * @exception   E_TIMEOUT               The operation cannot be completed within the specified time period.
1489          * @exception   E_SYSTEM                An unknown operating system error has occurred.
1490          * @remarks     BufferInfo contains a valid physical memory information, regardless of the
1491          *                              logical position and size of the %Canvas control.
1492          */
1493         result Lock(BufferInfo& info, long timeout = INFINITE);
1494
1495         /**
1496          * Unlocks the %Canvas control.
1497          *
1498          * @since               2.0
1499          *
1500          * @return              An error code
1501          * @exception   E_SUCCESS                       The method is successful.
1502          * @exception   E_SYSTEM                        An unknown operating system error has occurred.
1503          * @remarks             The %Canvas control must be unlocked as soon as possible.
1504          */
1505         result Unlock(void);
1506
1507         /**
1508          * Sets the foreground color.
1509          *
1510          * @since               2.0
1511          *
1512          * @param[in]   color   The color that is set as foreground color
1513          */
1514         void SetForegroundColor(const Color& color);
1515
1516         /**
1517          * Gets the foreground color.
1518          *
1519          * @since               2.0
1520          *
1521          * @return              The foreground color
1522          */
1523         Color GetForegroundColor(void) const;
1524
1525         /**
1526          * Sets the background color.
1527          *
1528          * @since               2.0
1529          *
1530          * @param[in]   color   The color that is set as background color
1531          */
1532         void SetBackgroundColor(const Color& color);
1533
1534         /**
1535          * Gets the background color.
1536          *
1537          * @since               2.0
1538          *
1539          * @return              The background color
1540          */
1541         Color GetBackgroundColor(void) const;
1542
1543         /**
1544          * Sets the current instance of %Canvas to the specified point.
1545          *
1546          * @brief <i> [Deprecated] </i>
1547          * @deprecated   This method is deprecated.
1548          * @since               2.0
1549          *
1550          * @return              An error code
1551          * @param[in]   point                                   The new position
1552          * @exception   E_SUCCESS                               The method is successful.
1553          * @exception   E_UNSUPPORTED_OPERATION Window %Canvas does not support moving the position.
1554          * @remarks             This method has been influenced on only Memory canvas. However, Show() for Memory canvas is not supported anymore.
1555          */
1556         result SetPosition(const Point& point);
1557
1558         /**
1559          * Sets the current instance of %Canvas to the specified point.
1560          *
1561          * @brief <i> [Deprecated] </i>
1562          * @deprecated   This method is deprecated.
1563          * @since               2.0
1564          *
1565          * @return              An error code
1566          * @param[in]   x                                               The new x-coordinate
1567          * @param[in]   y                                               The new y-coordinate
1568          * @exception   E_SUCCESS                               The method is successful.
1569          * @exception   E_UNSUPPORTED_OPERATION Window %Canvas does not support moving the position.
1570          * @remarks             This method has been influenced on only Memory canvas. However, Show() for Memory canvas is not supported anymore.
1571          */
1572         result SetPosition(int x, int y);
1573
1574         /**
1575          * Sets the composite mode.
1576          *
1577          * @since       2.1
1578          *
1579          * @return              An error code
1580          * @param[in]   compositeMode                   The new composite mode
1581          * @exception   E_SUCCESS                               The method is successful.
1582          * @exception   E_INVALID_ARG                   The specified input parameter is invalid.
1583          */
1584         result SetCompositeMode(CompositeMode compositeMode);
1585
1586         /**
1587          * Gets the composite mode for the current instance.
1588          *
1589          * @since       2.1
1590          *
1591          * @return      The current composite mode
1592          * @remarks     The default value is @c COMPOSITE_MODE_SRC_OVER.
1593          */
1594          CompositeMode GetCompositeMode(void) const;
1595
1596         /**
1597         * Enables or disables anti-aliasing to the current instance of %Canvas.
1598         *
1599         * @since                2.1
1600         *
1601         * @param[in]    enable          Set to @c true to enable anti-aliasing for the current instance of %Canvas, @n
1602         *                                                       else @c false
1603         * @remarks              By default, the anti-aliasing is enabled.
1604         */
1605         void SetAntiAliasingEnabled(bool enable);
1606
1607         /**
1608         * Checks whether anti-aliasing is enabled to the current instance.
1609         *
1610         * @since        2.1
1611         *
1612         * @return       @c true if the anti-aliasing is enabled to the current instance.
1613         *                       else @c false
1614         */
1615         bool IsAntiAliasingEnabled(void) const;
1616
1617 private:
1618         //
1619         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
1620         //
1621         Canvas(const Canvas& rhs);
1622
1623         //
1624         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
1625         //
1626         Canvas& operator =(const Canvas& rhs);
1627
1628         friend class Bitmap;
1629         friend class TextElement;
1630
1631 private:
1632         friend class _CanvasImpl;
1633
1634         //
1635         // This variable is for internal use only.
1636         // Using this variable can cause behavioral, security-related, and consistency-related issues in the application.
1637         //
1638         // @since 2.0
1639         //
1640         class _CanvasImpl* __pImpl;
1641
1642 }; // Canvas
1643
1644 }} // Tizen::Graphics
1645
1646 #endif //_FGRP_CANVAS_H_