/****************************************************************************** * FILE: simple_image.cc * A simple example of generating an image file. * * Author: Dana Vrajitoru, IUSB * Class: C481 B581 Computer Graphics ******************************************************************************/ #include using namespace std; const int WIDTH = 200, HEIGHT = 200; // prototypes void Set_pixel(short r, short g, short b, int x, int y); void Write_ppm(char *filename); void Make_vertical_gradient(short r1, short g1, short b1, short r2, short g2, short b2); // The image itself as a global object short r_matrix[HEIGHT][WIDTH], g_matrix[HEIGHT][WIDTH], b_matrix[HEIGHT][WIDTH]; int main() { //Fill the image with a horizontal gradient between red and blue. Make_vertical_gradient(255, 0, 0, 0, 0, 255); Write_ppm("red2blue.ppm"); } // Fill the image with a horizontal gradient. void Make_vertical_gradient(short r1, short g1, short b1, short r2, short g2, short b2) { short r, g, b; for (int y=0; y