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

in-memory write-through frame buffer that can be written to a .bmp file More...

#include <graphics.h>

Inheritance diagram for bmptk::graphics::frame_snapshot:
bmptk::graphics::frame

Public Member Functions

 frame_snapshot (frame &fr)
 construct a frame_snapshot from an underlying frame
 
virtual ~frame_snapshot ()
 destruct a frame_snapshot, freeing the allocated pixel buffer
 
void checked_write (const vector p, const color c)
 write to the pixel buffer and the underlying frame
 
void flush ()
 flush the underlying frame
 
void clear (const color c=color::white())
 clear the buffer, and rember the color used
 
void write_to_bmp_file (const char *file_name)
 write to a .bmp file
 
- Public Member Functions inherited from bmptk::graphics::frame
 frame (const vector size)
 create a frame of specified size
 
vector size_get () const
 get the size of the frame
 
virtual vector translate_outfrom (const vector p) const
 translate a subframe coordinate to a master frame coordinate
 
virtual vector translate_into (const vector p) const
 translate a master frame coordinate to a subframe coordinate
 
bool is_valid (vector p)
 whether p is within the frame
 
color bg_get ()
 get the backround color
 
void write (const vector p, const color c)
 write one pixel, address specified by vector
 

Additional Inherited Members

- Protected Attributes inherited from bmptk::graphics::frame
const vector size
 frame size
 
color bg
 most recently applied background color (as used in clear())
 

Detailed Description

in-memory write-through frame buffer that can be written to a .bmp file

A frame_bsnapshot remembers the writes to the underlying frame in an in-memmory buffer. The write_to_bsmp_file method writes the content of the buffer to a .bmp file.

The buffer is allocated on the heap.

Definition at line 920 of file graphics.h.

Constructor & Destructor Documentation

bmptk::graphics::frame_snapshot::frame_snapshot ( frame fr)
inline

construct a frame_snapshot from an underlying frame

This constructor allocates the pixel buffer on the heap. The size is the number of pixels in the underlying frame * 4 bytes for each pixel.

Definition at line 953 of file graphics.h.

Member Function Documentation

void bmptk::graphics::frame_snapshot::write_to_bmp_file ( const char *  file_name)

write to a .bmp file

This method writes the buffer content to the indicated filename in .bmp format (uncompressed, 24 bits/pixel). This works on the win target, it won't be usefull on targets that don't have a filesystem.


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