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

an object that can be drawn in a frame More...

#include <graphics.h>

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

Public Member Functions

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
 
virtual void draw () const =0
 draw yourself
 

Protected Member Functions

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

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

an object that can be drawn in a frame

A drawable is an abstract object that can be drawn in a frame. A drawable knows the frame the location (anchor point) within this it has has has a forgeground and background color and a (line) width. What these properties exactly mean depends on the specific drawable.

A drawable contains two colors and one integer. It has a reference to a frame. This frame must still exist when the drwabale is asked to draw itself.

Definition at line 605 of file graphics.h.

Constructor & Destructor Documentation

bmptk::graphics::drawable::drawable ( frame fr,
const vector  position = vector::origin(),
const color  fg = color::black(),
const color  bg = color::transparent(),
unsigned int  width = 1 
)
inlineprotected

constructor, specify frame, position, fg, bg colors, (line) width

The default is to draw in black forgeground, with transparent (meaning: do not draw) background, line width (when applicable) 1 pixel.

Definition at line 646 of file graphics.h.

Member Function Documentation

void bmptk::graphics::drawable::drawable_draw_pixel ( const vector  address,
const color  c 
) const
protected

draw one pixel on f, at position

This is the function that the draw function in a concrete drawable should use to draw each pixel of itself. Address is the location of the pixel that is to be drawn, c its color.


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