lab_intro
Ineluctable Introduction
Functions
main.cpp File Reference

A simple C++ program that manipulates an image. More...

#include <algorithm>
#include <iostream>
#include "rgbapixel.h"
#include "png.h"

Functions

PNG drawCrosshairs (PNG original, int centerX, int centerY, RGBAPixel color)
 This function accepts a PNG object, two integer coordinates and a color, and proceeds to draw a horizontal line across the image at the y coordinate and a vertical line down the image at the x coordinage using the given color. More...
 
PNG brighten (PNG original, int amount)
 This function brightens a rectangle of a PNG, increasing the components (red, green, blue) of each pixel by the given amount. More...
 
PNG blendImages (PNG firstImage, PNG secondImage)
 This function blends, or averages, two PNGs together. More...
 
int main ()
 The main function in this program (the starting point of the execution of our code). More...
 

Detailed Description

A simple C++ program that manipulates an image.

Function Documentation

PNG drawCrosshairs ( PNG  original,
int  centerX,
int  centerY,
RGBAPixel  color 
)

This function accepts a PNG object, two integer coordinates and a color, and proceeds to draw a horizontal line across the image at the y coordinate and a vertical line down the image at the x coordinage using the given color.

The modified PNG is then returned.

Parameters
originalA PNG object which holds the image data to be modified.
centerXThe center x coordinate of the crosshair which is to be drawn.
centerYThe center y coordinate of the crosshair which is to be drawn.
colorThe color of the lines to be drawn.
Returns
The image on which a crosshair has been drawn.

This function is already written for you so you can see how to interact with our PNG class.

PNG brighten ( PNG  original,
int  amount 
)

This function brightens a rectangle of a PNG, increasing the components (red, green, blue) of each pixel by the given amount.

You must account for potential overflow issues (color components can only store numbers between 0 and 255). If you attempt to store a value greater than 255 into a color component, the result will wrap around (and you won't be able to check if it was greater than 255).

Parameters
originalA PNG object which holds the image data to be modified.
amountThe integer amount by which to increase each pixel's components.
Returns
The brightened image.

You can assume amount is positive.

PNG blendImages ( PNG  firstImage,
PNG  secondImage 
)

This function blends, or averages, two PNGs together.

That is, each pixel in the returned image consists of the averaged components (red, green, blue) of the two input images.

Parameters
firstImageThe first of the two PNGs to be averaged together.
secondImageThe second of the two PNGs to be averaged together.
Returns
The averaged image.
int main ( )

The main function in this program (the starting point of the execution of our code).

Returns
An integer indicating whether execution was successful.