8 #ifndef Guit_Graphics_hpp
9 #define Guit_Graphics_hpp
22 GClip() : x1(0.f), x2(0.f), y1(0.f), y2(0.f) {}
27 bool empty()
const {
return x2 <= x1 || y2 <= y1;}
29 GRect frame()
const {
return GRect(x1, y1, x2-x1+1, y2-y1+1);}
35 bool contain(GPoint
const&)
const;
93 float wx()
const {
return frame_.x;}
94 float wy()
const {
return frame_.y;}
95 GPoint wpos()
const {
return GPoint(frame_.x, frame_.y);}
101 float glx()
const {
return frame_.x;}
102 float gly()
const {
return gly_;}
103 GPoint glpos()
const {
return GPoint(frame_.x, gly_);}
108 float width()
const {
return frame_.w;}
109 float height()
const {
return frame_.h;}
110 GDim size()
const {
return GDim(frame_.w, frame_.h);}
123 void setScale(
float scale);
124 float scale()
const {
return scale_;}
129 void setWinClip(
float x,
float y,
float w,
float h);
138 GRgba
const& color()
const {
return color_;}
139 void setColor(GRgba
const* color);
140 void setColor(GColor
const* color);
141 void setColor(GColor
const& color);
142 void setColor(GColor
const& color,
float alfa);
145 GRgba
const& bgcolor()
const {
return bgcolor_;}
146 void setBgColor(GRgba
const* color);
147 void setBgColor(GColor
const* color);
148 void setBgColor(GColor
const& color);
149 void setBgColor(GColor
const& color,
float alfa);
152 void setFont(GFont
const& font);
153 void setFont(GFontValue
const& font);
163 GDim
drawString(
float x,
float y, GString
const& str);
170 void drawImage(
float x,
float y,
float w,
float h, GIconValue&);
182 void drawTexture(
float x,
float y,
float w,
float h, GTexture texture, GRgba
const* = {});
183 static void deleteTexture(GTexture);
186 void drawLine(
float x1,
float y1,
float x2,
float y2);
187 void drawLine(GPoint
const& p1, GPoint
const& p2) {drawLine(p1.x,p1.y,p2.x,p2.y);}
189 void drawPolyline(std::vector<GPoint>
const& points);
190 void drawPolygon(std::vector<GPoint>
const& points);
192 void drawRect(
float x,
float y,
float w,
float h);
193 void drawRect(GRect
const& r) {drawRect(r.x, r.y, r.w, r.h);}
195 void drawRoundRect(
float x,
float y,
float w,
float h,
float xradius,
float yradius);
196 void drawRoundRect(GRect
const& r,
float xradius,
float yradius) {
197 drawRoundRect(r.x, r.y, r.w, r.h, xradius, yradius);
200 void drawOval(
float x,
float y,
float w,
float h) {
drawArc(x, y, w, h, 0,360,
true);}
201 void drawOval(GRect
const& r) {
drawArc(r.x, r.y, r.w, r.h, 0,360,
true);}
210 void drawArc(
float x,
float y,
float w,
float h,
211 float start,
float extent,
bool pie =
false);
212 void drawArc(GRect
const& rect,
float start,
float extent,
bool pie =
false) {
213 drawArc(rect.x,rect.y,rect.w,rect.h, start, extent, pie);
217 void drawPie(GRect
const& rect,
float start,
float extent) {
drawArc(rect,start,extent,
true);}
219 static bool pickOval(GRect
const&, GPoint
const&);
220 static bool pickPie(GRect
const&,
float start,
float extent, GPoint
const&);
225 bool drawfg_{}, drawbg_{};
226 float gly_{}, thickness_{}, scale_{1.0f}, savex_{}, savey_{};
227 GRgba color_, bgcolor_;