29 #include "nomlib/graphics/Pixel.hpp"
33 Pixel::Pixel (
void ) {}
35 Pixel::~Pixel (
void ) {}
37 Pixel::Pixel (
const Coords& coords,
const Color& color )
39 this->coords = coords;
43 Pixel::Pixel ( int32 x, int32 y,
const Color& color )
45 this->coords = Coords ( x, y );
49 void Pixel::Update (
void ) {}
56 switch ( video_buffer->format->BytesPerPixel )
60 NOM_LOG_ERR ( NOM,
"Could not determine color depth -- aborting call." );
67 uint8* pixels =
static_cast<uint8*
> ( video_buffer->pixels );
68 uint32 pixel_color = RGB ( this->color, video_buffer->format );
70 pixels[ ( this->coords.y * video_buffer->pitch ) + this->coords.x ] = pixel_color;
76 uint16* pixels =
static_cast<uint16*
> ( video_buffer->pixels );
77 uint32 pixel_color = RGB ( this->color, video_buffer->format );
79 pixels[ ( this->coords.y * video_buffer->pitch/2 ) + this->coords.x ] = pixel_color;
85 uint8* pixels =
static_cast<uint8*
> ( video_buffer->pixels );
86 uint32 pixel_color = RGB ( this->color, video_buffer->format );
88 pixels[ ( this->coords.y * video_buffer->pitch ) + this->coords.x ] = pixel_color;
89 *(pixels + video_buffer->format->Rshift/8 ) = this->color.red;
90 *(pixels + video_buffer->format->Gshift/8 ) = this->color.green;
91 *(pixels + video_buffer->format->Bshift/8 ) = this->color.blue;
98 uint32* pixels =
static_cast<uint32*
> ( video_buffer->pixels );
99 uint32 pixel_color = RGB ( this->color, video_buffer->format );
101 pixels[ ( this->coords.y * video_buffer->pitch/4 ) + this->coords.x ] = pixel_color;
void Draw(SDL_Surface *video_buffer) const