Bare Metal Programming Tool Kit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Public Attributes | Related Functions | List of all members
bmptk::graphics::format Class Reference

specifies how a text is rendered on a screen More...

#include <graphics.h>

Public Member Functions

 format (const font &f=font_default(), font_alignment h=align_near, font_alignment v=align_near, bool wrap=0, unsigned int scale=1, vector spacing=vector::origin(), vector top_left_margin=vector(2, 2), vector bottom_right_margin=vector(2, 2), color fg=color::black(), color bg=color::transparent())
 
 format (const format &fmt, const font &fr)
 create a format from an existing format and a font
 

Public Attributes

const fontf
 the font, default is the default font
 
font_alignment h
 the horizontal alignment, default is near
 
font_alignment v
 the vertical alignment, default is near
 
bool wrap
 wrapping: true for wraparound, false for cutoff (default).
 
unsigned int scale
 scale: 1 is default, 2 is doubole size, etc.
 
vector spacing
 extra spacing between the characters. default is 0.
 
vector top_left_margin
 top-left margin, default is (2,2)
 
vector bottom_right_margin
 bottom-right margin, default is (0,0)
 
color fg
 foreground, default is black
 
color bg
 background, default is transparent
 

Related Functions

(Note that these are not member functions.)

enum  font_alignment { align_near, align_far, align_centre, align_fill }
 
std::ostream & operator<< (std::ostream &s, const font_alignment &a)
 

Detailed Description

specifies how a text is rendered on a screen

A format specifies how an ASCII text is shown on a screen. A format specifies the following aspects:

These aspects are all stored in public attributes and can be read and written.

Definition at line 1871 of file graphics.h.

Constructor & Destructor Documentation

bmptk::graphics::format::format ( const font f = font_default(),
font_alignment  h = align_near,
font_alignment  v = align_near,
bool  wrap = 0,
unsigned int  scale = 1,
vector  spacing = vector::origin(),
vector  top_left_margin = vector( 2,2 ),
vector  bottom_right_margin = vector( 2,2 ),
color  fg = color::black(),
color  bg = color::transparent() 
)
inline

create a format specification

All parameters have suitable default values:

  • default font
  • black-on-transparent
  • top-left aligned
  • no wrapping
  • no extra spacing between the characters
  • 2 pixels all-around margin

Definition at line 1912 of file graphics.h.

Friends And Related Function Documentation

enum font_alignment
related

the alignment of a text

Enumerator:
align_near 

the text is put nearest to the near edge

align_far 

the text is put nearest to the far edge

align_centre 

the text is centered between the edges

align_fill 

the text is space-filled to occupy the space between the edges

Definition at line 1829 of file graphics.h.

std::ostream & operator<< ( std::ostream &  s,
const font_alignment a 
)
related

prints an alignment


The documentation for this class was generated from the following file: