// Cameron Scott
// October 25, 2022
// Lab #9A, Section 002
// This program prints a ppm image of the Irish Flag using functions 
// to fill the array with the corresponding colors.
//

#include "defs.h"

//Filling the arary with corresponding colors
void fillFlagArray(pixel colorArray[], int width, int height) {
	pixel pixel_t;
	int k = 0;
	int j;
	int i;
	// Nested For loops
	for( i = 0; i < height; i++) {
		for(j = 0; j < width / 3; j++) {
			pixel_t.r = 0;
			pixel_t.g = 128;
			pixel_t.b = 0;
			colorArray[k++] = pixel_t;
		}
		for (; j < (2*width/3); j++) {
			pixel_t.r = 255;
			pixel_t.g = 255;
			pixel_t.b = 255;
			colorArray[k++] = pixel_t;
		}
		for(; j < width; j++) {
			pixel_t.r = 255;
			pixel_t.g = 165;
			pixel_t.b = 0;
			colorArray[k++] = pixel_t;
		}

	}
	return;
}
