MCPcopy Create free account
hub / github.com/aseprite/laf / draw_button

Function draw_button

examples/custom_window.cpp:73–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73void draw_button(Surface* surface, int x, Hit button, const Hit hit)
74{
75 Paint p;
76 gfx::Rect box(x, 0, kButtonSize, kButtonSize);
77
78 p.color(hit == button ? kTitleBarHigh : kTitleBarBase);
79 p.style(Paint::Fill);
80 surface->drawRect(box, p);
81
82 p.color(gfx::rgba(25, 25, 50));
83 p.style(Paint::Stroke);
84 surface->drawRect(gfx::Rect(x, 0, 2, kButtonSize), p);
85
86 // Draw icon
87 box.shrink(11);
88 box.inflate(1, 1);
89 p.strokeWidth(1.5f);
90 p.antialias(true);
91 switch (button) {
92 case Hit::MinimizeButton: surface->drawRect(gfx::Rect(box.x, box.y2() - 2, box.w, 1), p); break;
93 case Hit::MaximizeButton: surface->drawRect(gfx::Rect(box), p); break;
94 case Hit::CloseButton: {
95 gfx::Path path;
96 path.moveTo(box.x, box.y);
97 path.lineTo(box.x2(), box.y2());
98 path.moveTo(box.x2(), box.y);
99 path.lineTo(box.x, box.y2());
100 surface->drawPath(path, p);
101 break;
102 }
103 default: break;
104 }
105}
106
107void draw_window(Window* window, const FontRef& font, const Hit hit)
108{

Callers 1

draw_windowFunction · 0.85

Calls 9

rgbaFunction · 0.85
y2Method · 0.80
x2Method · 0.80
drawPathMethod · 0.80
colorMethod · 0.45
styleMethod · 0.45
drawRectMethod · 0.45
strokeWidthMethod · 0.45
antialiasMethod · 0.45

Tested by

no test coverage detected