Bare Metal Programming Tool Kit
|
an image that can be read pixel by pixel More...
#include <graphics.h>
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 | |
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.
|
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 |
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.
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.