// circle image // #include #include "ppm.h" int main( void) { ppm a = ppm_new(500,500); for( int i = 0; i < a.rows; ++i) for( int j = 0; j < a.cols; ++j) { int x = j-250, y = i-250; double d = sqrt(x*x+y*y); // distance from center if( d < 100 ) { // inside the circle a.r[i][j] = 255; a.g[i][j] = a.b[i][j] = 0; // red } else { // outside the circle a.r[i][j] = a.g[i][j] = a.b[i][j] = 255; // white } } ppm_write( a); return 0; }