mp_stickers
Shocking Stickers
Image Class Reference

A subclass of PNG with more member functions for modifying the image. More...

#include <Image.h>

Inheritance diagram for Image:
[legend]
Collaboration diagram for Image:
[legend]

Public Member Functions

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...
 
HSLAPixelgetPixel (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...
 

Detailed Description

A subclass of PNG with more member functions for modifying the image.

Member Function Documentation

◆ darken() [1/2]

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].

◆ darken() [2/2]

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].

Parameters
amountThe desired decrease in luminance.

◆ desaturate() [1/2]

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].

◆ desaturate() [2/2]

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].

Parameters
amountThe desired decrease in saturation.

◆ grayscale()

void Image::grayscale ( )

Turns the image grayscale.

◆ illinify()

void Image::illinify ( )

Illinify the image.

◆ lighten() [1/2]

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].

◆ lighten() [2/2]

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].

Parameters
amountThe desired increase in luminance.

◆ rotateColor()

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].

Parameters
degreesThe desired amount of rotation.

◆ saturate() [1/2]

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].

◆ saturate() [2/2]

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].

Parameters
amountThe desired increase in saturation.

◆ scale() [1/2]

void Image::scale ( double  factor)

Scale the Image by a given factor.

For example:

  • A factor of 1.0 does not change the iamge.
  • A factor of 0.5 results in an image with half the width and half the height.
  • A 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.

Parameters
factorScale factor.

◆ scale() [2/2]

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).

This function both resizes the Image and scales the contents.

Parameters
wDesired width of the scaled Iamge
hDesired height of the scaled Image

The documentation for this class was generated from the following files: