/*
 * =====================================================================================
 *         Name:  Mac Howe, Pmhowe@clemson.edu
 *         Date:  11/15/2022 
 *  Lab Section:  7  
 *         Lab#:  11
 *  Description:  writePixels function writes the pixles from memory to stdout
 * 				  halfSizeWritePixels function writes the pixles from memory to stdout
 * 				  with half the columns and rows
 *
 *
 * =====================================================================================
 */

#include "defs.h"
void writePixels(pixel_t *p, int height, int width){
	for (int i=0; i<height * width; i++) {
      fprintf(stdout, "%i %i %i\n",
         p[i].red, p[i].green, p[i].blue);
	}
}


void halfSizeWritePixels(pixel_t *p, int height, int width, FILE *out){
	int x =0;
	for (int i=0; i<height; i += 2){
		for (int j=0; j<width; j +=2){	
			fprintf(out, "%i %i %i\n",
        		p[x+j].red, p[x+j].green, p[x+j].blue);}
		x += width*2;}
}
