The APNGAsm core class is all you need to assemble and disassemble Animated PNG. More...
#include <apngasm.h>
Public Member Functions | |
APNGAsm (void) | |
Construct an empty APNGAsm object. | |
APNGAsm (const std::vector< APNGFrame > &frames) | |
Construct APNGAsm object from an existing vector of apngasm frames. More... | |
~APNGAsm (void) | |
APNGAsm destructor. !reset() is called here and will destroy the memory for all frames! | |
size_t | addFrame (const std::string &filePath, unsigned delayNum=DEFAULT_FRAME_NUMERATOR, unsigned delayDen=DEFAULT_FRAME_DENOMINATOR) |
Adds a frame from a PNG file or frames from a APNG file to the frame vector. More... | |
size_t | addFrame (const APNGFrame &frame) |
Adds an APNGFrame object to the frame vector. More... | |
APNGAsm & | operator<< (const APNGFrame &frame) |
Adds an APNGFrame object to the frame vector. More... | |
bool | assemble (const std::string &outputPath) |
Assembles and outputs an APNG file. More... | |
const std::vector< APNGFrame > & | disassemble (const std::string &filePath) |
Disassembles an APNG file. More... | |
bool | savePNGs (const std::string &outputDir) const |
Saves individual PNG files of the frames in the frame vector. More... | |
const std::vector< APNGFrame > & | loadAnimationSpec (const std::string &filePath) |
Loads an animation spec from JSON or XML. Loaded frames are added to the end of the frame vector. For more details on animation specs see: https://github.com/Genshin/PhantomStandards. More... | |
bool | saveJSON (const std::string &outputPath, const std::string &imageDir="") const |
Saves a JSON animation spec file. More... | |
bool | saveXML (const std::string &outputPath, const std::string &imageDir="") const |
Saves an XML animation spec file. More... | |
void | setAPNGAsmListener (listener::IAPNGAsmListener *listener=NULL) |
Sets a listener. More... | |
const std::vector< APNGFrame > & | getFrames () const |
Returns the frame vector. More... | |
size_t | frameCount () |
Returns the number of frames. More... | |
size_t | reset () |
Destroy all frames in memory/dispose of the frame vector. Leaves the apngasm object in a clean state. More... | |
const char * | version (void) const |
Returns the version of APNGAsm. More... | |
The APNGAsm core class is all you need to assemble and disassemble Animated PNG.
apngasm::APNGAsm::APNGAsm | ( | const std::vector< APNGFrame > & | frames | ) |
size_t apngasm::APNGAsm::addFrame | ( | const std::string & | filePath, |
unsigned | delayNum = DEFAULT_FRAME_NUMERATOR , |
||
unsigned | delayDen = DEFAULT_FRAME_DENOMINATOR |
||
) |
Adds a frame from a PNG file or frames from a APNG file to the frame vector.
filePath | The relative or absolute path to an image file. |
delayNum | The delay numerator for this frame (defaults to DEFAULT_FRAME_NUMERATOR). |
delayDen | The delay denominator for this frame (defaults to DEFAULT_FRAME_DENMINATOR). |
size_t apngasm::APNGAsm::addFrame | ( | const APNGFrame & | frame | ) |
bool apngasm::APNGAsm::assemble | ( | const std::string & | outputPath | ) |
Assembles and outputs an APNG file.
outputPath | The output file path. |
const std::vector< APNGFrame > & apngasm::APNGAsm::disassemble | ( | const std::string & | filePath | ) |
Disassembles an APNG file.
filePath | The file path to the PNG image to be disassembled. |
size_t apngasm::APNGAsm::frameCount | ( | ) |
Returns the number of frames.
const std::vector< APNGFrame > & apngasm::APNGAsm::getFrames | ( | ) | const |
Returns the frame vector.
const std::vector< APNGFrame > & apngasm::APNGAsm::loadAnimationSpec | ( | const std::string & | filePath | ) |
Loads an animation spec from JSON or XML. Loaded frames are added to the end of the frame vector. For more details on animation specs see: https://github.com/Genshin/PhantomStandards.
filePath | The path to the spec .xml or .json file. |
size_t apngasm::APNGAsm::reset | ( | ) |
Destroy all frames in memory/dispose of the frame vector. Leaves the apngasm object in a clean state.
bool apngasm::APNGAsm::saveJSON | ( | const std::string & | outputPath, |
const std::string & | imageDir = "" |
||
) | const |
Saves a JSON animation spec file.
filePath | Path to save the file to. |
imageDir | Directory where frame files are to be saved if not the same path as the animation spec. |
bool apngasm::APNGAsm::savePNGs | ( | const std::string & | outputDir | ) | const |
Saves individual PNG files of the frames in the frame vector.
fileDir | The directory where the PNG fils will be saved. |
bool apngasm::APNGAsm::saveXML | ( | const std::string & | outputPath, |
const std::string & | imageDir = "" |
||
) | const |
Saves an XML animation spec file.
filePath | Path to save the file to. |
imageDir | Directory where frame files are to be saved if not the same path as the animation spec. |
void apngasm::APNGAsm::setAPNGAsmListener | ( | listener::IAPNGAsmListener * | listener = NULL | ) |
Sets a listener.
listener | A pointer to the listener object. If the argument is NULL a default APNGAsmListener will be created and assigned. |
const char * apngasm::APNGAsm::version | ( | void | ) | const |
Returns the version of APNGAsm.