ClanLib  2.3.7
rounded_rect.h
Go to the documentation of this file.
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2011 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Harry Storbacka
27 */
28 
31 
32 #pragma once
33 
34 #include "../api_display.h"
35 #include "../../Core/System/sharedptr.h"
36 #include "../../Core/Math/origin.h"
37 #include "../Render/graphic_context.h"
38 
39 class CL_Color;
40 class CL_Gradient;
41 class CL_Pointf;
42 class CL_RoundedRect_Impl;
43 
48 {
51 
52 public:
53 
58  CL_RoundedRect(CL_Sizef size, float rounding_in_pixels=5.0f);
59  virtual ~CL_RoundedRect();
60 
64 
65 public:
67  CL_Sizef get_size() const;
68 
70  float get_width() const;
71 
73  float get_height() const;
74 
76 
77  float get_rounding() const;
78 
81 
84 
87 
90 
93 
96 
99 
102 
106 
107 public:
109  void draw(
110  CL_GraphicContext &gc,
111  const CL_Pointf &position,
112  const CL_Colorf &color,
113  CL_Origin origin=origin_top_left);
114 
116  void fill(
117  CL_GraphicContext &gc,
118  const CL_Pointf &position,
119  const CL_Colorf &color,
120  CL_Origin origin=origin_top_left);
121 
122  void fill(
123  CL_GraphicContext &gc,
124  const CL_Pointf &position,
125  const CL_Gradient &gradient,
126  CL_Origin origin=origin_top_left);
127 
129  void set_size(const CL_Sizef &size);
130 
132  void set_control_point_tl(const CL_Pointf &pos);
133 
135  void set_control_point_tr(const CL_Pointf &pos);
136 
138  void set_control_point_bl(const CL_Pointf &pos);
139 
141  void set_control_point_br(const CL_Pointf &pos);
142 
144 
145  void set_rounding(float offset_pixels);
146 
148  void set_rounding_top_left(const CL_Sizef &offset);
149 
151  void set_rounding_top_right(const CL_Sizef &offset);
152 
154  void set_rounding_bottom_left(const CL_Sizef &offset);
155 
157  void set_rounding_bottom_right(const CL_Sizef &offset);
158 
162 
163 private:
164  CL_SharedPtr<CL_RoundedRect_Impl> impl;
166 };
167