Rpi-hw  0.7.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
designer-inl.hpp
1 /*
2  Title --- designer-inl.hpp
3 
4  Copyright (C) 2013 Giacomo Trudu - wicker25[at]gmail[dot]com
5 
6  This file is part of Rpi-hw.
7 
8  Rpi-hw is free software: you can redistribute it and/or modify
9  it under the terms of the GNU Lesser General Public License as published by
10  the Free Software Foundation version 3 of the License.
11 
12  Rpi-hw is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with Rpi-hw. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 
22 #ifndef _RPI_HW_DESIGNER_INL_HPP_
23 #define _RPI_HW_DESIGNER_INL_HPP_
24 
25 namespace rpihw { // Begin main namespace
26 
27 template < typename T, typename C, uint8_t N >
28 designer< T, C, N >::designer( T width, T height )
29 
30  : m_area_w ( width )
31  , m_area_h ( height )
32  , m_pos_x (0)
33  , m_pos_y (0)
34  , m_color ( N, 0 )
35  , m_font ( nullptr ) {
36 
37 }
38 
39 template < typename T, typename C, uint8_t N >
41 
42 }
43 
44 template < typename T, typename C, uint8_t N >
45 inline void
46 designer< T, C, N >::setPenColor( const std::vector< C > &color ) {
47 
48  // Set the foreground color
49  m_color = color;
50 }
51 
52 template < typename T, typename C, uint8_t N >
53 inline const std::vector< C > &
55 
56  // Return the current foreground color
57  return m_color;
58 }
59 
60 template < typename T, typename C, uint8_t N >
61 void
63 
64  // Update the pen position
65  m_pos_x = x;
66  m_pos_y = y;
67 }
68 
69 template < typename T, typename C, uint8_t N >
70 inline void
72 
73  // Set the text font
74  m_font = &font;
75 }
76 
77 template < typename T, typename C, uint8_t N >
78 inline font::base &
80 
81  // Return the current text font
82  return *m_font;
83 }
84 
85 template < typename T, typename C, uint8_t N >
86 inline void
88 
89  // Draw the pixel
90  drawPixel( x, y, m_color.cbegin() );
91 }
92 
93 template < typename T, typename C, uint8_t N >
94 void
95 designer< T, C, N >::drawLine( T x0, T y0, T x1, T y1 ) {
96 
97  /** === Bresenham's line algorithm === **/
98 
99  int dx = math::abs( (int) x1 - (int) x0 ),
100  dy = math::abs( (int) y1 - (int) y0 );
101 
102  const bool steep = ( dy > dx );
103 
104  // Move the line to the first positive octant
105  // (algorithm works only with m <= 1 and dx > dy)
106  if ( steep ) {
107 
108  std::swap( x0, y0 );
109  std::swap( x1, y1 );
110  }
111 
112  if ( x0 > x1 ) {
113 
114  std::swap( x0, x1 );
115  std::swap( y0, y1 );
116  }
117 
118  // Calculate the new parameters
119  dx = x1 - x0;
120  dy = math::abs( (int) y1 - (int) y0 );
121 
122  // Calculate initial error and vertical step
123  int e = dx / 2,
124  q = ( y0 < y1 ? 1 : -1 );
125 
126  // Draw the line in the original octant
127  if ( steep ) {
128 
129  drawPoint( y0, x0 );
130 
131  for ( ; x0 <= x1; ++x0, e -= dy ) {
132 
133  if ( e < 0 )
134  y0 += q,e += dx;
135 
136  drawPoint( y0, x0 );
137  }
138 
139  } else {
140 
141  drawPoint( x0, y0 );
142 
143  for ( ; x0 <= x1; ++x0, e -= dy ) {
144 
145  if ( e < 0 )
146  y0 += q, e += dx;
147 
148  drawPoint( x0, y0 );
149  }
150  }
151 }
152 
153 template < typename T, typename C, uint8_t N >
154 void
155 designer< T, C, N >::drawRect( T x0, T y0, T x1, T y1 ) {
156 
157  // Prepare the parameters
158  if ( x0 > x1 )
159  std::swap( x0, x1 );
160 
161  if ( y0 > y1 )
162  std::swap( y0, y1 );
163 
164  // Draw the rectangle
165  T i;
166 
167  for ( i = x0; i <= x1; ++i )
168  drawPoint( i, y0 ), drawPoint( i, y1 );
169 
170  for ( i = y0; i <= y1; ++i )
171  drawPoint( x0, i ), drawPoint( x1, i );
172 }
173 
174 template < typename T, typename C, uint8_t N >
175 void
176 designer< T, C, N >::drawCircle( T cx, T cy, T radius ) {
177 
178  /** === Midpoint circle algorithm === **/
179 
180  int x = 0,
181  y = radius;
182 
183  int d = 1 - radius,
184  dE = 1,
185  dSE = -2 * radius;
186 
187  for ( ; x < y; ++x, dE += 2, d += dE ) {
188 
189  drawCirclePoints( cx, cy, x, y );
190 
191  if ( d >= 0 )
192  y--, d += dSE += 2;
193  }
194 
195  drawCirclePoints( cx, cy, x, y );
196 }
197 
198 template < typename T, typename C, uint8_t N >
199 void
200 designer< T, C, N >::drawEllipse( T cx, T cy, T a, T b ) {
201 
202  /** === Midpoint ellipse algorithm === **/
203 
204  int aa = a * a, aa2 = 2 * aa,
205  bb = b * b, bb2 = 2 * bb;
206 
207  int x = 0,
208  y = b;
209 
210  int dE = 0,
211  dSE = aa2 * y,
212  d = math::round( (float) bb - (aa * b) + (0.25) * aa );
213 
214 
215  // Draw the first region
216  for ( ; dE <= dSE; ++x, dE += bb2, d += (bb + dE) ) {
217 
218  drawEllipsePoints( cx, cy, x, y );
219 
220  if ( d > 0 )
221  y--, d -= dSE -= aa2;
222  }
223 
224  drawEllipsePoints( cx, cy, x, y );
225 
226  // Draw the second region
227  d = math::round( (float) bb * math::square( x + 0.5 ) + aa * math::square( y - 1 ) - aa * bb );
228 
229  --y;
230 
231  for ( ; y >= 0; y--, dSE -= aa2, d += (aa - dSE) ) {
232 
233  if ( d < 0 )
234  ++x, d += dE += bb2;
235 
236  drawEllipsePoints( cx, cy, x, y );
237  }
238 }
239 
240 template < typename T, typename C, uint8_t N >
241 void
242 designer< T, C, N >::fillRect( T x0, T y0, T x1, T y1 ) {
243 
244  // Prepare the parameters
245  if ( x0 > x1 )
246  std::swap( x0, x1 );
247 
248  if ( y0 > y1 )
249  std::swap( y0, y1 );
250 
251  // Calculate the parameters
252  int w = x1 - x0,
253  h = y1 - y0;
254 
255  size_t total = (size_t) w * (size_t) h;
256 
257  // Draw the filled rectangle
258  size_t i = 0;
259 
260  for ( ; i < total; ++i )
261  drawPoint( (int) ( x0 + i % w ), (int) ( y0 + i / w ) );
262 }
263 
264 template < typename T, typename C, uint8_t N >
265 void
266 designer< T, C, N >::fillCircle( T cx, T cy, T radius ) {
267 
268  /** === Midpoint circle algorithm === **/
269 
270  int x = 0,
271  y = radius;
272 
273  int d = 1 - radius,
274  dE = 1,
275  dSE = -2 * radius;
276 
277  for ( ; x < y; ++x, dE += 2, d += dE ) {
278 
279  drawCircleAreas( cx, cy, x, y );
280 
281  if ( d >= 0 )
282  y--, d += dSE += 2;
283  }
284 
285  drawCircleAreas( cx, cy, x, y );
286 }
287 
288 template < typename T, typename C, uint8_t N >
289 void
290 designer< T, C, N >::fillEllipse( T cx, T cy, T a, T b ) {
291 
292  /** === Midpoint ellipse algorithm === **/
293 
294  int aa = a * a, aa2 = 2 * aa,
295  bb = b * b, bb2 = 2 * bb;
296 
297  int x = 0,
298  y = b;
299 
300  int dE = 0,
301  dSE = aa2 * y,
302  d = math::round( (float) bb - (aa * b) + (0.25) * aa );
303 
304 
305  // Draw the first region
306  for ( ; dE <= dSE; ++x, dE += bb2, d += (bb + dE) ) {
307 
308  drawEllipseAreas( cx, cy, x, y );
309 
310  if ( d > 0 )
311  y--, d -= dSE -= aa2;
312  }
313 
314  drawEllipseAreas( cx, cy, x, y );
315 
316  // Draw the second region
317  d = math::round( (float) bb * math::square( x + 0.5 ) + aa * math::square( y - 1 ) - aa * bb );
318 
319  y--;
320 
321  for ( ; y >= 0; y--, dSE -= aa2, d += (aa - dSE) ) {
322 
323  if ( d < 0 )
324  ++x, d += dE += bb2;
325 
326  drawEllipseAreas( cx, cy, x, y );
327  }
328 }
329 
330 template < typename T, typename C, uint8_t N >
331 inline void
332 designer< T, C, N >::drawCirclePoints( T cx, T cy, T x, T y ) {
333 
334  // Draw the symmetric points of the circle
335  drawPoint( cx + x, cy + y );
336  drawPoint( cx - x, cy + y );
337  drawPoint( cx + x, cy - y );
338  drawPoint( cx - x, cy - y );
339 
340  drawPoint( cx + y, cy + x );
341  drawPoint( cx - y, cy + x );
342  drawPoint( cx + y, cy - x );
343  drawPoint( cx - y, cy - x );
344 }
345 
346 template < typename T, typename C, uint8_t N >
347 inline void
348 designer< T, C, N >::drawCircleAreas( T cx, T cy, T x, T y ) {
349 
350  // Draws the symmetric areas of the circle
351  int i, last;
352 
353  for ( i = cx - x, last = cx + x; i <= last; ++i ) {
354 
355  drawPoint( i, cy + y );
356  drawPoint( i, cy - y );
357  }
358 
359  for ( i = cx - y, last = cy + y; i <= cx + y; ++i ) {
360 
361  drawPoint( i, cy + x );
362  drawPoint( i, cy - x );
363  }
364 }
365 
366 template < typename T, typename C, uint8_t N >
367 inline void
368 designer< T, C, N >::drawEllipsePoints( T cx, T cy, T x, T y ) {
369 
370  // Draw the symmetric points of the ellipse
371  drawPoint( cx + x, cy + y );
372  drawPoint( cx - x, cy + y );
373  drawPoint( cx + x, cy - y );
374  drawPoint( cx - x, cy - y );
375 }
376 
377 template < typename T, typename C, uint8_t N >
378 inline void
379 designer< T, C, N >::drawEllipseAreas( T cx, T cy, T x, T y ) {
380 
381  // Draws the symmetric areas of the ellipse
382  int i, last = cx + x;
383 
384  for ( i = cx - x; i <= last; ++i ) {
385 
386  drawPoint( i, cy + y );
387  drawPoint( i, cy - y );
388  }
389 }
390 
391 template < typename T, typename C, uint8_t N >
392 inline void
394 
395  // Draw the bitmap image
396  drawImage( 0, 0, img );
397 }
398 
399 template < typename T, typename C, uint8_t N >
400 void
402 
403  // Check the number of channels
404  if ( img.getSpectrum() != N )
405  throw exception( "(Fatal) `designer->drawImage`: incorrect number of channels\n" );
406 
407  // Get the size of the image
408  uint16_t width = img.getWidth(),
409  height = img.getHeight();
410 
411  // Iterator
412  uint16_t i, j;
413 
414  // Draw the bitmap image
415  for ( j = 0; j < height; ++j )
416  for ( i = 0; i < width; ++i )
417  drawPixel( x + i, y + j, img.getData( i, j ) );
418 }
419 
420 template < typename T, typename C, uint8_t N >
421 void
422 designer< T, C, N >::drawChar( char32_t charcode ) {
423 
424  // Get the bitmap of the character font
425  font::glyph glyph; m_font->data( charcode, glyph );
426 
427  // Get the height of the glyph
428  uint8_t height = glyph.height;
429 
430  // Pointer to a byte in the bitmap buffer
431  const uint8_t *byte = glyph.buffer;
432 
433  // Calculate the real pitch and the step of the pointer
434  uint8_t pitch;
435  int8_t step;
436 
437  if ( glyph.pitch > 0 ) {
438 
439  pitch = (uint8_t) glyph.pitch;
440  step = 1;
441 
442  } else {
443 
444  pitch = (uint8_t) -glyph.pitch;
445  step = -1;
446  }
447 
448  // Calculate the character position
449  T offx = m_pos_x,
450  offy = m_pos_y + ( m_font->getHeight() - glyph.top );
451 
452  /** Monochromatic font **/
453 
454  if ( glyph.format == font::PIXEL_MODE_MONO ) {
455 
456  // Iterators
457  uint8_t i, j, k;
458 
459  // Draw the character
460  for ( j = 0; j < height; ++j )
461  for ( i = 0; i < pitch; ++i, byte += step )
462  for ( k = 0; k < 8; ++k )
463  if ( *byte & ( 1 << ( 7 - k ) ) )
464  drawPixel( offx + i * 8 + k, offy + j, m_color.cbegin() );
465  }
466 
467  // Update the pen position
468  m_pos_x += static_cast< T >( glyph.xadvance );
469 }
470 
471 template < typename T, typename C, uint8_t N >
472 inline void
473 designer< T, C, N >::drawText( char32_t charcode ) {
474 
475  // Check if text font was loaded
476  if ( !m_font )
477  throw exception( "(Fatal) `designer->drawText`: no font selected\n" );
478 
479  // Draw the character
480  drawChar( charcode );
481 }
482 
483 template < typename T, typename C, uint8_t N >
484 inline void
485 designer< T, C, N >::drawText( T x, T y, char32_t charcode ) {
486 
487  // Set the pen position on the display
488  setPenPosition( x, y );
489 
490  // Draw the character on the display
491  drawText( charcode );
492 }
493 
494 
495 /* ================== Iterators ================== */
496 
497 template < typename T, typename C, uint8_t N >
498 template < typename iterator >
499 void
500 designer< T, C, N >::drawText( iterator it, iterator end ) {
501 
502  // Check if text font was loaded
503  if ( !m_font )
504  throw exception( "(Fatal) `designer->drawText`: no font selected\n" );
505 
506  // Store the horizontal pen position
507  T old_x = m_pos_x;
508 
509  // Draw the string
510  for ( ; it != end; ++it ) {
511 
512  if ( *it != '\n' )
513  drawText( (char32_t) *it );
514 
515  else {
516 
517  // Move the cursor to the new line
518  m_pos_x = old_x;
519  m_pos_y += m_font->getHeight();
520  }
521  }
522 }
523 
524 template < typename T, typename C, uint8_t N >
525 template < typename iterator >
526 void
527 designer< T, C, N >::drawText( iterator it, iterator end, T width, T height, uint8_t flags ) {
528 
529  // Check if text font was loaded
530  if ( !m_font )
531  throw exception( "(Fatal) `designer->drawText`: no font selected\n" );
532 
533  // Get the word wrapping mode
534  bool word_break = flags & WORD_BREAK;
535 
536  // Calculate the margin factor
537  T margin = 0;
538 
539  if ( flags & ALIGN_CENTER )
540  margin = 2;
541  else if ( flags & ALIGN_RIGHT )
542  margin = 1;
543 
544  // Store the horizontal pen position
545  T old_x = m_pos_x,
546  old_y = m_pos_y;
547 
548  // Start of the current line
549  iterator off = it;
550 
551  // Current letter and line width
552  T letter_len = 0, line_len = 0;
553 
554 
555  // Break lines between characters
556  if ( word_break ) {
557 
558  for ( ; it != end; ++it ) {
559 
560  letter_len = m_font->getWidth( *it );
561  line_len += letter_len;
562 
563  if ( *it == '\n' ) {
564 
565  if ( margin )
566  m_pos_x = old_x + ( width - line_len + letter_len ) / margin;
567 
568  // Draw the current line
569  for ( ; off != it; ++off )
570  drawChar( (char32_t) *off );
571 
572  m_pos_x = old_x;
573  m_pos_y += m_font->getHeight();
574 
575  if ( ( m_pos_y - old_y ) + m_font->getHeight() > height )
576  break;
577 
578  ++off;
579  line_len = 0;
580 
581  } else if ( line_len > width ) {
582 
583  if ( margin )
584  m_pos_x = ( width - line_len + letter_len ) / margin;
585 
586  // Draw the current line
587  for ( ; off != it; ++off )
588  drawChar( (char32_t) *off );
589 
590  m_pos_x = old_x;
591  m_pos_y += m_font->getHeight();
592 
593  if ( ( m_pos_y - old_y ) + m_font->getHeight() > height )
594  break;
595 
596  line_len = letter_len;
597  }
598  }
599 
600  if ( it == end ) {
601 
602  if ( margin )
603  m_pos_x = old_x + ( width - line_len ) / margin;
604 
605  // Append the last line
606  for ( ; off != end; ++off )
607  drawChar( (char32_t) *off );
608  }
609 
610 
611  // Break lines between words, except when a single word is longer than the width
612  } else {
613 
614  // Start of the current word
615  iterator word_start = it;
616 
617  // Current word width
618  T word_len = 0;
619 
620  // Space character length
621  T space_len = m_font->getWidth( ' ' );
622 
623  for ( ; it != end; ++it ) {
624 
625  letter_len = m_font->getWidth( *it );
626  word_len += letter_len;
627 
628  if ( line_len + word_len > width ) {
629 
630  if ( off == word_start ) {
631 
632  if ( margin )
633  m_pos_x = old_x + ( width - ( line_len + word_len ) + space_len ) / margin;
634 
635  // Draw the current line
636  for ( ; off != it; ++off )
637  drawChar( (char32_t) *off );
638 
639  m_pos_x = old_x;
640  m_pos_y += m_font->getHeight();
641 
642  word_start = it;
643  line_len = 0;
644  word_len = space_len;
645 
646  } else {
647 
648  if ( margin )
649  m_pos_x = old_x + ( width - line_len + space_len ) / margin;
650 
651  // Draw the current line
652  for ( ; off != word_start; ++off )
653  drawChar( (char32_t) *off );
654 
655  m_pos_x = old_x;
656  m_pos_y += m_font->getHeight();
657 
658  off = ++word_start;
659  line_len = 0;
660  }
661 
662  if ( ( m_pos_y - old_y ) + m_font->getHeight() > height )
663  break;
664  }
665 
666  if ( *it == '\n' ) {
667 
668  if ( margin )
669  m_pos_x = old_x + ( width - ( line_len + word_len ) + space_len ) / margin;
670 
671  // Draw the current line
672  for ( ; off != it; ++off )
673  drawChar( (char32_t) *off );
674 
675  m_pos_x = old_x;
676  m_pos_y += m_font->getHeight();
677 
678  if ( ( m_pos_y - old_y ) + m_font->getHeight() > height )
679  break;
680 
681  off = word_start = it + 1;
682  line_len = word_len = 0;
683 
684  } else if ( *it == ' ' ) {
685 
686  word_start = it;
687 
688  line_len += word_len;
689  word_len = 0;
690  }
691  }
692 
693  if ( it == end ) {
694 
695  if ( margin )
696  m_pos_x = old_x + ( width - ( line_len + word_len ) ) / margin;
697 
698  // Append the last line
699  for ( ; off != end; ++off )
700  drawChar( (char32_t) *off );
701  }
702  }
703 }
704 
705 template < typename T, typename C, uint8_t N >
706 template < typename iterator >
707 inline void
708 designer< T, C, N >::drawText( T x, T y, iterator it, iterator end ) {
709 
710  // Set the pen position
711  setPenPosition( x, y );
712 
713  // Draw the string
714  drawText( it, end );
715 }
716 
717 template < typename T, typename C, uint8_t N >
718 template < typename iterator >
719 inline void
720 designer< T, C, N >::drawText( T x, T y, iterator it, iterator end, T width, T height, uint8_t flags ) {
721 
722  // Set the pen position
723  setPenPosition( x, y );
724 
725  // Draw the multiline string
726  drawText( it, end, width, height, flags );
727 }
728 
729 
730 /* ================== Strings ================== */
731 
732 template < typename T, typename C, uint8_t N >
733 inline void
734 designer< T, C, N >::drawText( const std::string &text ) {
735 
736  // Draw the string
737  drawText( text.begin(), text.end() );
738 }
739 
740 template < typename T, typename C, uint8_t N >
741 inline void
742 designer< T, C, N >::drawText( const std::string &text, T width, T height, uint8_t flags ) {
743 
744  // Draw the multiline string
745  drawText( text.begin(), text.end(), width, height, flags );
746 }
747 
748 template < typename T, typename C, uint8_t N >
749 inline void
750 designer< T, C, N >::drawText( T x, T y, const std::string &text ) {
751 
752  // Draw the string
753  drawText( x, y, text.begin(), text.end() );
754 }
755 
756 template < typename T, typename C, uint8_t N >
757 inline void
758 designer< T, C, N >::drawText( T x, T y, const std::string &text, T width, T height, uint8_t flags ) {
759 
760  // Draw the multiline string
761  drawText( x, y, text.begin(), text.end(), width, height, flags );
762 }
763 
764 
765 /* ================== Unicode strings ================== */
766 
767 template < typename T, typename C, uint8_t N >
768 inline void
769 designer< T, C, N >::drawText( const std::u32string &text ) {
770 
771  // Draws the unicode string
772  drawText( text.begin(), text.end() );
773 }
774 
775 template < typename T, typename C, uint8_t N >
776 inline void
777 designer< T, C, N >::drawText( const std::u32string &text, T width, T height, uint8_t flags ) {
778 
779  // Draw the multiline unicode string
780  drawText( text.begin(), text.end(), width, height, flags );
781 }
782 
783 template < typename T, typename C, uint8_t N >
784 inline void
785 designer< T, C, N >::drawText( T x, T y, const std::u32string &text ) {
786 
787  // Set the pen position
788  setPenPosition( x, y );
789 
790  // Draw the unicode string
791  drawText( text.begin(), text.end() );
792 }
793 
794 template < typename T, typename C, uint8_t N >
795 inline void
796 designer< T, C, N >::drawText( T x, T y, const std::u32string &text, T width, T height, uint8_t flags ) {
797 
798  // Draw the multiline unicode string
799  drawText( x, y, text.begin(), text.end(), width, height, flags );
800 }
801 
802 } // End of main namespace
803 
804 #endif /* _RPI_HW_DESIGNER_INL_HPP_ */
virtual uint16_t getHeight() const =0
Returns the height of the image.
virtual void setPenPosition(T x, T y)
Sets the pen position.
int8_t top
The top side bearing.
Definition: glyph.hpp:58
void drawCirclePoints(T cx, T cy, T x, T y)
Draws the symmetric points of the circle.
font::base & getFont() const
Returns the current text font.
designer(T width, T height)
Constructor method.
virtual uint16_t getWidth() const =0
Returns the width of the image.
int16_t pitch
The number of bytes per bitmap line. May be positive or negative.
Definition: glyph.hpp:65
void drawImage(const image::base< C > &img)
Draws an image.
void drawCircleAreas(T cx, T cy, T x, T y)
Draws the symmetric areas of the circle.
void drawChar(char32_t charcode)
Draws a character.
virtual uint8_t getSpectrum() const =0
Returns the number of image channels.
void drawEllipse(T cx, T cy, T a, T b)
Draws an ellipse.
T square(T x)
Returns the square of x
Definition: math.hpp:86
void drawRect(T x0, T y0, T x1, T y1)
Draws a rectangle.
T round(T x)
Returns the nearest integer to x.
Definition: math.hpp:58
void drawPoint(T x, T y)
Draws a point.
PixelMode format
The format of the glyph bitmap (monochrome or gray).
Definition: glyph.hpp:61
int8_t xadvance
The horizontal advance width in pixels.
Definition: glyph.hpp:68
const uint8_t * buffer
A pointer to the bitmap pixels.
Definition: glyph.hpp:73
void fillCircle(T cx, T cy, T radius)
Draws a filled circle.
void setPenColor(const std::vector< C > &color)
Sets the pen color.
virtual color_iterator< T > getData(uint16_t x, uint16_t y) const =0
Returns the color of a pixel.
void setFont(font::base &font)
Sets the text font.
Generic image.
Definition: base.hpp:44
T abs(T x)
Returns the absolute value of x.
Definition: math.hpp:46
void drawEllipseAreas(T cx, T cy, T x, T y)
Draws the symmetric areas of the ellipse.
void drawLine(T x0, T y0, T x1, T y1)
Draws a line.
Generic font.
Definition: base.hpp:50
void fillEllipse(T cx, T cy, T a, T b)
Draws a filled ellipse.
Simple glyph structure.
Definition: glyph.hpp:48
virtual ~designer()
Destructor method.
void fillRect(T x0, T y0, T x1, T y1)
Draws a filled rectangle.
uint8_t height
The height of the glyph.
Definition: glyph.hpp:53
const std::vector< C > & getPenColor() const
Gets the current pen color.
void drawCircle(T cx, T cy, T radius)
Draws a circle.
void drawText(char32_t charcode)
Draws a character.
void drawEllipsePoints(T cx, T cy, T x, T y)
Draws the symmetric points of the ellipse.