mp_stickers
Shocking Stickers
|
A subclass of PNG with more member functions for modifying the image. More...
#include <Image.h>
Public Member Functions | |
Image () | |
Creates an empty Image. More... | |
Image (unsigned int width, unsigned int height) | |
Creates an Image of the specified dimensions. More... | |
void | lighten () |
Lighten an Image by increasing the luminance of every pixel by 0.1. More... | |
void | lighten (double amount) |
Lighten an Image by increasing the luminance of every pixel by amount . More... | |
void | darken () |
Darken an Image by decreasing the luminance of every pixel by 0.1. More... | |
void | darken (double amount) |
Darkens an Image by decreasing the luminance of every pixel by amount . More... | |
void | saturate () |
Saturates an Image by increasing the saturation of every pixel by 0.1. More... | |
void | saturate (double amount) |
Saturates an Image by increasing the saturation of every pixel by amount . More... | |
void | desaturate () |
Desaturates an Image by decreasing the saturation of every pixel by 0.1. More... | |
void | desaturate (double amount) |
Desaturates an Image by decreasing the saturation of every pixel by amount . More... | |
void | grayscale () |
Turns the image grayscale. More... | |
void | rotateColor (double degrees) |
Rotates the color wheel by degrees . More... | |
void | illinify () |
Illinify the image. More... | |
void | scale (double factor) |
Scale the Image by a given factor . More... | |
void | scale (unsigned w, unsigned h) |
Scales the image to fit within the size (w x h ). More... | |
Public Member Functions inherited from cs225::PNG | |
PNG () | |
Creates an empty PNG image. More... | |
PNG (unsigned int width, unsigned int height) | |
Creates a PNG image of the specified dimensions. More... | |
PNG (PNG const &other) | |
Copy constructor: creates a new PNG image that is a copy of another. More... | |
~PNG () | |
Destructor: frees all memory associated with a given PNG object. More... | |
PNG const & | operator= (PNG const &other) |
Assignment operator for setting two PNGs equal to one another. More... | |
bool | operator== (PNG const &other) const |
Equality operator: checks if two images are the same. More... | |
bool | operator!= (PNG const &other) const |
Inequality operator: checks if two images are different. More... | |
bool | readFromFile (string const &fileName) |
Reads in a PNG image from a file. More... | |
bool | writeToFile (string const &fileName) |
Writes a PNG image to a file. More... | |
HSLAPixel & | getPixel (unsigned int x, unsigned int y) |
Pixel access operator. More... | |
const HSLAPixel & | getPixel (unsigned int x, unsigned int y) const |
Pixel access operator. More... | |
unsigned int | width () const |
Gets the width of this image. More... | |
unsigned int | height () const |
Gets the height of this image. More... | |
void | resize (unsigned int newWidth, unsigned int newHeight) |
Resizes the image to the given coordinates. More... | |
A subclass of PNG with more member functions for modifying the image.
|
inline |
Creates an empty Image.
|
inline |
Creates an Image of the specified dimensions.
width | Width of the new image. |
height | Height of the new image. |
void Image::darken | ( | ) |
Darken an Image by decreasing the luminance of every pixel by 0.1.
This function ensures that the luminance remains in the range [0, 1].
void Image::darken | ( | double | amount | ) |
Darkens an Image by decreasing the luminance of every pixel by amount
.
This function ensures that the luminance remains in the range [0, 1].
amount | The desired decrease in luminance. |
void Image::desaturate | ( | ) |
Desaturates an Image by decreasing the saturation of every pixel by 0.1.
This function ensures that the saturation remains in the range [0, 1].
void Image::desaturate | ( | double | amount | ) |
Desaturates an Image by decreasing the saturation of every pixel by amount
.
This function ensures that the saturation remains in the range [0, 1].
amount | The desired decrease in saturation. |
void Image::grayscale | ( | ) |
Turns the image grayscale.
void Image::illinify | ( | ) |
Illinify the image.
void Image::lighten | ( | ) |
Lighten an Image by increasing the luminance of every pixel by 0.1.
This function ensures that the luminance remains in the range [0, 1].
void Image::lighten | ( | double | amount | ) |
Lighten an Image by increasing the luminance of every pixel by amount
.
This function ensures that the luminance remains in the range [0, 1].
amount | The desired increase in luminance. |
void Image::rotateColor | ( | double | degrees | ) |
Rotates the color wheel by degrees
.
Rotating in a positive direction increases the degree of the hue. This function ensures that the hue remains in the range [0, 360].
degrees | The desired amount of rotation. |
void Image::saturate | ( | ) |
Saturates an Image by increasing the saturation of every pixel by 0.1.
This function ensures that the saturation remains in the range [0, 1].
void Image::saturate | ( | double | amount | ) |
Saturates an Image by increasing the saturation of every pixel by amount
.
This function ensures that the saturation remains in the range [0, 1].
amount | The desired increase in saturation. |
void Image::scale | ( | double | factor | ) |
Scale the Image by a given factor
.
For example:
factor
of 1.0 does not change the image.factor
of 0.5 results in an image with half the width and half the height.factor
of 2 results in an image with twice the width and twice the height.This function both resizes the Image and scales the contents.
factor | Scale factor. |
void Image::scale | ( | unsigned | w, |
unsigned | h | ||
) |
Scales the image to fit within the size (w
x h
).
This function preserves the aspect ratio of the image, so the result will always be an image of width w
or of height h
(not necessarily both).
For example, if the Image is currently (10, 20) and we want to scale to (100, 100), then this should scale the Image to (50, 100). Note that scaling the image to (100, 200) does not fit within the (100,100) dimensions given and is therefore incorrect.
This function both resizes the Image and scales the contents.