Merge "Fix Ime Rotation" into tizen_2.1
[platform/framework/native/uifw.git] / inc / FGrpCanvas.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file        FGrpCanvas.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 the 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 the specified rectangular region from the specified instance of %Canvas to the current instance of
198          * %Canvas at the 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 the specified rectangular region from the 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 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 the 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 the 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 the 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 the 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 the 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             The specific error code can be accessed using the GetLastResult() method.
874          * @remarks             If a font is not set with the SetFont() method, this method returns the system default font.
875          */
876         Font* GetFontN(void) const;
877
878         /**
879          * Draws a text at the specified location.
880          *
881          * @since               2.0
882          *
883          * @return              An error code
884          * @param[in]   point                           The location to draw the text
885          * @param[in]   text                            The text to draw
886          * @exception   E_SUCCESS                       The method is successful.
887          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
888          * @exception   E_OPERATION_FAILED  The operation has failed.
889          * @remarks     The foreground color (RGB value only) of the %Canvas control is used as the text color.
890          * @remarks     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.
891          */
892         result DrawText(const Point& point, const Tizen::Base::String& text);
893
894         /**
895          * Draws a text at the specified location.
896          *
897          * @since               2.1
898          *
899          * @return              An error code
900          * @param[in]   point                           The location to draw the text
901          * @param[in]   text                            The text to draw
902          * @exception   E_SUCCESS                       The method is successful.
903          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
904          * @exception   E_OPERATION_FAILED  The operation has failed.
905          * @remarks     The foreground color (RGB value only) of the %Canvas control is used as the text color.
906          * @remarks     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.
907          */
908         result DrawText(const FloatPoint& point, const Tizen::Base::String& text);
909
910         /**
911          * Draws a text at the specified location and length.
912          *
913          * @since               2.0
914          *
915          * @return              An error code
916          * @param[in]   point                           The location to draw the text
917          * @param[in]   text                            The text to draw
918          * @param[in]   length                          The number of characters in the string @n
919          *                                                                      It must be greater than or equal to @c 0.
920          * @exception   E_SUCCESS                       The method is successful.
921          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
922          * @exception   E_OUT_OF_RANGE          The value of the argument is outside the valid range defined by the method.
923          * @exception   E_OPERATION_FAILED  The operation has failed.
924          * @remarks     The foreground color (RGB value only) of the %Canvas control is used as the text color.
925          * @remarks     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.
926          */
927         result DrawText(const Point& point, const Tizen::Base::String& text, int length);
928
929         /**
930          * Draws a text at the specified location and length.
931          *
932          * @since               2.1
933          *
934          * @return              An error code
935          * @param[in]   point                           The location to draw the text
936          * @param[in]   text                            The text to draw
937          * @param[in]   length                          The number of characters in the string @n
938          *                                                                      It must be greater than or equal to @c 0.
939          * @exception   E_SUCCESS                       The method is successful.
940          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
941          * @exception   E_OUT_OF_RANGE          The value of the argument is outside the valid range defined by the method.
942          * @exception   E_OPERATION_FAILED  The operation has failed.
943          * @remarks     The foreground color (RGB value only) of the %Canvas control is used as the text color.
944          * @remarks     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.
945          */
946         result DrawText(const FloatPoint& point, const Tizen::Base::String& text, int length);
947
948         /**
949          * Draws a text with an outline rendering at the specified location.
950          *
951          * @since        2.0
952          *
953          * @return       An error code
954          * @param[in]    point               The location to draw the text
955          * @param[in]    text                The text to draw @n
956          * @param[in]    outlineColor        The color that is set as outline color
957          * @exception    E_SUCCESS           The method is successful.
958          * @exception    E_INVALID_ARG       A specified input parameter is invalid.
959          * @exception    E_OUT_OF_RANGE      The value of the argument is outside the valid range defined by the method.
960          * @exception    E_OPERATION_FAILED  The operation has failed.
961          * @remarks     The foreground color (RGB value only) of the %Canvas control is used as the text color.
962          * @remarks     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.
963          */
964         result DrawText(const Point& point, const Tizen::Base::String& text, const Color& outlineColor);
965
966         /**
967          * Draws a text with an outline rendering at the specified location.
968          *
969          * @since        2.1
970          *
971          * @return       An error code
972          * @param[in]    point               The location to draw the text
973          * @param[in]    text                The text to draw @n
974          * @param[in]    outlineColor        The color that is set as outline color
975          * @exception    E_SUCCESS           The method is successful.
976          * @exception    E_INVALID_ARG       A specified input parameter is invalid.
977          * @exception    E_OUT_OF_RANGE      The value of the argument is outside the valid range defined by the method.
978          * @exception    E_OPERATION_FAILED  The operation has failed.
979          * @remarks     The foreground color (RGB value only) of the %Canvas control is used as the text color.
980          * @remarks     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.
981          */
982         result DrawText(const FloatPoint& point, const Tizen::Base::String& text, const Color& outlineColor);
983
984         /**
985          * Draws a text with an outline rendering at the specified location and length.
986          *
987          * @since        2.0
988          *
989          * @return       An error code
990          * @param[in]    point               The location to draw the text
991          * @param[in]    text                The text to draw
992          * @param[in]    length              The number of characters in the string @n
993          *                                   It must be greater than or equal to @c 0.
994          * @param[in]    outlineColor        The color that is set as outline color
995          * @exception    E_SUCCESS           The method is successful.
996          * @exception    E_INVALID_ARG       A specified input parameter is invalid.
997          * @exception    E_OUT_OF_RANGE      The value of the argument is outside the valid range defined by the method.
998          * @exception    E_OPERATION_FAILED  The operation has failed.
999          *
1000          * @remarks     The foreground color (RGB value only) of the %Canvas control is used as the text color.
1001          * @remarks     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.
1002          */
1003         result DrawText(const Point& point, const Tizen::Base::String& text, int length, const Color& outlineColor);
1004
1005         /**
1006          * Draws a text with an outline rendering at the specified location and length.
1007          *
1008          * @since        2.1
1009          *
1010          * @return       An error code
1011          * @param[in]    point               The location to draw the text
1012          * @param[in]    text                The text to draw
1013          * @param[in]    length              The number of characters in the string @n
1014          *                                   It must be greater than or equal to @c 0.
1015          * @param[in]    outlineColor        The color that is set as outline color
1016          * @exception    E_SUCCESS           The method is successful.
1017          * @exception    E_INVALID_ARG       A specified input parameter is invalid.
1018          * @exception    E_OUT_OF_RANGE      The value of the argument is outside the valid range defined by the method.
1019          * @exception    E_OPERATION_FAILED  The operation has failed.
1020          *
1021          * @remarks     The foreground color (RGB value only) of the %Canvas control is used as the text color.
1022          * @remarks     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.
1023          */
1024         result DrawText(const FloatPoint& point, const Tizen::Base::String& text, int length, const Color& outlineColor);
1025
1026         /**
1027          * Draws an enriched text at the specified area.
1028          *
1029          * @since               2.0
1030          *
1031          * @return              An error code
1032          * @param[in]   point                                   The location to draw the text
1033          * @param[in]   enrichedText                    The TextElement to draw
1034          * @exception   E_SUCCESS                               The method is successful.
1035          * @exception   E_DEVICE_UNAVAILABLE    A specified device is invalid.
1036          *
1037          * @remarks  The foreground color (RGB value only) of the %Canvas control is used as the text color.
1038          * @remarks  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.
1039          */
1040         result DrawText(const Point& point, const EnrichedText& enrichedText);
1041
1042         /**
1043          * Draws an enriched text at the specified area.
1044          *
1045          * @since               2.1
1046          *
1047          * @return              An error code
1048          * @param[in]   point                                   The location to draw the text
1049          * @param[in]   enrichedText                    The TextElement to draw
1050          * @exception   E_SUCCESS                               The method is successful.
1051          * @exception   E_DEVICE_UNAVAILABLE    A specified device is invalid.
1052          *
1053          * @remarks  The foreground color (RGB value only) of the %Canvas control is used as the text color.
1054          * @remarks  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.
1055          */
1056         result DrawText(const FloatPoint& point, const EnrichedText& enrichedText);
1057
1058         /**
1059          * Draws a bitmap image at the specified location.
1060          *
1061          * @since               2.0
1062          *
1063          * @return              An error code
1064          * @param[in]   point                           The location of the upper-left corner of the bitmap
1065          * @param[in]   bitmap                          The bitmap to draw @n
1066          *                                                                      It must be constructed before being passed into this
1067          *                                                                      method. BitmapPixelFormat::BITMAP_PIXEL_FORMAT_R8G8B8A8 is
1068          *                                                                      not applicable for this method. The bitmap must not
1069          *                                                                      entirely fall outside the edges of the %Canvas control. If
1070          *                                                                      this condition is not satisfied, the @c E_OUT_OF_RANGE exception
1071          *                                                                      is returned.
1072          * @exception   E_SUCCESS                       The method is successful.
1073          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
1074          */
1075         result DrawBitmap(const Point& point, const Bitmap& bitmap);
1076
1077         /**
1078          * Draws a bitmap image at the specified location.
1079          *
1080          * @since               2.1
1081          *
1082          * @return              An error code
1083          * @param[in]   point                           The location of the upper-left corner of the bitmap
1084          * @param[in]   bitmap                          The bitmap to draw @n
1085          *                                                                      It must be constructed before being passed into this
1086          *                                                                      method. BitmapPixelFormat::BITMAP_PIXEL_FORMAT_R8G8B8A8 is
1087          *                                                                      not applicable for this method. The bitmap must not
1088          *                                                                      entirely fall outside the edges of the %Canvas control. If
1089          *                                                                      this condition is not satisfied, the @c E_OUT_OF_RANGE exception
1090          *                                                                      is returned.
1091          * @exception   E_SUCCESS                       The method is successful.
1092          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
1093          */
1094         result DrawBitmap(const FloatPoint& point, const Bitmap& bitmap);
1095
1096         /**
1097          * Draws a bitmap image at the specified location.
1098          *
1099          * @since               2.0
1100          *
1101          * @return              An error code
1102          * @param[in]   rect                    The location and size of the scaled bitmap @n
1103          *                                                              The rectangle must not entirely fall outside the edges of the
1104          *                                                              %Canvas control. If this condition is not satisfied, the
1105          *                                                              @c E_OUT_OF_RANGE exception is returned.
1106          * @param[in]   bitmap                  The bitmap to draw @n
1107          *                                                              It must be constructed well before being passed into this
1108          *                                                              method.
1109          * @exception   E_SUCCESS               The method is successful.
1110          * @exception   E_INVALID_ARG   A specified input parameter is invalid.
1111          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
1112          * @remarks BitmapPixelFormat::BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method.
1113          */
1114         result DrawBitmap(const Rectangle& rect, const Bitmap& bitmap);
1115
1116         /**
1117          * Draws a bitmap image at the specified location.
1118          *
1119          * @since               2.1
1120          *
1121          * @return              An error code
1122          * @param[in]   rect                    The location and size of the scaled bitmap @n
1123          *                                                              The rectangle must not entirely fall outside the edges of the
1124          *                                                              %Canvas control. If this condition is not satisfied, the
1125          *                                                              @c E_OUT_OF_RANGE exception is returned.
1126          * @param[in]   bitmap                  The bitmap to draw @n
1127          *                                                              It must be constructed well before being passed into this
1128          *                                                              method.
1129          * @exception   E_SUCCESS               The method is successful.
1130          * @exception   E_INVALID_ARG   A specified input parameter is invalid.
1131          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
1132          * @remarks BitmapPixelFormat::BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method.
1133          */
1134         result DrawBitmap(const FloatRectangle& rect, const Bitmap& bitmap);
1135
1136         /**
1137          * Draws a color data corresponding to a rectangle of pixels from the specified bitmap onto %Canvas.
1138          *
1139          * @since               2.0
1140          *
1141          * @return              An error code
1142          * @param[in]   destRect                        The destination rectangle of %Canvas @n
1143          *                                                              The width and height of the rectangle must be greater than or equal to @c 0.
1144          *                                                              The rectangle defined by @c destRect will be clipped at the edges
1145          *                                                              of the %Canvas control to prevent the rectangle from falling
1146          *                                                              outside the edges of the %Canvas control. The destination
1147          *                                                              rectangle of a %Canvas control must not fall outside the edges
1148          *                                                              of the %Canvas control entirely. If these conditions are not
1149          *                                                              satisfied, the @c E_OUT_OF_RANGE exception is returned.
1150          * @param[in]   srcBitmap               The bitmap to draw
1151          * @param[in]   srcRect                 The source rectangle of a bitmap @n
1152          *                                                              The width and height of the rectangle must be greater than or equal to @c 0.
1153          *                                                              The rectangle defined by @c srcRect will be clipped at the edges
1154          *                                                              of the bitmap to prevent the rectangle from falling outside the
1155          *                                                              edges of the bitmap. The source rectangle of a bitmap must not
1156          *                                                              fall outside the edges of the bitmap entirely. If these
1157          *                                                              conditions are not satisfied, the @c E_OUT_OF_RANGE exception is
1158          *                                                              thrown.
1159          * @exception   E_SUCCESS               The method is successful.
1160          * @exception   E_INVALID_ARG   A specified input parameter is invalid.
1161          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
1162          * @remarks             If the source and destination rectangles are not of the same size,
1163          *                              the source bitmap is stretched to match the destination rectangle. @n
1164          *                              BitmapPixelFormat::BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method.
1165          */
1166         result DrawBitmap(const Rectangle& destRect, const Bitmap& srcBitmap, const Rectangle& srcRect);
1167
1168         /**
1169          * Draws a color data corresponding to a rectangle of pixels from the specified bitmap onto %Canvas.
1170          *
1171          * @since               2.1
1172          *
1173          * @return              An error code
1174          * @param[in]   destRect                        The destination rectangle of %Canvas @n
1175          *                                                              The width and height of the rectangle must be greater than or equal to @c 0.0f.
1176          *                                                              The rectangle defined by @c destRect will be clipped at the edges
1177          *                                                              of the %Canvas control to prevent the rectangle from falling
1178          *                                                              outside the edges of the %Canvas control. The destination
1179          *                                                              rectangle of a %Canvas control must not fall outside the edges
1180          *                                                              of the %Canvas control entirely. If these conditions are not
1181          *                                                              satisfied, the @c E_OUT_OF_RANGE exception is returned.
1182          * @param[in]   srcBitmap               The bitmap to draw
1183          * @param[in]   srcRect                 The source rectangle of a bitmap @n
1184          *                                                              The width and height of the rectangle must be greater than or equal to @c 0.0f.
1185          *                                                              The rectangle defined by @c srcRect will be clipped at the edges
1186          *                                                              of the bitmap to prevent the rectangle from falling outside the
1187          *                                                              edges of the bitmap. The source rectangle of a bitmap must not
1188          *                                                              fall outside the edges of the bitmap entirely. If these
1189          *                                                              conditions are not satisfied, the @c E_OUT_OF_RANGE exception is
1190          *                                                              thrown.
1191          * @exception   E_SUCCESS               The method is successful.
1192          * @exception   E_INVALID_ARG   A specified input parameter is invalid.
1193          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
1194          * @remarks             If the source and destination rectangles are not of the same size,
1195          *                              the source bitmap is stretched to match the destination rectangle. @n
1196          *                              BitmapPixelFormat::BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method.
1197          */
1198         result DrawBitmap(const FloatRectangle& destRect, const Bitmap& srcBitmap, const FloatRectangle& srcRect);
1199
1200         /**
1201          * Draws a flipped bitmap image at the specified location.
1202          *
1203          * @since               2.0
1204          *
1205          * @return      An error code
1206          * @param[in]   point                   The location to draw the bitmap
1207          * @param[in]   bitmap          The bitmap to draw @n
1208          *                              It must be constructed before being passed to this method.
1209          * @param[in]   dir             The flip direction
1210          * @exception   E_SUCCESS       The method is successful.
1211          * @exception   E_INVALID_ARG   A specified input parameter is invalid.
1212          * @remarks             BitmapPixelFormat::BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method.
1213          */
1214         result DrawBitmap(const Point& point, const Bitmap& bitmap, FlipDirection dir);
1215
1216         /**
1217          * Draws a flipped bitmap image at the specified location.
1218          *
1219          * @since               2.1
1220          *
1221          * @return      An error code
1222          * @param[in]   point                   The location to draw the bitmap
1223          * @param[in]   bitmap          The bitmap to draw @n
1224          *                              It must be constructed before being passed to this method.
1225          * @param[in]   dir             The flip direction
1226          * @exception   E_SUCCESS       The method is successful.
1227          * @exception   E_INVALID_ARG   A specified input parameter is invalid.
1228          * @remarks             BitmapPixelFormat::BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method.
1229          */
1230         result DrawBitmap(const FloatPoint& point, const Bitmap& bitmap, FlipDirection dir);
1231
1232         /**
1233          * Draws a rotated bitmap image at the specified location.
1234          *
1235          * @since               2.0
1236          *
1237          * @return              An error code
1238          * @param[in]   point                   A location to draw a bitmap image @n
1239          *                              This location is relatively defined from the origin (upper-left
1240          *                                                              corner) of the %Canvas control.
1241          * @param[in]   bitmap           The bitmap to draw @n
1242          *                               It must be constructed before being passed to this method.
1243          * @param[in]   pivot            The center of rotation of a bitmap image @n
1244          *                               This center is relatively defined from the origin (upper-left
1245          *                                                              corner) of the bitmap.
1246          * @param[in]   degree           The amount of rotation in degrees
1247          * @exception   E_SUCCESS        The method is successful.
1248          * @exception   E_INVALID_ARG    A specified input parameter is invalid.
1249          * @remarks     BitmapPixelFormat::BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method.
1250          * @image               html    graphics_rotatebitmap.PNG
1251          */
1252         result DrawBitmap(const Point& point, const Bitmap& bitmap, const Point& pivot, int degree);
1253
1254         /**
1255          * Draws a rotated bitmap image at the specified location.
1256          *
1257          * @since               2.1
1258          *
1259          * @return              An error code
1260          * @param[in]   point                   A location to draw a bitmap image @n
1261          *                              This location is relatively defined from the origin (upper-left
1262          *                                                              corner) of the %Canvas control.
1263          * @param[in]   bitmap           The bitmap to draw @n
1264          *                               It must be constructed before being passed to this method.
1265          * @param[in]   pivot            The center of rotation of a bitmap image @n
1266          *                               This center is relatively defined from the origin (upper-left
1267          *                                                              corner) of the bitmap.
1268          * @param[in]   degree           The amount of rotation in degrees
1269          * @exception   E_SUCCESS        The method is successful.
1270          * @exception   E_INVALID_ARG    A specified input parameter is invalid.
1271          * @remarks     BitmapPixelFormat::BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method.
1272          * @image               html    graphics_rotatebitmap.PNG
1273          */
1274         result DrawBitmap(const FloatPoint& point, const Bitmap& bitmap, const FloatPoint& pivot, float degree);
1275
1276         /**
1277          * Draws a nine-patched bitmap at the specified location.
1278          *
1279          * @since               2.0
1280          *
1281          * @return              An error code
1282          * @param[in]   rect                    The location and size of the nine-patched bitmap @n
1283          *                                                              The rectangle must not entirely fall outside the edges of the
1284          *                                                              %Canvas control. If this condition is not satisfied, the
1285          *                                                              @c E_OUT_OF_RANGE exception is returned.
1286          * @param[in]   bitmap                  The bitmap to draw @n
1287          *                                                              It must be constructed before being passed to this method.
1288          * @exception   E_SUCCESS       The method is successful.
1289          * @exception   E_INVALID_ARG   A specified input parameter is invalid.
1290          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
1291          *
1292          * @remarks    BitmapPixelFormat::BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method. @n
1293          *             The nine-patched bitmap must have a stretchable section by drawing one (or more) 1-pixel-wide black line(s) in the
1294          *             left and top part of the border.
1295          * @image                       html    graphics_ninepatchedbitmap.PNG
1296          *
1297          */
1298         result DrawNinePatchedBitmap(const Rectangle& rect, const Bitmap& bitmap);
1299
1300         /**
1301          * Draws a nine-patched bitmap at the specified location.
1302          *
1303          * @since               2.1
1304          *
1305          * @return              An error code
1306          * @param[in]   rect                    The location and size of the nine-patched bitmap @n
1307          *                                                              The rectangle must not entirely fall outside the edges of the
1308          *                                                              %Canvas control. If this condition is not satisfied, the
1309          *                                                              @c E_OUT_OF_RANGE exception is returned.
1310          * @param[in]   bitmap                  The bitmap to draw @n
1311          *                                                              It must be constructed before being passed to this method.
1312          * @exception   E_SUCCESS       The method is successful.
1313          * @exception   E_INVALID_ARG   A specified input parameter is invalid.
1314          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
1315          *
1316          * @remarks    BitmapPixelFormat::BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method. @n
1317          *             The nine-patched bitmap must have a stretchable section by drawing one (or more) 1-pixel-wide black line(s) in the
1318          *             left and top part of the border.
1319          * @image                       html    graphics_ninepatchedbitmap.PNG
1320          *
1321          */
1322         result DrawNinePatchedBitmap(const FloatRectangle& rect, const Bitmap& bitmap);
1323
1324         /**
1325          * Shows the current instance of %Canvas on the device screen.
1326          *
1327          * @if OSPCOMPAT
1328          * @brief       <i> [Compatibility] </i>
1329          * @endif
1330          * @since                       2.0
1331          * @if OSPCOMPAT
1332          * @compatibility       This method has compatibility issues with OSP compatible applications @n
1333          *                                      For more information, see the issue description for @ref CompCanvasShowPage "here".
1334          * @endif
1335          *
1336          * @return              An error code
1337          * @exception   E_SUCCESS                                       The method is successful.
1338          * @exception   E_UNSUPPORTED_OPERATION         This operation is not supported.
1339          *
1340          */
1341         result Show(void);
1342
1343         /**
1344          * @if OSPCOMPAT
1345          * @page                        CompCanvasShowPage Compatibility for Show().
1346          * @section                     CompCanvasShowPageIssueSection Issues
1347          *                                      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.
1348          *
1349          * -# 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.
1350          * -# 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.
1351          *
1352          * @endif
1353          */
1354
1355
1356         /**
1357          * @if OSPDEPREC
1358          * Shows the specified rectangle of the current instance of %Canvas on the device screen.
1359          *
1360          * @brief       <i> [Deprecated] </i>
1361          * @deprecated  This method is deprecated. Instead of this method, use the Show().
1362          * @since               2.0
1363          *
1364          * @return              An error code
1365          * @param[in]   rect                    The bounds of the %Canvas control to display @n
1366          *                                                              The width and height of the rectangle must be greater than or equal to @c 0.
1367          *                                                              The rectangle must not entirely fall outside the edges of the
1368          *                                                              %Canvas control. If these conditions are not satisfied, the
1369          *                                                              @c E_OUT_OF_RANGE exception is returned.
1370          * @exception   E_SUCCESS               The method is successful.
1371          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
1372          *
1373          * @remark      If you use Show(Rectangle&) in Tizen, this method works differently. @n
1374          *              This method shows the screen entirely not partially in Tizen.
1375          * @endif
1376          */
1377         result Show(const Rectangle& rect);
1378
1379         /**
1380          * Gets the location and size of the current %Canvas instance on the device screen.
1381          *
1382          * @since       2.0
1383          *
1384          * @return      The Rectangle instance containing the location and size of the current %Canvas instance
1385          * @remarks If this %Canvas instance is a Window %Canvas, it returns Rectangle(0, 0, w, h).
1386          */
1387         Rectangle GetBounds(void) const;
1388
1389         /**
1390          * Gets the location and size of the current %Canvas instance on the device screen.
1391          *
1392          * @since       2.1
1393          *
1394          * @return      The Rectangle instance containing the location and size of the current %Canvas instance
1395          * @remarks If this %Canvas instance is a Window %Canvas, it returns FloatRectangle(0.0f, 0.0f, w, h).
1396          */
1397         FloatRectangle GetBoundsF(void) const;
1398
1399         /**
1400          * Gets the actual location and size of the current %Canvas instance on the device screen.
1401          *
1402          * @since       2.1
1403          *
1404          * @return      The Rectangle instance containing the actual location and size of the current %Canvas instance
1405          * @remarks If this %Canvas instance is a Window %Canvas, it returns FloatRectangle(0.0f, 0.0f, w, h).
1406          */
1407         FloatRectangle GetActualBounds(void) const;
1408
1409         /**
1410          * Sets the clip rectangle for a %Canvas control. @n
1411          * When a clip rectangle is set, any drawing is restricted within the specified rectangular area. The
1412          * rectangular area defined is clipped at the edges of the %Canvas control so as to prevent the clipped rectangle
1413          * from falling outside the %Canvas control.
1414          *
1415          * @since               2.0
1416          *
1417          * @return              An error code
1418          * @param[in]   rect                    The bounds of the clip rectangle @n
1419          *                                                              The width and height of the rectangle must be greater than or equal to @c 0.
1420          *                                                              The clip rectangle for a %Canvas control must not entirely fall
1421          *                                                              outside the edges of the %Canvas control. If these conditions are
1422          *                                                              not satisfied, the @c E_OUT_OF_RANGE exception is returned.
1423          * @exception   E_SUCCESS               The method is successful.
1424          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
1425          */
1426         result SetClipBounds(const Rectangle& rect);
1427
1428         /**
1429          * Sets the clip rectangle for a %Canvas control. @n
1430          * When a clip rectangle is set, any drawing is restricted within the specified rectangular area. The
1431          * rectangular area defined is clipped at the edges of the %Canvas control so as to prevent the clipped rectangle
1432          * from falling outside the %Canvas control.
1433          *
1434          * @since               2.1
1435          *
1436          * @return              An error code
1437          * @param[in]   rect                    The bounds of the clip rectangle @n
1438          *                                                              The width and height of the rectangle must be greater than or equal to @c 0.0f.
1439          *                                                              The clip rectangle for a %Canvas control must not entirely fall
1440          *                                                              outside the edges of the %Canvas control. If these conditions are
1441          *                                                              not satisfied, the @c E_OUT_OF_RANGE exception is returned.
1442          * @exception   E_SUCCESS               The method is successful.
1443          * @exception   E_OUT_OF_RANGE  The value of the argument is outside the valid range defined by the method.
1444          */
1445         result SetClipBounds(const FloatRectangle& rect);
1446
1447         /**
1448          * Gets the bounds of the clip rectangle of a %Canvas control.
1449          *
1450          * @since               2.0
1451          *
1452          * @return              An instance of Rectangle indicating the bounds of the clip rectangle
1453          */
1454         Rectangle GetClipBounds(void) const;
1455
1456         /**
1457          * Gets the bounds of the clip rectangle of a %Canvas control.
1458          *
1459          * @since               2.1
1460          *
1461          * @return              An instance of Rectangle indicating the bounds of the clip rectangle
1462          */
1463         FloatRectangle GetClipBoundsF(void) const;
1464
1465         /**
1466          * Locks the %Canvas control for direct pixel access. @n
1467          * This sets up a %Canvas control for accessing the pixels directly. Between the calls to the
1468          * Canvas::Lock() and Canvas::UnLock() methods, the data can be written to and read from the
1469          * Canvas control's pixels. Once the operations on the %Canvas control's pixels are finished, the
1470          * Canvas::Unlock() method must be called to release the lock.
1471          *
1472          * @since               2.0
1473          *
1474          * @return              An error code
1475          * @param[out]  info                    The information of the %Canvas control
1476          * @param[in]   timeout                 The time, in milliseconds, that the caller waits to obtain the lock @n
1477          *                                                              If the lock attempt fails, E_TIMEOUT is returned. The default value
1478          *                                                              is @c INFINITE, which means that the method does not return until the lock
1479          *                                                              is acquired.
1480          * @exception   E_SUCCESS               The method is successful.
1481          * @exception   E_TIMEOUT               The operation cannot be completed within the specified time period.
1482          * @exception   E_SYSTEM                An unknown operating system error has occurred.
1483          *
1484          * @remarks     BufferInfo contains a valid physical memory information, regardless of the
1485          *                              logical position and size of the %Canvas control.
1486          */
1487         result Lock(BufferInfo& info, long timeout = INFINITE);
1488
1489         /**
1490          * Unlocks the %Canvas control.
1491          *
1492          * @since               2.0
1493          *
1494          * @return              An error code
1495          * @exception   E_SUCCESS                       The method is successful.
1496          * @exception   E_SYSTEM                        An unknown operating system error has occurred.
1497          * @remarks             The %Canvas control must be unlocked as soon as possible.
1498          */
1499         result Unlock(void);
1500
1501         /**
1502          * Sets the foreground color.
1503          *
1504          * @since               2.0
1505          *
1506          * @param[in]   color   The color that is set as foreground color
1507          */
1508         void SetForegroundColor(const Color& color);
1509
1510         /**
1511          * Gets the foreground color.
1512          *
1513          * @since               2.0
1514          *
1515          * @return              The foreground color
1516          */
1517         Color GetForegroundColor(void) const;
1518
1519         /**
1520          * Sets the background color.
1521          *
1522          * @since               2.0
1523          *
1524          * @param[in]   color   The color that is set as background color
1525          */
1526         void SetBackgroundColor(const Color& color);
1527
1528         /**
1529          * Gets the background color.
1530          *
1531          * @since               2.0
1532          *
1533          * @return              The background color
1534          */
1535         Color GetBackgroundColor(void) const;
1536
1537         /**
1538          * Sets the current instance of %Canvas to the specified point.
1539          *
1540          * @brief <i> [Deprecated] </i>
1541          * @deprecated   This method is deprecated.
1542          * @since               2.0
1543          *
1544          * @return              An error code
1545          * @param[in]   point                                   The new position
1546          * @exception   E_SUCCESS                               The method is successful.
1547          * @exception   E_UNSUPPORTED_OPERATION Window %Canvas does not support moving the position.
1548          *
1549          * @remarks             Canvas::SetPosition(const Point& point) is not supported anymore since Tizen2.1. @n
1550          *                              This function has influence on only Memory canvas. However, Memory Canvas Show() is deprecated in Tizen2.0, and this method has no meaning since Tizen2.0 and deprecated since Tizen2.1.
1551          */
1552         result SetPosition(const Point& point);
1553
1554         /**
1555          * Sets the current instance of %Canvas to the specified point.
1556          *
1557          * @brief <i> [Deprecated] </i>
1558          * @deprecated   This method is deprecated.
1559          * @since               2.0
1560          *
1561          * @return              An error code
1562          * @param[in]   x                                               The new x-coordinate
1563          * @param[in]   y                                               The new y-coordinate
1564          * @exception   E_SUCCESS                               The method is successful.
1565          * @exception   E_UNSUPPORTED_OPERATION Window %Canvas does not support moving the position.
1566          *
1567          * @remarks             Canvas::SetPosition(int x, int y) is not supported anymore since Tizen2.1. @n
1568          *                              This function has influence on only Memory canvas. However, Memory Canvas Show() is deprecated in Tizen2.0, and this method has no meaning since Tizen2.0 and deprecated since Tizen2.1.
1569          */
1570         result SetPosition(int x, int y);
1571
1572         /**
1573          * Sets the composite mode.
1574          *
1575          * @since       2.1
1576          *
1577          * @return              An error code
1578          * @param[in]   compositeMode                   The new composite mode
1579          * @exception   E_SUCCESS                               The method is successful.
1580          * @exception   E_INVALID_ARG                   The specified input parameter is invalid.
1581          */
1582         result SetCompositeMode(CompositeMode compositeMode);
1583
1584         /**
1585          * Gets the composite mode for the current instance.
1586          *
1587          * @since       2.1
1588          *
1589          * @return      The current composite mode
1590          * @remarks     The default value is @c COMPOSITE_MODE_SRC_OVER.
1591          */
1592          CompositeMode GetCompositeMode(void) const;
1593
1594         /**
1595         * Enables or disables anti-aliasing to the current instance of %Canvas.
1596         *
1597         * @since                2.1
1598         *
1599         * @param[in]    enable          Set to @c true to enable anti-aliasing for the current instance of %Canvas, @n
1600         *                                                       else @c false
1601         * @remarks              By default, the anti-aliasing is enabled.
1602         */
1603         void SetAntiAliasingEnabled(bool enable);
1604
1605         /**
1606         * Checks whether anti-aliasing is enabled to the current instance.
1607         *
1608         * @since        2.1
1609         *
1610         * @return       @c true if the anti-aliasing is enabled to the current instance.
1611         *                       else @c false
1612         */
1613         bool IsAntiAliasingEnabled(void) const;
1614
1615 private:
1616         //
1617         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
1618         //
1619         Canvas(const Canvas& rhs);
1620
1621         //
1622         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
1623         //
1624         Canvas& operator =(const Canvas& rhs);
1625
1626         friend class Bitmap;
1627         friend class TextElement;
1628
1629 private:
1630         friend class _CanvasImpl;
1631
1632         //
1633         // This variable is for internal use only.
1634         // Using this variable can cause behavioral, security-related, and consistency-related issues in the application.
1635         //
1636         // @since 2.0
1637         //
1638         class _CanvasImpl* __pImpl;
1639
1640 }; // Canvas
1641
1642 }} // Tizen::Graphics
1643
1644 #endif //_FGRP_CANVAS_H_