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

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

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.

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

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