| VRS - The Virtual Rendering System |
| version 3.3 |
#include <vrs/image/animatedgifmaker.h>

Public Member Functions | |
| AnimatedGifMaker (GLCanvas *masterCanvas) | |
| AnimatedGifMaker (GLCanvas *masterCanvas, const std::string &filename, float frameRate=5) | |
| virtual | ~AnimatedGifMaker () |
| virtual BehaviorNode::InvalidationHint | handle (Event *event) |
| next frame is recorded if 1.0/framerate time has passed | |
| void | open (const std::string &filename, float frameRate=5) |
| Open sets filename and framerate. | |
| void | close () |
| closes Gif stream | |
| bool | isOpen () const |
| check if Gif stream is opened | |
| void | setConstantPalette (ColorPalette *tab=0) |
| prepare one constant palette and use it for following frames | |
| void | setConstantPalette (int numColors) |
| prepare one constant palette of length numColors and use it for following frames | |
| void | useDynamicPalette (int numColors=256) |
| use for all following frames a dynamically generated palette of length numColors | |
| void | useConstantPalette () |
| use the prepared constant palette for all following frames | |
| void | setSize (int width, int height) |
| set size of recorded images | |
| void | setRepeatCount (int repeat=0) |
| set repeat count for resulting animated gif file | |
| GLCanvas * | canvas () const |
| const std::string & | filename () const |
| float | frameRate () const |
| int | currentFrameNo () const |
| VRS_TYPEINFO (AnimatedGifMaker, BehaviorNode) | |
| VRS::AnimatedGifMaker::AnimatedGifMaker | ( | GLCanvas * | masterCanvas | ) |
| VRS::AnimatedGifMaker::AnimatedGifMaker | ( | GLCanvas * | masterCanvas, | |
| const std::string & | filename, | |||
| float | frameRate = 5 | |||
| ) |
| virtual VRS::AnimatedGifMaker::~AnimatedGifMaker | ( | ) | [virtual] |
The default constructor creates an empty gif stream object. Use open to create the actual gif stream. The second constructor of the AnimatedGifMaker expects the animated gif file name and the frame rate at which that animation should be played later. The AnimatedGifMaker state is inactive at default.
| virtual BehaviorNode::InvalidationHint VRS::AnimatedGifMaker::handle | ( | Event * | event | ) | [virtual] |
| void VRS::AnimatedGifMaker::open | ( | const std::string & | filename, | |
| float | frameRate = 5 | |||
| ) |
Open sets filename and framerate.
Actual recording starts if AnimatedGifMaker is activated via Canvas::switchOn(...) and stops by calling Canvas::swichOff(...). If AnimatedGifMaker is already active, record starts immediately. A Constant palette based upon first frame is resetted.
| void VRS::AnimatedGifMaker::close | ( | ) |
closes Gif stream
if AnimatedGifMaker is still active, it will be switched off and a global palette is deleted.
| bool VRS::AnimatedGifMaker::isOpen | ( | ) | const |
check if Gif stream is opened
| void VRS::AnimatedGifMaker::setConstantPalette | ( | ColorPalette * | tab = 0 |
) |
prepare one constant palette and use it for following frames
this property can be set only before first frame is recorded. if tab==0 a palette is generated for first frame and used throughout whole clip (256 colors). Else the specified palette is used.
| void VRS::AnimatedGifMaker::setConstantPalette | ( | int | numColors | ) |
prepare one constant palette of length numColors and use it for following frames
this property can be set only before first frame is recorded. a palette of length numColors is generated for first frame and used throughout whole clip.
numColors can take any value between 1 and 256. But powers of 2 are recommended because gif palettes are always powers of 2, thus for example 34 colors do not reduce resulting file size compared to 64 colors.
Advantages of constant palette include smaller file size and the possiblity to "handcraft" a palette. Disadvantages are dithering artifacts which are reduced by using dynamic palettes.
| void VRS::AnimatedGifMaker::useDynamicPalette | ( | int | numColors = 256 |
) |
use for all following frames a dynamically generated palette of length numColors
this property can be set anytime. For remark regarding numColors and palette use see setConstantPalette().
| void VRS::AnimatedGifMaker::useConstantPalette | ( | ) |
use the prepared constant palette for all following frames
this property can be set anytime. If no constant palette is prepared via setConstantPalette() this call is ignored.
| void VRS::AnimatedGifMaker::setSize | ( | int | width, | |
| int | height | |||
| ) |
set size of recorded images
callable only before first frame is captured. width==0 or height==0 means original size.
By using this function you can reduce resolution and thus file size dramatically, although it is recommended to reduce original canvas size instead of setSize() due to aliasing artifacts.
| void VRS::AnimatedGifMaker::setRepeatCount | ( | int | repeat = 0 |
) |
set repeat count for resulting animated gif file
callable only before first frame is captured. If repeat == 0 animated gif file is looped forever
| GLCanvas * VRS::AnimatedGifMaker::canvas | ( | ) | const [inline] |
| const std::string & VRS::AnimatedGifMaker::filename | ( | ) | const [inline] |
| float VRS::AnimatedGifMaker::frameRate | ( | ) | const [inline] |
| int VRS::AnimatedGifMaker::currentFrameNo | ( | ) | const [inline] |
| VRS::AnimatedGifMaker::VRS_TYPEINFO | ( | AnimatedGifMaker | , | |
| BehaviorNode | ||||
| ) |