|
MP 2
Image Manipulation II
|
A subclass of PNG with more member functions for modifying the image. More...
#include "image.h"
Inheritance diagram for Image:
Collaboration diagram for Image:Public Member Functions | |
| void | flipleft () |
| Flips the image about a vertical line through its center by swapping pixels. More... | |
| void | adjustbrightness (int r, int g, int b) |
| Adds to the red, green, and blue parts of each pixel in the image. More... | |
| void | invertcolors () |
| Makes each RGB component of each pixel iequal to 255 minus its original value. More... | |
Public Member Functions inherited from PNG | |
| PNG () | |
| Creates a default PNG image (that is, a 1x1 opaque white image). More... | |
| PNG (size_t width, size_t height) | |
| Creates a default PNG image of the desired dimensions (that is, a width x height opaque white image). More... | |
| PNG (string const &file_name) | |
| Creates a PNG image by reading a file in from disk. 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... | |
| RGBAPixel * | operator() (size_t x, size_t y) |
| Non-const pixel access operator. More... | |
| RGBAPixel const * | operator() (size_t x, size_t y) const |
| Const pixel access operator. More... | |
| bool | readFromFile (string const &file_name) |
| Reads in a PNG image from a file. More... | |
| bool | writeToFile (string const &file_name) |
| Writes a PNG image to a file. More... | |
| size_t | width () const |
| Gets the width of this image. More... | |
| size_t | height () const |
| Gets the height of this image. More... | |
| void | resize (size_t width, size_t height) |
| Resizes the image to the given coordinates. More... | |
A subclass of PNG with more member functions for modifying the image.
| void Image::flipleft | ( | ) |
Flips the image about a vertical line through its center by swapping pixels.
| void Image::adjustbrightness | ( | int | r, |
| int | g, | ||
| int | b | ||
| ) |
Adds to the red, green, and blue parts of each pixel in the image.
| r | the amount to adjust the red value by |
| g | the amount to adjust the green value by |
| b | the amount to adjust the blue value by |
| void Image::invertcolors | ( | ) |
Makes each RGB component of each pixel iequal to 255 minus its original value.
That is, the colors become the opposite of what they were, makeing a color-opposite of the original image.