Paul Heidmann Fractal Example
1.0
|
This class provides an interface into libpng that is not completely insane (like libpng's native interface). The code in this class is fairly ugly. More...
#include <pngFactory.hpp>
Public Member Functions | |
pngFactory ()=delete | |
pngFactory (const std::uint16_t xResolution, const std::uint16_t yResolution, const std::string &pngOutFileName) | |
This is the constructor that must be used to create instances of this class. More... | |
~pngFactory () | |
The class destructor. More... | |
void | addPixel (const long double x, const long double y, const std::uint8_t red, const std::uint8_t green, const std::uint8_t blue) |
This method is called to add a pixel to the PNG image. More... | |
const std::uint16_t | getXRes (void) const |
This method returns to the caller the horizontal resolution of the image. More... | |
const std::uint16_t | getYRes (void) const |
This method returns to the caller the vertical resolution of the image. More... | |
Private Types | |
typedef std::tuple< long double, long double, std::uint8_t, std::uint8_t, std::uint8_t > | pixelType |
This type is used to define variables that hold single pixels. More... | |
typedef std::uint8_t * | pngRowPtrType |
This type is used to access rows in the PNG image. More... | |
Private Member Functions | |
void | allocatePngImageSpace (void) |
This method allocates space from the heap to hold the PNG image. More... | |
void | deallocatePngImageSpace (void) |
This method deallocates the PNG image space. More... | |
void | writePngFile (void) |
This method writes the PNG image out to disk. More... | |
void | updateMinMax (const png::pngFactory::pixelType &p) |
This method is called to update the minimums and maximums, as tracked by this instance. More... | |
void | findMinMax (void) |
This method is called to determine the minimums and maximums, as tracked by this instance. More... | |
void | translatePixel (png::pngFactory::pixelType &p) const |
This method maps a single pixel from the user specified coordinate plane to pixel space. More... | |
void | translateAllPixels (void) |
This method maps all pixels from the user specified coordinate plane to pixel space. More... | |
void | renderAllPixels (void) |
This method renders all pixels. More... | |
Private Attributes | |
const std::string | pFileName |
This attribute holds the name of the file into which the final PNG image is to placed. More... | |
const std::uint16_t | xRes |
This attribute holds the X resolution of the PNG image. More... | |
const std::uint16_t | yRes |
This attribute holds the Y resolution of the PNG image. More... | |
long double | xMin |
This attribute holds the smallest x coordinate the caller has specified. More... | |
long double | xMax |
This attribute holds the largest x coordinate the caller has specified. More... | |
long double | yMin |
This attribute holds the smallest y coordinate the caller has specified. More... | |
long double | yMax |
This attribute holds the largest y coordinate the caller has specified. More... | |
long double | xTranslationFactor |
This attribute holds the scalar used to translate caller specified x coordinates into the image coordinate space. More... | |
long double | yTranslationFactor |
This attribute holds the scalar used to translate caller specified y coordinates into the image coordinate space. More... | |
std::list < png::pngFactory::pixelType > | pxlLst |
This attribute holds all caller specified pixels. More... | |
png::pngFactory::pngRowPtrType * | pngRowPointers |
This attribute holds a row pointer used to access the PNG image. More... | |
::png_structp | pngStructPtr |
This attribute holds the libpng defined PNG structure used when generating the PNG image. More... | |
::png_infop | pngInfoPtr |
This attribute holds the libpng defined PNG info structure used when generating the PNG image. More... | |
This class provides an interface into libpng that is not completely insane (like libpng's native interface). The code in this class is fairly ugly.
Definition at line 37 of file pngFactory.hpp.
|
private |
This type is used to define variables that hold single pixels.
Definition at line 87 of file pngFactory.hpp.
|
private |
This type is used to access rows in the PNG image.
Definition at line 90 of file pngFactory.hpp.
|
delete |
png::pngFactory::pngFactory | ( | const std::uint16_t | xResolution, |
const std::uint16_t | yResolution, | ||
const std::string & | pngOutFileName | ||
) |
This is the constructor that must be used to create instances of this class.
xResolution | The horizontal resolution of the image. |
yResolution | The vertical resolution of the image. |
pngOutFileName | The filename of the final PNG image. |
Definition at line 26 of file pngFactory.cpp.
References allocatePngImageSpace(), and pxlLst.
png::pngFactory::~pngFactory | ( | ) |
The class destructor.
Definition at line 45 of file pngFactory.cpp.
void png::pngFactory::addPixel | ( | const long double | x, |
const long double | y, | ||
const std::uint8_t | red, | ||
const std::uint8_t | green, | ||
const std::uint8_t | blue | ||
) |
This method is called to add a pixel to the PNG image.
x | The X coordinate of the pixel. |
y | The Y coordinate of the pixel. |
red | The red component of the color of the pixel. |
green | The green component of the color of the pixel. |
blue | The blue component of the color of the pixel. |
Definition at line 54 of file pngFactory.cpp.
|
private |
This method allocates space from the heap to hold the PNG image.
Definition at line 80 of file pngFactory.cpp.
Referenced by pngFactory().
|
private |
This method deallocates the PNG image space.
Definition at line 89 of file pngFactory.cpp.
|
private |
This method is called to determine the minimums and maximums, as tracked by this instance.
Definition at line 154 of file pngFactory.cpp.
References updateMinMax().
const std::uint16_t png::pngFactory::getXRes | ( | void | ) | const |
This method returns to the caller the horizontal resolution of the image.
Definition at line 70 of file pngFactory.cpp.
const std::uint16_t png::pngFactory::getYRes | ( | void | ) | const |
This method returns to the caller the vertical resolution of the image.
Definition at line 75 of file pngFactory.cpp.
|
private |
This method renders all pixels.
Definition at line 187 of file pngFactory.cpp.
|
private |
This method maps all pixels from the user specified coordinate plane to pixel space.
Definition at line 172 of file pngFactory.cpp.
References translatePixel().
|
private |
This method maps a single pixel from the user specified coordinate plane to pixel space.
p | The pixel to translate. |
Definition at line 165 of file pngFactory.cpp.
Referenced by translateAllPixels().
|
private |
This method is called to update the minimums and maximums, as tracked by this instance.
Definition at line 139 of file pngFactory.cpp.
Referenced by findMinMax().
|
private |
This method writes the PNG image out to disk.
Definition at line 96 of file pngFactory.cpp.
|
private |
This attribute holds the name of the file into which the final PNG image is to placed.
Definition at line 94 of file pngFactory.hpp.
|
private |
This attribute holds the libpng defined PNG info structure used when generating the PNG image.
Definition at line 139 of file pngFactory.hpp.
|
private |
This attribute holds a row pointer used to access the PNG image.
Definition at line 131 of file pngFactory.hpp.
|
private |
This attribute holds the libpng defined PNG structure used when generating the PNG image.
Definition at line 135 of file pngFactory.hpp.
|
private |
This attribute holds all caller specified pixels.
Definition at line 127 of file pngFactory.hpp.
Referenced by pngFactory().
|
private |
This attribute holds the largest x coordinate the caller has specified.
Definition at line 108 of file pngFactory.hpp.
|
private |
This attribute holds the smallest x coordinate the caller has specified.
Definition at line 104 of file pngFactory.hpp.
|
private |
This attribute holds the X resolution of the PNG image.
Definition at line 97 of file pngFactory.hpp.
|
private |
This attribute holds the scalar used to translate caller specified x coordinates into the image coordinate space.
Definition at line 120 of file pngFactory.hpp.
|
private |
This attribute holds the largest y coordinate the caller has specified.
Definition at line 116 of file pngFactory.hpp.
|
private |
This attribute holds the smallest y coordinate the caller has specified.
Definition at line 112 of file pngFactory.hpp.
|
private |
This attribute holds the Y resolution of the PNG image.
Definition at line 100 of file pngFactory.hpp.
|
private |
This attribute holds the scalar used to translate caller specified y coordinates into the image coordinate space.
Definition at line 124 of file pngFactory.hpp.