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::image_pixels Class Referenceabstract

an image that can be read pixel by pixel More...

#include <graphics.h>

Inheritance diagram for bmptk::graphics::image_pixels:
bmptk::graphics::image bmptk::graphics::char_photo bmptk::graphics::inline_bw_photo bmptk::graphics::inline_rgb_photo bmptk::graphics::inline_font

Public Member Functions

 image_pixels (vector size)
 constructor, specify the size
 
vector size_get () const
 get the size of the picture
 
bool is_valid (const vector p) const
 report whether p is within the image
 
virtual void draw (frame &frame, const vector position=vector::origin()) const
 
color read (const vector p) const
 read one pixel, address specified by vector
 
- Public Member Functions inherited from bmptk::graphics::image
 image ()
 default constructor
 

Protected Member Functions

virtual color checked_read (const vector p) const =0
 get the color of the specified pixel
 

Protected Attributes

vector size
 the size of the (rectangular) block occupied by the objecy
 

Detailed Description

an image that can be read pixel by pixel

An image_pixels is an image, hence it can draw itself in a frame.

Additionally, each pixel of the image_pixels can be read. A concrete child class must implement a checked_read() function that returns the color of the requested pixel. The image_pixels class itself provides a read() function that first checks whether the requested pixel is within the area (otherwise it returns color::transparent) and if so, calls checked_read() to do the real work.

Definition at line 1495 of file graphics.h.

Member Function Documentation

virtual color bmptk::graphics::image_pixels::checked_read ( const vector  p) const
protectedpure virtual

get the color of the specified pixel

This function must be provided by a concrete photo class that depends on the It can assume that the requested pixel is valid (within the photo).

Implemented in bmptk::graphics::char_photo.

virtual void bmptk::graphics::image_pixels::draw ( frame frame,
const vector  position = vector::origin() 
) const
virtual

draw the picture in the frame at the position

The default draw method reads each pixel and writes it in the frame. A concrete image class might provide a more efficient draw method, that draws only the pixels that are not transparent.

Implements bmptk::graphics::image.

color bmptk::graphics::image_pixels::read ( const vector  p) const
inline

read one pixel, address specified by vector

This function will return color::transparent when the requested pixel is outside the image. Otherwise it will call checked_read.

Definition at line 1535 of file graphics.h.


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