// bitmap.cpp: implementation of the Cbitmap class. // ////////////////////////////////////////////////////////////////////// #include "bitmap.h" #include ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// CBitmap::CBitmap() { SizeX = 1; SizeY = 1; r = new CMatrix(); g = new CMatrix(); b = new CMatrix(); printf("CBitmap class (new bitmap): succesfull...\n"); } CBitmap::~CBitmap() { delete r; delete g; delete b; } CBitmap::CBitmap(int x, int y) { SizeX = x; SizeY = y; r = new CMatrix(x, y); g = new CMatrix(x, y); b = new CMatrix(x, y); printf("CBitmap class (new bitmap %d x %d): succesfull...\n", x, y); } CBitmap::SetPixel(int x, int y, unsigned int color) { r->SetXY(x, y, (unsigned char)(color & 0x0000FF)); g->SetXY(x, y, (unsigned char)((color & 0x00FF00) >> 8)); b->SetXY(x, y, (unsigned char)((color & 0xFF0000) >> 16)); } unsigned int CBitmap::GetPixel(int x, int y) { return (r->GetXY(x, y) + (g->GetXY(x, y) << 8) + (b->GetXY(x, y) << 16)); } int CBitmap::GetSizeX() { return SizeX; } int CBitmap::GetSizeY() { return SizeY; }