diff --git a/filter.c b/filter.c index 730984e..581933a 100644 --- a/filter.c +++ b/filter.c @@ -7,7 +7,7 @@ int main(int argc, char *argv[]) { // Define allowable filters - char *filters = "bgrs"; + char *filters = "bgrsi"; // Get filter flag and check validity char filter = getopt(argc, argv, filters); @@ -119,6 +119,12 @@ int main(int argc, char *argv[]) case 's': sepia(height, width, image); break; + + //invert + case 'i': + invert(height,width,image); + break; + } // Write outfile's BITMAPFILEHEADER diff --git a/filter.exe b/filter.exe index e59f119..0af448e 100644 Binary files a/filter.exe and b/filter.exe differ diff --git a/helpers.c b/helpers.c index b5b9258..8275ef6 100644 --- a/helpers.c +++ b/helpers.c @@ -1,13 +1,53 @@ #include "helpers.h" - +int min(int a,int b){ + if(ab) return a; + return b; +} void grayscale(int height, int width, RGBTRIPLE image[height][width]){ - + return; + // Convert image to grayscale } +void invert(int height, int width, RGBTRIPLE image[height][width]){ + for(int i = 0; i