lab_intro
Ineluctable Introduction
lab_intro.cpp File Reference

Implementations of image manipulation functions. More...

Functions

PNG grayscale (PNG image)
 Returns an image that has been transformed to grayscale. More...
 
PNG createSpotlight (PNG image, int centerX, int centerY)
 Returns an image with a spotlight centered at (centerX, centerY). More...
 
PNG illinify (PNG image)
 Returns a image transformed to Illini colors. More...
 
PNG watermark (PNG firstImage, PNG secondImage)
 Returns an immge that has been watermarked by another image. More...
 

Detailed Description

Implementations of image manipulation functions.

Function Documentation

◆ createSpotlight()

PNG createSpotlight ( PNG  image,
int  centerX,
int  centerY 
)

Returns an image with a spotlight centered at (centerX, centerY).

A spotlight adjusts the luminance of a pixel based on the distance the pixel is away from the center by decreasing the luminance by 0.5% per 1 pixel euclidean distance away from the center.

For example, a pixel 3 pixels above and 4 pixels to the right of the center is a total of sqrt((3 * 3) + (4 * 4)) = sqrt(25) = 5 pixels away and its luminance is decreased by 2.5% (0.975x its original value). At a distance over 160 pixels away, the luminance will always decreased by 80%.

The modified PNG is then returned.

Parameters
imageA 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.
Returns
The image with a spotlight.

◆ grayscale()

PNG grayscale ( PNG  image)

Returns an image that has been transformed to grayscale.

The saturation of every pixel is set to 0, removing any color.

Returns
The grayscale image.

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

◆ illinify()

PNG illinify ( PNG  image)

Returns a image transformed to Illini colors.

The hue of every pixel is set to the a hue value of either orange or blue, based on if the pixel's hue value is closer to orange than blue.

Parameters
imageA PNG object which holds the image data to be modified.
Returns
The illinify'd image.

◆ watermark()

PNG watermark ( PNG  firstImage,
PNG  secondImage 
)

Returns an immge that has been watermarked by another image.

The luminance of every pixel of the second image is checked, if that pixel's luminance is 1 (100%), then the pixel at the same location on the first image has its luminance increased by 0.2.

Parameters
firstImageThe first of the two PNGs to be averaged together.
secondImageThe second of the two PNGs to be averaged together.
Returns
The watermarked image.