Tizen 2.1 base
[framework/osp/uifw.git] / inc / FGraphics.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        FGraphics.h
20  * @brief       This is the header file for the %Graphics namespace.
21  *
22  * This header file contains the declarations of the %Graphics namespace.
23  *
24  */
25
26 #ifndef _FGRAPHICS_H_
27 #define _FGRAPHICS_H_
28
29 #include "FGrpPoint.h"
30 #include "FGrpFloatPoint.h"
31
32 #include "FGrpDimension.h"
33 #include "FGrpFloatDimension.h"
34
35 #include "FGrpRectangle.h"
36 #include "FGrpFloatRectangle.h"
37
38 #include "FGrpFloatMatrix4.h"
39 #include "FGrpFloatVector4.h"
40 #include "FGrpFloatPoint3.h"
41
42 #include "FGrpColor.h"
43
44 #include "FGrpPixelFormat.h"
45
46 #include "FGrpBufferInfo.h"
47
48 #include "FGrpBitmapCommon.h"
49 #include "FGrpBitmap.h"
50
51 #include "FGrpCanvasCommon.h"
52 #include "FGrpCanvas.h"
53
54 #include "FGrpFontCommon.h"
55 #include "FGrpFont.h"
56
57 #include "FGrpTextElement.h"
58 #include "FGrpEnrichedText.h"
59
60 #include "FGrpCoordinateSystem.h"
61
62 /**
63  * @namespace Tizen::Graphics
64  * @brief       This namespace contains classes for drawing-related functionalities.
65  *
66  * @since       2.0
67  *
68  * @remarks     @b Header @b %file: @b \#include @b <FGraphics.h> @n
69  *                      @b Library : @b osp-uifw
70  *
71  * The %Graphics namespace provides enhanced two-dimensional graphics,
72  * text, and imaging capabilities.
73  * It supports comprehensive features for rendering geometric primitives, text, and images
74  * in a flexible framework for developing rich user
75  * interfaces, sophisticated drawing applications, and image editors.
76  * This namespace provides additional features such as Bitmap, Font, and Color to enhance the rendered graphics.
77  * The user can also use basic data types, Point, Rectangle, and Dimension to construct 2D graphic objects, such as
78  * polygons.
79  * @n
80  * For more information on the %Graphics namespace features, see <a href="../org.tizen.native.appprogramming/html/guide/graphics/graphics_namespace.htm">Graphics Guide</a>.
81  *
82  * The following diagram illustrates the relationships between the classes belonging to the %Graphics namespace.
83  * @image html graphics_namespace_class_relationship.png
84  *
85  * The following example demonstrates how to use the %Graphics namespace.
86  *
87  *      @code
88 #include <FBase.h>
89 #include <FGraphics.h>
90
91 using namespace Tizen::Base;
92 using namespace Tizen::Graphics;
93
94 bool
95 MyClass::GraphicsSample(void)
96 {
97     result r = E_SUCCESS;
98
99     // Creates a canvas instance.
100     Canvas* pCanvas = new Canvas();
101     r = pCanvas->Construct();
102     if (IsFailed(r))
103     {
104         goto CATCH;
105     }
106
107     // Clears
108     pCanvas->SetBackgroundColor(Color(0xFF, 0xFF, 0xFF));
109     r = pCanvas->Clear();
110     if (IsFailed(r))
111     {
112         goto CATCH;
113     }
114
115     // Sets the foreground color of this canvas.
116     pCanvas->SetForegroundColor(Color::GetColor(COLOR_ID_GREEN));
117
118     // Draws an ellipse.
119     r = pCanvas->DrawEllipse(Rectangle(50, 50, 50, 80));
120     if (IsFailed(r))
121     {
122         goto CATCH;
123     }
124
125     r = pCanvas->DrawLine(Point(100, 100), Point(150, 150));
126     if (IsFailed(r))
127     {
128         goto CATCH;
129     }
130
131     // Draws a circular arc.
132     r = pCanvas->DrawArc(Rectangle(10, 200, 50, 50), 30, 60, ARC_STYLE_PIE);
133     if (IsFailed(r))
134     {
135         goto CATCH;
136     }
137
138     {
139         // Creates a font instance.
140         Font font;
141         r = font.Construct(FONT_STYLE_PLAIN, 32);
142         if (IsFailed(r))
143         {
144             goto CATCH;
145         }
146
147         // Sets the font to canvas.
148         r = pCanvas->SetFont(font);
149         if (IsFailed(r))
150         {
151             goto CATCH;
152         }
153     }
154
155     // Draws text at the specified location.
156     r = pCanvas->DrawText(Point(50, 50), String(L"Hello World"));
157     if (IsFailed(r))
158     {
159         goto CATCH;
160     }
161
162     // Shows the drawing result on the device screen.
163     r = pCanvas->Show();
164     if (IsFailed(r))
165     {
166         goto CATCH;
167     }
168
169     // Cleans up.
170     delete pCanvas;
171
172     return true;
173
174 CATCH:
175     delete pCanvas;
176
177     return false;
178 }
179  *      @endcode
180  *
181  *
182  *
183  *
184  */
185 namespace Tizen { namespace Graphics
186 {
187
188 } } // Tizen::Graphics
189
190 #endif // _FGRAPHICS_H_