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

Method draw

examples/gui_api_ex.cpp:74–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72private:
73
74 void draw (
75 const canvas& c
76 ) const
77 {
78 // The canvas is an object that represents a part of the parent window
79 // that needs to be redrawn.
80
81 // The first thing I usually do is check if the draw call is for part
82 // of the window that overlaps with my widget. We don't have to do this
83 // but it is usually good to do as a speed hack. Also, the reason
84 // I don't have it set to only give you draw calls when it does indeed
85 // overlap is because you might want to do some drawing outside of your
86 // widget's rectangle. But usually you don't want to do that :)
87 rectangle area = c.intersect(rect);
88 if (area.is_empty() == true)
89 return;
90
91 // This simple widget is just going to draw a box on the screen.
92 fill_rect(c,rect,rgb_pixel(red,green,blue));
93 }
94};
95
96// ----------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 4

rgb_pixelClass · 0.85
fill_rectFunction · 0.50
intersectMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected