Source - Sink Model 


With just under 2000 lines of code spread across multiple C and .header files, this Program takes in PNM Files and uses a reader to put the pixels into a buffer contained within an Image class. The Filter class, which inherits from both source and sink, allows us to SetInput(Image* image), and GetOutput() for the seperate filters which inherit from Filter.

Each filter iterates through individual pixels and updates thier value so as to create the desired output.

A main class allows us to then instantiate filters, and get/set thier output/input specifically. 

we use network flow to update the hierarchy of filters applied by calling update() on the last desired filter. If no exceptions are thrown due to Invalid input, or Cyclical Update Flow, The filters update thier inputs and create thier output for the next filter to use. 

Filters Available - Shrinker(takes one input, shrinks it’s dimentions each by half)
                                LRConcat(takes two inputs, stitches them together Left-Tight if the heights match)
                                TBConcat(takes two inputs, stitches them together Top-Bottom if the widthsmatch)
                                Blender(takes two inputs, Blends them by averaging each individual color channel) 
                                Mirror(takes one input, writes the pixel of each column in reverse order to flip)
                                Rotate(writes each row of output by reading through each column of input)
                                Subtract(takes the difference of each color channel for each pixel of two inputs)
                                Grayscale(Calculates the GrayScale of each Pixel, one input)
                                Blur(averages each pixel with the 8 pixels surrounding it) 
                                Solid Color(creates a solid color image given width, height, and RGB values)