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::rectangle Class Reference

a drawable rectangle object More...

#include <graphics.h>

Inheritance diagram for bmptk::graphics::rectangle:
bmptk::graphics::drawable

Public Member Functions

 rectangle (frame &frame, const vector position, const vector size, const color fg=color::black(), const color bg=color::transparent(), int width=1, relief rel=relief_flat)
 constructs a rectangle from its far corner, bg, fg, width and relief
 
void draw () const
 draw the rectangle on f, at position
 
- Public Member Functions inherited from bmptk::graphics::drawable
frameframe_get () const
 get the parent frame
 
const vector position_get () const
 get the position
 
color fg_get () const
 get the forgeround color
 
color bg_get () const
 get the background color
 
unsigned int width_get () const
 get the width
 
void position_set (const vector pos)
 set the position
 
void fg_set (const color c)
 set the forgeround color
 
void bg_set (const color c)
 set the background color
 
void width_set (unsigned int w)
 set the width
 

Public Attributes

color bright
 bright border color; can be read or written; intitally fg
 
color dark
 dark border color; can be read or written; intially fg
 
relief border
 the relief; can be read or written; initially flat
 
vector size
 the position of the far corner; can be read or written
 

Related Functions

(Note that these are not member functions.)

enum  relief { relief_flat, relief_raised, relief_sunken }
 
relief flip (const relief r)
 
std::ostream & operator<< (std::ostream &s, const relief &r)
 

Additional Inherited Members

- Protected Member Functions inherited from bmptk::graphics::drawable
void drawable_draw_pixel (const vector address, const color c) const
 draw one pixel on f, at position
 
 drawable (frame &fr, const vector position=vector::origin(), const color fg=color::black(), const color bg=color::transparent(), unsigned int width=1)
 constructor, specify frame, position, fg, bg colors, (line) width
 
- Protected Attributes inherited from bmptk::graphics::drawable
framefr
 parent frame
 
vector position
 the position
 
color fg
 foreground color
 
color bg
 background color
 
unsigned int width
 width of (for instance) lines
 

Detailed Description

a drawable rectangle object

A rectangle object is a drawable that represents a rectangle. By default, when it draws itself it will use the fg of its drawable part for its boundary lines, which will be filled to the width by drawing extra lines within the outer boundary. The remaining area within will be filled using the bg.

When the relief is raised, the top and left boundary will be draw using the bright color, and the bottom and right boundary will be drawn using the dark color. When the relief is sunken, this is reversed. The initial relief is flat.

Definition at line 1344 of file graphics.h.

Friends And Related Function Documentation

relief flip ( const relief  r)
related

returns the inverse of the supplied relief

std::ostream & operator<< ( std::ostream &  s,
const relief r 
)
related

prints a relief value

enum relief
related

appearance of the border of a rectangle

Enumerator:
relief_flat 

the border is drawn flat, using the fg color

relief_raised 

the border is drawn raised, using the bright and shadow colors

relief_sunken 

the border is drawn raised, using the shadow and bright colors

Definition at line 1307 of file graphics.h.

Member Data Documentation

relief bmptk::graphics::rectangle::border

the relief; can be read or written; initially flat

The relief used to draw the border.

Definition at line 1369 of file graphics.h.

color bmptk::graphics::rectangle::bright

bright border color; can be read or written; intitally fg

This is the color used for the bright parts of teh border when its relief is raised or sunken.

Definition at line 1358 of file graphics.h.

color bmptk::graphics::rectangle::dark

dark border color; can be read or written; intially fg

This is the color used for the dark parts of the border when its relief is raised or sunken.

Definition at line 1364 of file graphics.h.

vector bmptk::graphics::rectangle::size

the position of the far corner; can be read or written

The position of a drawable is specified when it is drawn, it is not part of the drawable. You can think of the origin being the near corner.

Definition at line 1376 of file graphics.h.


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