2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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
9 // http://floralicense.org/license/
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.
20 * @brief This is the header file for the %Canvas class.
22 * This header file contains the declarations of the %Canvas class.
26 #ifndef _FGRP_CANVAS_H_
27 #define _FGRP_CANVAS_H_
30 #include <FBaseObject.h>
31 #include <FBaseColArrayListT.h>
32 #include <FGrpRectangle.h>
33 #include <FGrpColor.h>
34 #include <FGrpPixelFormat.h>
35 #include <FGrpBufferInfo.h>
36 #include <FGrpBitmap.h>
37 #include <FGrpCanvasCommon.h>
39 namespace Tizen { namespace Graphics
46 * @brief This class provides methods for drawing objects.
50 * @final This class is not intended for extension.
52 * The %Canvas class provides a rectangular region to draw objects on the display device. The %Canvas instance is
53 * associated with a specific context.
55 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/graphics/canvas.htm">Canvas</a>.
58 class _OSP_EXPORT_ Canvas
59 : public Tizen::Base::Object
63 * This is the default constructor for this class.
66 * @remarks After creating an instance of this class, one of the Construct() methods must be
67 * called explicitly to initialize this instance.
72 * This is the destructor for this class.
76 virtual ~Canvas(void);
79 * Initializes this instance of %Canvas to create a canvas control of the same size as that of the
84 * @return An error code
85 * @exception E_SUCCESS The method is successful.
86 * @exception E_OUT_OF_MEMORY The memory is insufficient.
88 result Construct(void);
91 * Initializes this instance of %Canvas with the specified parameter.
95 * @return An error code
96 * @param[in] rect The location and size of the canvas control on the device screen @n
97 * The width and height of the rectangle must be greater than @c 0.
98 * If this condition is not satisfied, the E_OUT_OF_RANGE exception is returned.
99 * @exception E_SUCCESS The method is successful.
100 * @exception E_OUT_OF_RANGE The value of the argument is outside the valid range defined by the method.
102 result Construct(const Rectangle& rect);
105 * Initializes this instance of %Canvas with the buffer information.
109 * @return An error code
110 * @param[in] bufferInfo The information of the buffer to be used by the canvas.
111 * @exception E_SUCCESS The method is successful.
112 * @exception E_INVALID_ARG The buffer information is invalid.
113 * @exception E_UNSUPPORTED_FORMAT The given buffer information is a format unsupported by the canvas.
114 * @exception E_SYSTEM An unknown operating system error has occurred
115 * @remarks Only PIXEL_FORMAT_ARGB8888 is supported.
117 result Construct(const BufferInfo& bufferInfo);
121 * Clears the current instance of %Canvas with the background color.
125 * @return An error code
126 * @exception E_SUCCESS The method is successful.
131 * Clears a rectangular region of the current instance of %Canvas with the background color.
135 * @return An error code
136 * @param[in] rect The location and size of the rectangular region @n
137 * The width and height of the rectangle must be greater than or equal to @c 0.
138 * The rectangular region must not fall outside the edges of the
139 * current instance of %Canvas entirely.If these conditions are not
140 * satisfied, the E_OUT_OF_RANGE exception is returned.
141 * @exception E_SUCCESS The method is successful.
142 * @exception E_OUT_OF_RANGE The value of the argument is outside the valid range defined by the method.
144 result Clear(const Rectangle& rect);
147 * Copies the specified rectangular region from the specified instance of %Canvas to the current instance of
148 * %Canvas at the specified location.
152 * @return An error code
153 * @param[in] destPoint The location to copy the rectangular region
154 * @param[in] srcCanvas The source %Canvas
155 * @param[in] srcRect The location and size of the rectangular region on the source %Canvas @n
156 * The rectangular region must not fall outside the edges of
157 * the current instance of %Canvas entirely. If this condition is
158 * not satisfied, the E_OUT_OF_RANGE exception is returned.
159 * @exception E_SUCCESS The method is successful.
160 * @exception E_INVALID_ARG A specified input parameter is invalid.
161 * @exception E_OUT_OF_RANGE The value of the argument is outside the valid range defined by the method.
163 result Copy(const Point& destPoint, const Canvas& srcCanvas, const Rectangle& srcRect);
166 * Copies the scaled image of the specified rectangular region from the specified instance of
167 * %Canvas to the current instance of %Canvas.
171 * @return An error code
172 * @param[in] destRect The location and size of the destination image @n
173 * The value of @c destRect must not fall outside the edges of
174 * the current instance of %Canvas entirely. If this condition is
175 * not satisfied, the E_OUT_OF_RANGE exception is returned.
176 * @param[in] srcCanvas The source %Canvas
177 * @param[in] srcRect The location and size of the source image @n
178 * The value of @c srcRect must not fall outside the edges of
179 * the current instance of %Canvas entirely. If this condition is
180 * not satisfied, the E_OUT_OF_RANGE exception is returned.
181 * @exception E_SUCCESS The method is successful.
182 * @exception E_INVALID_ARG A specified input parameter is invalid.
183 * @exception E_OUT_OF_RANGE The value of the argument is outside the valid range defined by the method.
184 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of this operation.
186 result Copy(const Rectangle& destRect, const Canvas& srcCanvas, const Rectangle& srcRect);
189 * Gets the line style set for the current instance of %Canvas.
193 * @return An instance of %LineStyle
194 * @remarks The default value is LINE_STYLE_SOLID.
196 LineStyle GetLineStyle(void) const;
199 * Gets the line width of the current instance of %Canvas.
203 * @return The line width, @n
204 * else @c -1 if the method fails
205 * @remarks The default value is 1.
207 int GetLineWidth(void) const;
210 * Sets the line style for the current instance of %Canvas.
214 * @return An error code
215 * @param[in] style The new line style for the %Canvas control
216 * @exception E_SUCCESS The method is successful.
217 * @exception E_INVALID_ARG The specified input parameter is invalid.
219 result SetLineStyle(LineStyle style);
222 * Sets the line width for the current instance of %Canvas.
226 * @return An error code
227 * @param[in] width The new width for the %Canvas control @n
228 * The width for the %Canvas control must be greater than @c 0.
229 * @exception E_SUCCESS The method is successful.
230 * @exception E_OUT_OF_RANGE The value of the argument is outside the valid range defined by the method.
232 result SetLineWidth(int width);
235 * Gets the dash pattern of the current instance of %Canvas.
239 * @return An error code
240 * @param[out] pattern The list containing the information of dash pattern.
241 * @param[out] offset The offset into the dash pattern at which the stroke must start
242 * @exception E_SUCCESS The method is successful.
243 * @exception E_INVALID_ARG A specific input parameter is invalid.
245 result GetDashPattern(Tizen::Base::Collection::IListT<int>& pattern, int& offset) const;
248 * Sets the dash pattern for the current instance of %Canvas.
252 * @return An error code
253 * @param[in] pattern The list containing the information of dash pattern.
254 * @param[in] offset The offset into the dash pattern at which the stroke must start
255 * @exception E_SUCCESS The method is successful.
256 * @exception E_INVALID_ARG A specific input parameter is invalid.
258 result SetDashPattern(const Tizen::Base::Collection::IListT<int>& pattern, int offset);
261 * Gets the color information at the specified point.
265 * @return An error code
266 * @param[in] point The location of the point relative to the upper-left corner of the current instance of %Canvas @n
267 * The point must not fall outside the edges of %Canvas. If this
268 * condition is not satisfied, the E_OUT_OF_RANGE exception is returned.
269 * @param[out] color An instance of Color
270 * @exception E_SUCCESS The method is successful.
271 * @exception E_OUT_OF_RANGE The value of the argument is outside the valid range defined by the method.
273 result GetPixel(const Point& point, Color& color) const;
276 * Sets a point at the specified coordinate.
280 * @return An error code
281 * @param[in] point The location of the point relative to the upper-left corner of the current instance of %Canvas @n
282 * The point must not entirely fall outside the edges of %Canvas.
283 * If this condition is not satisfied, the E_OUT_OF_RANGE exception
285 * @exception E_SUCCESS The method is successful.
286 * @exception E_OUT_OF_RANGE The value of the argument is outside the valid range defined by the method.
288 result SetPixel(const Point& point);
291 * Draws a line between the two specified points.
295 * @return An error code
296 * @param[in] point1 The starting point
297 * @param[in] point2 The end point
298 * @exception E_SUCCESS The method is successful.
300 result DrawLine(const Point& point1, const Point& point2);
307 * @return An error code
308 * @param[in] rect The rectangle to be drawn on the %Canvas control @n
309 * The width and height of the rectangle must be greater than or equal to @c 0.
310 * The rectangle must not entirely fall outside the edges of
311 * the %Canvas control. If these conditions are not satisfied,
312 * the E_OUT_OF_RANGE exception is returned.
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.
316 result DrawRectangle(const Rectangle& rect);
319 * Fills a rectangular region of the current instance of %Canvas with the specified color.
323 * @return An error code
324 * @param[in] color The fill color
325 * @param[in] rect The rectangular region on the %Canvas control @n
326 * The width and height of the rectangle must be greater than or equal to @c 0.
327 * The rectangle must not entirely fall outside the edges of the
328 * %Canvas control. If these conditions are not satisfied, the
329 * E_OUT_OF_RANGE exception is returned.
330 * @exception E_SUCCESS The method is successful.
331 * @exception E_OUT_OF_RANGE The value of the argument is outside the valid range defined by the method.
333 result FillRectangle(const Color& color, const Rectangle& rect);
336 * Draws a round-edged rectangle.
340 * @return An error code
341 * @param[in] rect The location and size of the rectangle @n
342 * The width and height of the rectangle must be greater than or equal to @c 0.
343 * The rectangle must not entirely fall outside the edges of the
344 * %Canvas control. If these conditions are not satisfied, the
345 * E_OUT_OF_RANGE exception is returned.
346 * @param[in] arcDim The width and height of the round edge @n
347 * The width and height in the @c arcDim parameter must be greater than or equal to @c 0.
348 * @exception E_SUCCESS The method is successful.
349 * @exception E_OUT_OF_RANGE The value of the argument is outside the valid range defined by the method.
351 result DrawRoundRectangle(const Rectangle& rect, const Dimension& arcDim);
354 * Draws a filled rectangle.
358 * @return An error code
359 * @param[in] color The fill color
360 * @param[in] rect The location and size of the rectangle @n
361 * The width and height of the rectangle must be greater than or equal to @c 0.
362 * The rectangle must not entirely fall outside the edges of the
363 * %Canvas control. If these conditions are not satisfied, the
364 * E_OUT_OF_RANGE exception is returned.
365 * @param[in] arcDim The width and height of the round edge @n
366 * The width and height mentioned in the @c arcDim parameter must be greater than or equal to @c 0.
367 * @exception E_SUCCESS The method is successful.
368 * @exception E_OUT_OF_RANGE The value of the argument is outside the valid range defined by the method.
370 result FillRoundRectangle(const Color& color, const Rectangle& rect, const Dimension& arcDim);
377 * @return An error code
378 * @param[in] rect The location and size of the bounding rectangle @n
379 * The width and height of the rectangle must be greater than or equal to @c 0.
380 * The rectangle must not entirely fall outside the edges of the
381 * %Canvas control. If these conditions are not satisfied, the
382 * E_OUT_OF_RANGE exception is returned.
383 * @exception E_SUCCESS The method is successful.
384 * @exception E_OUT_OF_RANGE The value of the argument is outside the valid range defined by the method.
386 result DrawEllipse(const Rectangle& rect);
389 * Draws a filled ellipse with the specified color.
393 * @return An error code
394 * @param[in] color The fill color
395 * @param[in] rect The location and size of the bounding rectangle @n
396 * The width and height of the rectangle must be greater than or equal to @c 0. @n
397 * The rectangle must not entirely fall outside the edges of the
398 * %Canvas control. If these conditions are not satisfied, the
399 * E_OUT_OF_RANGE exception is returned.
400 * @exception E_SUCCESS The method is successful.
401 * @exception E_OUT_OF_RANGE The value of the argument is outside the valid range defined by the method.
403 result FillEllipse(const Color& color, const Rectangle& rect);
406 * Draws a circular arc.
410 * @return An error code
411 * @param[in] rect The location and size of the bounding rectangle @n
412 * The width and height of the rectangle must be greater than or equal to @c 0.
413 * The rectangle must not entirely fall outside the edges of the
414 * %Canvas control. If these conditions are not satisfied, the
415 * E_OUT_OF_RANGE exception is returned.
416 * @param[in] startAngle The starting angle
417 * @param[in] endAngle The ending angle
418 * @param[in] arcStyle The arc style
419 * @exception E_SUCCESS The method is successful.
420 * @exception E_OUT_OF_RANGE The value of the argument is outside the valid range defined by the method.
421 * @exception E_INVALID_ARG A specified input parameter is invalid.
423 result DrawArc(const Rectangle& rect, int startAngle, int endAngle, ArcStyle arcStyle);
430 * @return An error code
431 * @param[in] point1 The location of the first vertex
432 * @param[in] point2 The location of the second vertex
433 * @param[in] point3 The location of the third vertex
434 * @exception E_SUCCESS The method is successful.
436 result DrawTriangle(const Point& point1, const Point& point2, const Point& point3);
439 * Draw a filled triangle with the specified color.
443 * @return An error code
444 * @param[in] color The fill color
445 * @param[in] point1 The location of the first vertex
446 * @param[in] point2 The location of the second vertex
447 * @param[in] point3 The location of the third vertex
448 * @exception E_SUCCESS The method is successful.
450 result FillTriangle(const Color& color, const Point& point1, const Point& point2, const Point& point3);
457 * @return An error code
458 * @param[in] points A list containing the location of points @n
459 * The number of points must be greater than or equal to @c 0.
460 * @exception E_SUCCESS The method is successful.
461 * @exception E_INVALID_ARG The specified input parameter is invalid.
463 result DrawPolyline(const Tizen::Base::Collection::IList& points);
470 * @return An error code
471 * @param[in] points A list containing the locations of the vertices of the polygon @n
472 * The number of points must be greater than or equal to @c 0.
473 * @exception E_SUCCESS The method is successful.
474 * @exception E_INVALID_ARG The specified input parameter is invalid.
476 result DrawPolygon(const Tizen::Base::Collection::IList& points);
479 * Draws a filled polygon with the specified color.
483 * @return An error code
484 * @param[in] color The fill color
485 * @param[in] points A list containing the locations of the vertices of the polygon @n
486 * The number of points must be greater than or equal to @c 0.
487 * @exception E_SUCCESS The method is successful.
488 * @exception E_INVALID_ARG A specified input parameter is invalid.
490 result FillPolygon(const Color& color, const Tizen::Base::Collection::IList& points);
493 * Sets a font to the %Canvas control.
497 * @return An error code
498 * @param[in] font The font @n
499 * It must be constructed before being passed to this method.
500 * @exception E_SUCCESS The method is successful.
501 * @exception E_INVALID_ARG The specified input parameter is invalid.
503 result SetFont(const Font& font);
506 * Gets a font of the %Canvas control.
510 * @return The font of the %Canvas control, @n
511 * else @c null if the method fails
512 * @exception E_SUCCESS The method is successful.
513 * @exception E_OUT_OF_MEMORY The memory is insufficient.
514 * @remarks The specific error code can be accessed using the GetLastResult() method.
515 * @remarks If a font is not set with the SetFont() method, this method returns the system default font.
517 Font* GetFontN(void) const;
520 * Draws a text at the specified location.
524 * @return An error code
525 * @param[in] point The location to draw the text
526 * @param[in] text The text to draw
527 * @exception E_SUCCESS The method is successful.
528 * @exception E_INVALID_ARG A specified input parameter is invalid.
529 * @exception E_OPERATION_FAILED The operation has failed.
530 * @remarks The foreground color (RGB value only) of the %Canvas control is used as the text color.
531 * @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.
533 result DrawText(const Point& point, const Tizen::Base::String& text);
536 * Draws a text at the specified location and length.
540 * @return An error code
541 * @param[in] point The location to draw the text
542 * @param[in] text The text to draw
543 * @param[in] length The number of characters in the string @n
544 * It must be greater than or equal to @c 0.
545 * @exception E_SUCCESS The method is successful.
546 * @exception E_INVALID_ARG A specified input parameter is invalid.
547 * @exception E_OUT_OF_RANGE The value of the argument is outside the valid range defined by the method.
548 * @exception E_OPERATION_FAILED The operation has failed.
549 * @remarks The foreground color (RGB value only) of the %Canvas control is used as the text color.
550 * @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.
552 result DrawText(const Point& point, const Tizen::Base::String& text, int length);
555 * Draws a text with an outline rendering at the specified location.
559 * @return An error code
560 * @param[in] point The location to draw the text
561 * @param[in] text The text to draw @n
562 * @param[in] outlineColor The color that is set as outline color
563 * @exception E_SUCCESS The method is successful.
564 * @exception E_INVALID_ARG A specified input parameter is invalid.
565 * @exception E_OUT_OF_RANGE The value of the argument is outside the valid range defined by the method.
566 * @exception E_OPERATION_FAILED The operation has failed.
567 * @remarks The foreground color (RGB value only) of the %Canvas control is used as the text color.
568 * @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.
570 result DrawText(const Point& point, const Tizen::Base::String& text, const Color& outlineColor);
573 * Draws a text with an outline rendering at the specified location and length.
577 * @return An error code
578 * @param[in] point The location to draw the text
579 * @param[in] text The text to draw
580 * @param[in] length The number of characters in the string @n
581 * It must be greater than or equal to @c 0.
582 * @param[in] outlineColor The color that is set as outline color
583 * @exception E_SUCCESS The method is successful.
584 * @exception E_INVALID_ARG A specified input parameter is invalid.
585 * @exception E_OUT_OF_RANGE The value of the argument is outside the valid range defined by the method.
586 * @exception E_OPERATION_FAILED The operation has failed.
588 * @remarks The foreground color (RGB value only) of the %Canvas control is used as the text color.
589 * @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.
591 result DrawText(const Point& point, const Tizen::Base::String& text, int length, const Color& outlineColor);
594 * Draws an enriched text at the specified area.
598 * @return An error code
599 * @param[in] point The location to draw the text
600 * @param[in] enrichedText The TextElement to draw
601 * @exception E_SUCCESS The method is successful.
602 * @exception E_DEVICE_UNAVAILABLE A specified device is invalid.
604 * @remarks The foreground color (RGB value only) of the %Canvas control is used as the text color.
605 * @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.
607 result DrawText(const Point& point, const EnrichedText& enrichedText);
610 * Draws a bitmap image at the specified location.
614 * @return An error code
615 * @param[in] point The location of the upper-left corner of the bitmap
616 * @param[in] bitmap The bitmap to draw @n
617 * It must be constructed before being passed into this
618 * method. BitmapPixelFormat::BITMAP_PIXEL_FORMAT_R8G8B8A8 is
619 * not applicable for this method. The bitmap must not
620 * entirely fall outside the edges of the %Canvas control. If
621 * this condition is not satisfied, the E_OUT_OF_RANGE exception
623 * @exception E_SUCCESS The method is successful.
624 * @exception E_INVALID_ARG A specified input parameter is invalid.
626 result DrawBitmap(const Point& point, const Bitmap& bitmap);
629 * Draws a bitmap image at the specified location.
633 * @return An error code
634 * @param[in] rect The location and size of the scaled bitmap @n
635 * The rectangle must not entirely fall outside the edges of the
636 * %Canvas control. If this condition is not satisfied, the
637 * E_OUT_OF_RANGE exception is returned.
638 * @param[in] bitmap The bitmap to draw @n
639 * It must be constructed well before being passed into this
641 * @exception E_SUCCESS The method is successful.
642 * @exception E_INVALID_ARG A specified input parameter is invalid.
643 * @exception E_OUT_OF_RANGE The value of the argument is outside the valid range defined by the method.
644 * @remarks BitmapPixelFormat::BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method.
646 result DrawBitmap(const Rectangle& rect, const Bitmap& bitmap);
649 * Draws a color data corresponding to a rectangle of pixels from the specified bitmap onto %Canvas.
653 * @return An error code
654 * @param[in] destRect The destination rectangle of %Canvas @n
655 * The width and height of the rectangle must be greater than or equal to @c 0.
656 * The rectangle defined by @c destRect will be clipped at the edges
657 * of the %Canvas control to prevent the rectangle from falling
658 * outside the edges of the %Canvas control. The destination
659 * rectangle of a %Canvas control must not fall outside the edges
660 * of the %Canvas control entirely. If these conditions are not
661 * satisfied, the E_OUT_OF_RANGE exception is returned.
662 * @param[in] srcBitmap The bitmap to draw
663 * @param[in] srcRect The source rectangle of a bitmap @n
664 * The width and height of the rectangle must be greater than or equal to @c 0.
665 * The rectangle defined by @c srcRect will be clipped at the edges
666 * of the bitmap to prevent the rectangle from falling outside the
667 * edges of the bitmap. The source rectangle of a bitmap must not
668 * fall outside the edges of the bitmap entirely. If these
669 * conditions are not satisfied, the E_OUT_OF_RANGE exception is
671 * @exception E_SUCCESS The method is successful.
672 * @exception E_INVALID_ARG A specified input parameter is invalid.
673 * @exception E_OUT_OF_RANGE The value of the argument is outside the valid range defined by the method.
674 * @remarks If the source and destination rectangles are not of the same size,
675 * the source bitmap is stretched to match the destination rectangle. @n
676 * BitmapPixelFormat::BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method.
678 result DrawBitmap(const Rectangle& destRect, const Bitmap& srcBitmap, const Rectangle& srcRect);
681 * Draws a flipped bitmap image at the specified location.
685 * @return An error code
686 * @param[in] point The location to draw the bitmap
687 * @param[in] bitmap The bitmap to draw @n
688 * It must be constructed before being passed to this method.
689 * @param[in] dir The flip direction
690 * @exception E_SUCCESS The method is successful.
691 * @exception E_INVALID_ARG A specified input parameter is invalid.
692 * @remarks BitmapPixelFormat::BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method.
694 result DrawBitmap(const Point& point, const Bitmap& bitmap, FlipDirection dir);
697 * Draws a rotated bitmap image at the specified location.
701 * @return An error code
702 * @param[in] point A location to draw a bitmap image @n
703 * This location is relatively defined from the origin (upper-left
704 * corner) of the %Canvas control.
705 * @param[in] bitmap The bitmap to draw @n
706 * It must be constructed before being passed to this method.
707 * @param[in] pivot The center of rotation of a bitmap image @n
708 * This center is relatively defined from the origin (upper-left
709 * corner) of the bitmap.
710 * @param[in] degree The amount of rotation in degrees
711 * @exception E_SUCCESS The method is successful.
712 * @exception E_INVALID_ARG A specified input parameter is invalid.
713 * @remarks BitmapPixelFormat::BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method.
714 * @image html graphics_rotatebitmap.PNG
716 result DrawBitmap(const Point& point, const Bitmap& bitmap, const Point& pivot, int degree);
719 * Draws a nine-patched bitmap at the specified location.
723 * @return An error code
724 * @param[in] rect The location and size of the nine-patched bitmap @n
725 * The rectangle must not entirely fall outside the edges of the
726 * %Canvas control. If this condition is not satisfied, the
727 * E_OUT_OF_RANGE exception is returned.
728 * @param[in] bitmap The bitmap to draw @n
729 * It must be constructed before being passed to this method.
730 * @exception E_SUCCESS The method is successful.
731 * @exception E_INVALID_ARG A specified input parameter is invalid.
732 * @exception E_OUT_OF_RANGE The value of the argument is outside the valid range defined by the method.
734 * @remarks BitmapPixelFormat::BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method. @n
735 * The nine-patched bitmap must have a stretchable section by drawing one (or more) 1-pixel-wide black line(s) in the
736 * left and top part of the border.
737 * @image html graphics_ninepatchedbitmap.PNG
740 result DrawNinePatchedBitmap(const Rectangle& rect, const Bitmap& bitmap);
743 * Shows the current instance of %Canvas on the device screen.
746 * @brief <i> [Compatibility] </i>
750 * @compatibility This method has compatibility issues with OSP compatible applications @n
751 * For more information, see the issue description for @ref CompCanvasShowPage "here".
754 * @return An error code
755 * @exception E_SUCCESS The method is successful.
756 * @exception E_UNSUPPORTED_OPERATION This operation is not supported.
763 * @page CompCanvasShowPage Compatibility for Show().
764 * @section CompCanvasShowPageIssueSection Issues
765 * 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.
767 * -# 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.
768 * -# 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.
776 * Shows the specified rectangle of the current instance of %Canvas on the device screen.
778 * @brief <i> [Deprecated] </i>
779 * @deprecated This method is deprecated. Instead of this method, use the Show().
782 * @return An error code
783 * @param[in] rect The bounds of the %Canvas control to display @n
784 * The width and height of the rectangle must be greater than or equal to @c 0.
785 * The rectangle must not entirely fall outside the edges of the
786 * %Canvas control. If these conditions are not satisfied, the
787 * E_OUT_OF_RANGE exception is returned.
788 * @exception E_SUCCESS The method is successful.
789 * @exception E_OUT_OF_RANGE The value of the argument is outside the valid range defined by the method.
791 * @remark If you use Show(Rectangle&) in Tizen, this method works differently. @n
792 * This method shows the screen entirely not partially in Tizen.
795 result Show(const Rectangle& rect);
798 * Gets the location and size of the current %Canvas instance on the device screen.
802 * @return The Rectangle instance containing the location and size of the current %Canvas instance
803 * @remarks If this %Canvas instance is a Window %Canvas, it returns Rectangle(0, 0, w, h).
805 Rectangle GetBounds(void) const;
808 * Sets the clip rectangle for a %Canvas control. @n
809 * When a clip rectangle is set, any drawing is restricted within the specified rectangular area. The
810 * rectangular area defined is clipped at the edges of the %Canvas control so as to prevent the clipped rectangle
811 * from falling outside the %Canvas control.
815 * @return An error code
816 * @param[in] rect The bounds of the clip rectangle @n
817 * The width and height of the rectangle must be greater than or equal to @c 0.
818 * The clip rectangle for a %Canvas control must not entirely fall
819 * outside the edges of the %Canvas control. If these conditions are
820 * not satisfied, the E_OUT_OF_RANGE exception is returned.
821 * @exception E_SUCCESS The method is successful.
822 * @exception E_OUT_OF_RANGE The value of the argument is outside the valid range defined by the method.
824 result SetClipBounds(const Rectangle& rect);
827 * Gets the bounds of the clip rectangle of a %Canvas control.
831 * @return An instance of Rectangle indicating the bounds of the clip rectangle
833 Rectangle GetClipBounds(void) const;
836 * Locks the %Canvas control for direct pixel access. @n
837 * This sets up a %Canvas control for accessing the pixels directly. Between the calls to the
838 * Canvas::Lock() and Canvas::UnLock() methods, the data can be written to and read from the
839 * Canvas control's pixels. Once the operations on the %Canvas control's pixels are finished, the
840 * Canvas::Unlock() method must be called to release the lock.
844 * @return An error code
845 * @param[out] info The information of the %Canvas control
846 * @param[in] timeout The time, in milliseconds, that the caller waits for the lock to be obtained @n
847 * If the lock attempt fails, E_TIMEOUT is returned. The default value
848 * is INFINITE, which means that the method does not return until the lock
850 * @exception E_SUCCESS The method is successful.
851 * @exception E_TIMEOUT The operation cannot be completed within the specified time period.
852 * @exception E_SYSTEM An unknown operating system error has occurred.
854 * @remarks BufferInfo contains a valid physical memory information, regardless of the
855 * logical position and size of the %Canvas control.
857 result Lock(BufferInfo& info, long timeout = INFINITE);
860 * Unlocks the %Canvas control.
864 * @return An error code
865 * @exception E_SUCCESS The method is successful.
866 * @exception E_SYSTEM An unknown operating system error has occurred.
867 * @remarks The %Canvas control must be unlocked as soon as possible.
872 * Sets the foreground color.
876 * @param[in] color The color that is set as foreground color
878 void SetForegroundColor(const Color& color);
881 * Gets the foreground color.
885 * @return The foreground color
887 Color GetForegroundColor(void) const;
890 * Sets the background color.
894 * @param[in] color The color that is set as background color
896 void SetBackgroundColor(const Color& color);
899 * Gets the background color.
903 * @return The background color
905 Color GetBackgroundColor(void) const;
908 * Sets the current instance of %Canvas to the specified point.
912 * @return An error code
913 * @param[in] point The new position
914 * @exception E_SUCCESS The method is successful.
915 * @exception E_UNSUPPORTED_OPERATION Window %Canvas does not support moving the position.
917 result SetPosition(const Point& point);
920 * Sets the current instance of %Canvas to the specified point.
924 * @return An error code
925 * @param[in] x The new x-coordinate
926 * @param[in] y The new y-coordinate
927 * @exception E_SUCCESS The method is successful.
928 * @exception E_UNSUPPORTED_OPERATION Window %Canvas does not support moving the position.
930 result SetPosition(int x, int y);
934 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
936 Canvas(const Canvas& rhs);
939 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
941 Canvas& operator =(const Canvas& rhs);
944 friend class TextElement;
947 friend class _CanvasImpl;
950 // This variable is for internal use only.
951 // Using this variable can cause behavioral, security-related, and consistency-related issues in the application.
955 class _CanvasImpl* __pImpl;
959 }} // Tizen::Graphics
961 #endif //_FGRP_CANVAS_H_