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

Method draw

dlib/gui_widgets/widgets.cpp:274–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

272// ----------------------------------------------------------------------------------------
273
274 void label::
275 draw (
276 const canvas& c
277 ) const
278 {
279 rectangle area = rect.intersect(c);
280 if (area.is_empty() || text_.size() == 0)
281 return;
282
283 using namespace std;
284 unsigned char r = text_color_.red;
285 unsigned char g = text_color_.green;
286 unsigned char b = text_color_.blue;
287 if (!enabled)
288 {
289 r = 128;
290 g = 128;
291 b = 128;
292 }
293
294 rectangle text_rect(rect);
295
296 string::size_type first, last;
297 first = 0;
298 last = text_.find_first_of('\n');
299 mfont->draw_string(c,text_rect,text_,rgb_pixel(r,g,b),first,last);
300
301 while (last != string::npos)
302 {
303 first = last+1;
304 last = text_.find_first_of('\n',first);
305 text_rect.set_top(text_rect.top()+mfont->height());
306 mfont->draw_string(c,text_rect,text_,rgb_pixel(r,g,b),first,last);
307 }
308 }
309
310// ----------------------------------------------------------------------------------------
311

Callers

nothing calls this directly

Calls 15

rgb_pixelClass · 0.85
draw_button_upFunction · 0.85
draw_pixelFunction · 0.85
rgb_alpha_pixelClass · 0.85
assign_all_pixelsFunction · 0.85
assign_pixelFunction · 0.85
roundFunction · 0.85
centered_rectFunction · 0.85
draw_circleFunction · 0.85
draw_stringMethod · 0.80
set_topMethod · 0.80

Tested by

no test coverage detected