sswf::TagImage Class Reference

#include <libsswf.h>

Inheritance diagram for sswf::TagImage:

sswf::TagBaseID sswf::TagBase sswf::MemoryManager List of all members.

Public Types

 IMAGE_FORMAT_JPEG
 IMAGE_FORMAT_LOSSLESS_16
 IMAGE_FORMAT_LOSSLESS_32
 IMAGE_FORMAT_LOSSLESS_8
 IMAGE_FORMAT_LOSSLESS_BEST
 IMAGE_FORMAT_max
enum  image_format_t {
  IMAGE_FORMAT_UNKNOWN = 0, IMAGE_FORMAT_LOSSLESS_BEST, IMAGE_FORMAT_LOSSLESS_8, IMAGE_FORMAT_LOSSLESS_16,
  IMAGE_FORMAT_LOSSLESS_32, IMAGE_FORMAT_JPEG, IMAGE_FORMAT_max
}
 IMAGE_FORMAT_UNKNOWN = 0

Public Member Functions

void GetImageData (image_t &image_data)
int LoadJPEG (const char *filename, image_t &im)
int LoadTGA (const char *filename, image_t &im)
virtual ErrorManager::error_code_t Save (Data &data)
 Pre-save all the children tags of this tag.
ErrorManager::error_code_t SaveJPEG (Data &encoding, Data &image)
int SetAlpha (image_t &im, const image_t &mask)
int SetFilename (const char *image, const char *mask)
void SetFormat (image_format_t format)
void SetImage (long width, long height, unsigned char *data, bool alpha=false, long count=0, unsigned char *colormap=0)
void SetQuality (int quality)
 TagImage (TagBase *parent)
virtual swf_type_t TypeFlags (void) const
 Retrieve a set of flags desribing the type of the tag.

Private Member Functions

virtual ErrorManager::error_code_t PreSave (void)
 Pre-save all the children tags of this tag.

Private Attributes

unsigned char * f_colormap
long f_count
image_format_t f_format
image_t f_image
int f_quality

Classes

struct  image_t

Member Enumeration Documentation

enum sswf::TagImage::image_format_t

Enumerator:
IMAGE_FORMAT_UNKNOWN 
IMAGE_FORMAT_LOSSLESS_BEST 
IMAGE_FORMAT_LOSSLESS_8 
IMAGE_FORMAT_LOSSLESS_16 
IMAGE_FORMAT_LOSSLESS_32 
IMAGE_FORMAT_JPEG 
IMAGE_FORMAT_max 


Constructor & Destructor Documentation

TagImage::TagImage ( TagBase parent  ) 


Member Function Documentation

void sswf::TagImage::GetImageData ( image_t image_data  )  [inline]

int TagImage::LoadJPEG ( const char *  filename,
image_t im 
)

int TagImage::LoadTGA ( const char *  filename,
image_t im 
)

ErrorManager::error_code_t TagImage::PreSave ( void   )  [private, virtual]

This function calls the PreSave() function of all the children unless one returns a non-zero value in which case that value will be returned and the process stopped.

This function is aumatically called by the TagHeader and TagSprite in order to pre-save their children.

The PreSave() functions are expected to be used to test whether a tag can be saved. Especially, most tags will call the MinimumVersion() function with the version required to save these tags. This ensures that you can save the entire movie in a valid SWF. Please, see the reference of each tag for more information about what their PreSave() function does.

You should not have to call this function directly.

Returns:
Zero if the PreSave() succeeds; non-zero otherwise

Reimplemented from sswf::TagBase.

ErrorManager::error_code_t TagImage::Save ( Data data  )  [virtual]

The Save() function is the one you want to call to save an SWF movie.

You may use the Save() on any tag, however, if you do so you need to properly initialize the system. For that purpose, you may want to look at the code in the TagHeader::Save(Data& data) function.

Otherwise, you simply have to call the Save() function of the TagHeader. That will save the entire movie with the smallest possible version (or fail if something cannot be saved with the present parameters.)

The TagHeader::Save() function first calls the PreSave() functions, the PreSave2ndPass() and then the Save() functions of all the children.

The other tag Save() function simply save the tag within the specified Data buffer. Note however that the TagSprite will also call the Save() function of all of its children. Yet it does not call the PreSave() functions.

The Save() function saves the movie in a Data buffer. Later you need to save that buffer on disk or some other medium.

Returns:
Zero when the Save() succeeds, non-zero if it fails
See also:
TagBase::PreSave()

TagBase::PreSave2ndPass()

Implements sswf::TagBase.

ErrorManager::error_code_t TagImage::SaveJPEG ( Data encoding,
Data image 
)

int TagImage::SetAlpha ( image_t im,
const image_t mask 
)

int TagImage::SetFilename ( const char *  image,
const char *  mask 
)

void sswf::TagImage::SetFormat ( image_format_t  format  )  [inline]

void TagImage::SetImage ( long  width,
long  height,
unsigned char *  data,
bool  alpha = false,
long  count = 0,
unsigned char *  colormap = 0 
)

void sswf::TagImage::SetQuality ( int  quality  )  [inline]

TagBase::swf_type_t TagImage::TypeFlags ( void   )  const [virtual]

This function returns some flags that can be used to know where to place a tag in a movie, whether a tag is unique, etc.

If a tag has specifics which are not described here, it often can be checked using its name and special handling.

The existing flags are:

SWF_TYPE_DEFINE This is a definition tag (Sprite, Shape...)

SWF_TYPE_CONTROL This is a control tag (ShowFrame, PlaceObject...)

SWF_TYPE_UNIQUE This can be used once throughout the whole movie

SWF_TYPE_START This tag should be at the start of the movie

SWF_TYPE_ONE At most one per frame

SWF_TYPE_REFERENCE This tag references another

SWF_TYPE_HAS_ID This tag has an identifier

SWF_TYPE_SCRIPT This object can accept action scripts

SWF_TYPE_SPRITE This is a sprite (can include other tags)

SWF_TYPE_HEADER The header object

Note:
These flags are constant (actually hard coded!) and will not change between calls. They even rarely change between versions.
Returns:
The set of flags for the given tag
See also:
sswf::TagBase::Name(void) const

Implements sswf::TagBase.


Member Data Documentation

unsigned char* sswf::TagImage::f_colormap [private]

long sswf::TagImage::f_count [private]

image_format_t sswf::TagImage::f_format [private]

image_t sswf::TagImage::f_image [private]

int sswf::TagImage::f_quality [private]


The documentation for this class was generated from the following files:
Generated on Sun May 13 23:29:40 2007 for libsswf by  doxygen 1.4.7