MP 2
Image Manipulation II
Image Class Reference

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

#include "Image.h"

Inherits PNG.

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

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

Parameters
amountThe desired increase in luminance.
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].

Parameters
amountThe desired decrease in luminance.
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].

Parameters
amountThe desired increase in saturation.
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].

Parameters
amountThe desired decrease in saturation.
void Image::grayscale ( )

Turns the image grayscale.

void Image::rotateColor ( double  degrees)

Rotates the color wheel by degrees.

This function ensures that the hue remains in the range [0, 360].

Parameters
degreesThe desired amount of rotation.
void Image::illinify ( )

Illinify the image.

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