/** * Names: Luke Whipple and Colton Johnson and David Dubchakov * * Some image manioulation functions for an array of pixels */ #include #include #include #define STB_IMAGE_IMPLEMENTATION #include "stb_image.h" #define STB_IMAGE_WRITE_IMPLEMENTATION #include "stb_image_write.h" #include "imageUtils.h" Pixel **loadImage(const char *filePath, int *height, int *width) { int x,y,n; unsigned char *data = stbi_load(filePath, &x, &y, &n, 4); //4 = force RGBA channels *height = y; *width = x; //contiguous allocation: Pixel **image = (Pixel **)malloc(sizeof(Pixel *) * y); image[0] = (Pixel *)malloc(sizeof(Pixel) * (y * x)); for(int i=1; i