lab_intro
Ineluctable Introduction
|
Declarations of image manipulation functions. More...
Functions | |
cs225::PNG | grayscale (cs225::PNG image) |
Returns an image that has been transformed to grayscale. More... | |
cs225::PNG | createSpotlight (cs225::PNG image, int centerX, int centerY) |
Returns an image with a spotlight centered at (centerX , centerY ). More... | |
cs225::PNG | illinify (cs225::PNG image) |
Returns a image transformed to Illini colors. More... | |
cs225::PNG | watermark (cs225::PNG firstImage, cs225::PNG secondImage) |
Returns an immge that has been watermarked by another image. More... | |
Declarations of image manipulation functions.
cs225::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.
image | A PNG object which holds the image data to be modified. |
centerX | The center x coordinate of the crosshair which is to be drawn. |
centerY | The center y coordinate of the crosshair which is to be drawn. |
cs225::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.
This function is already written for you so you can see how to interact with our PNG class.
cs225::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.
image | A PNG object which holds the image data to be modified. |
cs225::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.
firstImage | The first of the two PNGs to be averaged together. |
secondImage | The second of the two PNGs to be averaged together. |