version 3.3

VRS::AnimatedGifMaker Class Reference

Writer for "Animated Gif" files. More...

#include <vrs/image/animatedgifmaker.h>

Inheritance diagram for VRS::AnimatedGifMaker:

VRS::LeafBehavior VRS::BehaviorNode VRS::SharedObj VRS::Visitable

List of all members.

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
GLCanvascanvas () const
const std::string & filename () const
float frameRate () const
int currentFrameNo () const
 VRS_TYPEINFO (AnimatedGifMaker, BehaviorNode)


Detailed Description

Writer for "Animated Gif" files.

Constructor & Destructor Documentation

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.


Member Function Documentation

virtual BehaviorNode::InvalidationHint VRS::AnimatedGifMaker::handle ( Event event  )  [virtual]

next frame is recorded if 1.0/framerate time has passed

Implements VRS::BehaviorNode.

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   
)


The documentation for this class was generated from the following file:

Generated on Fri May 18 06:00:19 2012 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact