Tizen 2.1 base
[framework/osp/uifw.git] / src / graphics / FGrp_CanvasCairo.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        FGrp_CanvasCairo.h
20  * @brief       This is the header file for the cairo solution.
21  *
22  */
23
24 #ifndef _FGRP_INTERNAL_CANVASCAIRO_H_
25 #define _FGRP_INTERNAL_CANVASCAIRO_H_
26
27 #include <cairo.h>
28
29 #include "../util/FGrp_UtilType.h"
30 #include "../util/FGrp_UtilPixmap.h"
31
32
33 namespace Tizen { namespace Graphics
34 {
35
36 namespace _Cairo
37 {
38
39 enum DrawArcStyle
40 {
41         DRAW_ARC_STYLE_ARC,
42         DRAW_ARC_STYLE_PIE,
43         DRAW_ARC_STYLE_CHORD
44 };
45
46 enum FillArcStyle
47 {
48         FILL_ARC_STYLE_PIE,
49         FILL_ARC_STYLE_CHORD
50 };
51
52 enum PatternFilter
53 {
54         PATTERN_FILTER_FAST,
55         PATTERN_FILTER_GOOD,
56         PATTERN_FILTER_BEST
57 };
58
59
60 void SetColor(cairo_t* pCairo, unsigned long composedColor);
61
62 template <typename T>
63 void SetClip(cairo_t* pCairo, T x, T y, T width, T height);
64
65 void ResetClip(cairo_t* pCairo);
66
67 void SetDash(cairo_t* pCairo, double* pDashes, int dashCount, double offset);
68
69 void ResetDash(cairo_t* pCairo);
70
71 template <typename T>
72 void DrawRoundRectangle(cairo_t* pCairo, T lineWidth, unsigned long composedColor, const _Util::Rectangle<double>& rect, const _Util::Dimension<double>& arcDim);
73
74 void FillRoundRectangle(cairo_t* pCairo, unsigned long composedColor, const _Util::Rectangle<double>& rect, const _Util::Dimension<double>& arcDim);
75
76 template <typename T>
77 void Drawline(cairo_t* pCairo, T lineWidth, unsigned long composedColor, const _Util::Point<double> point[], int numPoint);
78
79 template <typename T>
80 void DrawRectangle(cairo_t* pCairo, T lineWidth, unsigned long composedColor, const _Util::Rectangle<double>& rect);
81
82 void FillRectangle(cairo_t* pCairo, unsigned long composedColor, const _Util::Rectangle<double>& rect);
83
84 template <typename T>
85 void DrawPolyline(cairo_t* pCairo, T lineWidth, unsigned long composedColor, const _Util::Point<double> point[], int numPoint);
86
87 template <typename T>
88 void DrawPolygon(cairo_t* pCairo, T lineWidth, unsigned long composedColor, const _Util::Point<double> point[], int numPoint);
89
90 void FillPolygon(cairo_t* pCairo, unsigned long composedColor, const _Util::Point<double> point[], int numPoint);
91
92 template <typename T>
93 void DrawEllipse(cairo_t* pCairo, T lineWidth, unsigned long composedColor, const _Util::Rectangle<double>& bounds);
94
95 void FillEllipse(cairo_t* pCairo, unsigned long composedColor, const _Util::Rectangle<double>& bounds);
96
97 template <typename T>
98 void DrawArc(cairo_t* pCairo, T lineWidth, unsigned long composedColor, const _Util::Rectangle<double>& bounds, double startAngle, double endAngle, DrawArcStyle arcType);
99
100 void FillArc(cairo_t* pCairo, unsigned long composedColor, const _Util::Rectangle<double>& bounds, double startAngle, double endAngle, FillArcStyle arcType);
101
102 bool ScalePixmap(_Util::Pixmap& dstImage, const _Util::Pixmap& srcImage, PatternFilter patternFilter);
103
104 } // Tizen::Graphics::_Cairo
105
106 }} // Tizen::Graphics
107
108 #endif // _FGRP_INTERNAL_CANVASCAIRO_H_