RGB& pixel(int row, int col) { return *(rgbs + row * hReso + col); }
pixel() does not check the given row and column arguments. Using throw statement, try write another public member function, which checks both underflow and overflow.
RGB& Pixel(int row, int col);
void checkerboard(Canvas& canvas) { for(int row = 0; row < canvas.vReso; row++) for(int col = 0; col < canvas.hReso; col++) { canvas.Pixel(row, col) = (col/32 + row/32) % 2 ? White : Black; } }
Try to download any image file, convert it to ppm format using IrfanView. Then read in the ppm image, and try to do any change you want to the image. After done, write back as another ppm file. Now again use IrfanView to enjoy your own work.
Here are some ideas you may want to try.
1.3.6