// Matrix.cpp: implementation of the Matrix class. // ////////////////////////////////////////////////////////////////////// #include "Matrix.h" #include ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// CMatrix::CMatrix() { Elements = new unsigned char *[1]; Elements[0] = new unsigned char [1]; SizeX = 1; SizeY = 1; Elements[0][0] = 0; printf("CMatrix class (new matrix): succesfull...\n"); } CMatrix::~CMatrix() { delete Elements; } unsigned char CMatrix::GetXY(int x, int y) { if (x>=0 && y>= 0 && x < SizeX && y < SizeY) { return Elements[x][y]; }else{ return 0; } } int CMatrix::SetXY(int x, int y, unsigned char color) { if (x>=0 && y>= 0 && x < SizeX && y < SizeY) { Elements[x][y] = color; return 1; }else{ return 0; } } int CMatrix::GetSizeX() { return SizeX; } int CMatrix::GetSizeY() { return SizeY; } CMatrix::CMatrix(int x, int y) { Elements = new unsigned char *[x]; for (int i = 0; i < x; i ++) Elements[i] = new unsigned char [y]; SizeX = x; SizeY = y; printf("CMatrix class (new matrix %d x %d): succesfull...\n", x, y); for (i=0; i