MCPcopy Create free account
hub / github.com/davisking/dlib / draw_sunken_rectangle

Function draw_sunken_rectangle

dlib/gui_widgets/canvas_drawing.cpp:13–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11// ----------------------------------------------------------------------------------------
12
13 void draw_sunken_rectangle (
14 const canvas& c,
15 const rectangle& border,
16 unsigned char alpha
17 )
18 {
19 rectangle area = border.intersect(c);
20 if (area.is_empty() == false)
21 {
22 const rgb_alpha_pixel dark_gray(64,64,64,alpha);
23 const rgb_alpha_pixel gray(128,128,128,alpha);
24 const rgb_alpha_pixel white(255,255,255,alpha);
25 const rgb_alpha_pixel background(212,208,200,alpha);
26
27 draw_line(c,point(border.left(),border.top()),point(border.right()-1,border.top()),gray);
28
29 draw_line(c,point(border.left(),border.bottom()),point(border.right(),border.bottom()),white);
30 draw_line(c,point(border.left()+1,border.bottom()-1),point(border.right()-1,border.bottom()-1),background);
31
32 draw_line(c,point(border.left(),border.top()+1),point(border.left(),border.bottom()-1),gray);
33
34 draw_line(c,point(border.right(),border.top()),point(border.right(),border.bottom()-1),white);
35 draw_line(c,point(border.right()-1,border.top()+1),point(border.right()-1,border.bottom()-2),background);
36
37 draw_line(c,point(border.left()+1,border.top()+1),point(border.left()+1,border.bottom()-2),dark_gray);
38 draw_line(c,point(border.left()+1,border.top()+1),point(border.right()-2,border.top()+1),dark_gray);
39 }
40 }
41
42// ----------------------------------------------------------------------------------------
43

Callers 3

draw_toggle_buttonMethod · 0.85
draw_text_fieldMethod · 0.85

Calls 8

draw_lineFunction · 0.70
pointClass · 0.70
intersectMethod · 0.45
is_emptyMethod · 0.45
leftMethod · 0.45
topMethod · 0.45
rightMethod · 0.45
bottomMethod · 0.45

Tested by

no test coverage detected