#include <windows.h>
#include "common.h"

Image_data * Negate(Image_data *piData)
{
	int i, numpixels;
	Image_data *pproData;

// ----------- Memory allocation stuff --------------//

	pproData = malloc(sizeof(Image_data));
	pproData->image_G_ptr = malloc(piData->n_rows * piData->n_cols);
	pproData->n_cols = piData->n_cols;
	pproData->n_rows = piData->n_rows;
	lstrcpy(pproData->filename, "Negated Image");

// -------------------------------------------------//


	numpixels = piData->n_rows * piData->n_cols;

	for (i = 0; i < numpixels; i++)
		pproData->image_G_ptr[i] = 255 - piData->image_G_ptr[i];

	return pproData;

}