BitmapLoaderData Class Referenceabstract

#include <c4d_filterdata.h>

Inheritance diagram for BitmapLoaderData:

Detailed Description

A data class for creating bitmap loader plugins.
Use RegisterBitmapLoaderPlugin() to register a bitmap loader plugin.

Public Member Functions

virtual Bool Identify (const Filename &name, UChar *probe, Int32 size)=0
 
virtual IMAGERESULT Load (const Filename &name, BaseBitmap *bm, Int32 frame)=0
 
virtual Int32 GetSaver (void)
 
virtual Bool GetInformation (const Filename &name, Int32 *frames, Float *fps)
 
virtual IMAGERESULT LoadAnimated (BitmapLoaderAnimatedData *bd, BITMAPLOADERACTION action, BaseBitmap *bm, Int32 frame)
 
virtual IMAGERESULT ExtractSound (BitmapLoaderAnimatedData *bd, BaseSound *snd)
 
virtual IMAGERESULT HasSound (BitmapLoaderAnimatedData *bd)
 
- Public Member Functions inherited from BaseData
 BaseData ()
 
virtual ~BaseData (void)
 
void Destructor (void)
 

Member Function Documentation

◆ Identify()

virtual Bool Identify ( const Filename name,
UChar probe,
Int32  size 
)
pure virtual

Called to identify a file type as one that can be loaded using the bitmap loader.
If possible, the file should not be identified through its suffix, but through the probe data.

Parameters
[in]nameThe filename of the file.
[in]probeThe start of a small chunk of data from the start of the file to identify the file type. Cinema 4D owns the pointed array.
[in]sizeThe size of the probe chunk, usually 1024 bytes.
Returns
true if the bitmap loader recognizes the file type, otherwise false.

◆ Load()

virtual IMAGERESULT Load ( const Filename name,
BaseBitmap bm,
Int32  frame 
)
pure virtual

Called to load an image file into a bitmap.

Parameters
[in]nameThe name of the file to load.
[in]bmThe bitmap to load the image file into. Cinema 4D owns the pointed bitmap.
[in]frameThe frame number for formats containing multiple images in a file such as QuickTime or AVI.
Returns
The result of loading the file: IMAGERESULT

◆ GetSaver()

virtual Int32 GetSaver ( void  )
virtual

Called to get the plugin ID of the corresponding BitmapSaverData, if there is one.

Returns
The plugin ID of the corresponding bitmap saver, or nullptr if there is none.

◆ GetInformation()

virtual Bool GetInformation ( const Filename name,
Int32 frames,
Float fps 
)
virtual

Called to get information on the loading of movies.

Parameters
[in]nameThe name of the file to check.
[out]framesSet this to the number of frames.
[out]fpsSet this to the number of frames-per-second.
Returns
true if the information could be retrieved, otherwise false.

◆ LoadAnimated()

virtual IMAGERESULT LoadAnimated ( BitmapLoaderAnimatedData bd,
BITMAPLOADERACTION  action,
BaseBitmap bm,
Int32  frame 
)
virtual

Called to accelerate the loading of animated bitmaps.

Note
When LoadAnimated() is called with BITMAPLOADERACTION::INIT action (bm is nullptr and frame is 0) the loader can open the movie file bd->moviename and store data in the buffer field bd->moviedata[16].
For every call of BITMAPLOADERACTION::INIT, there is a BITMAPLOADERACTION::FREE (bm is nullptr and frame is 0) in which the image loader closes the movie file.
In between BITMAPLOADERACTION::LOAD is called with a valid bm and frame.

Loaders that overload LoadAnimated do not need to implement code twice, Load should in that case just look like this:

IMAGERESULT MyLoader::Load(const Filename &name, BaseBitmap *bm, Int32 frame)
{
data.moviename = name;
IMAGERESULT result = LoadAnimated(&data, BITMAPLOADERACTION::INIT, nullptr, 0);
if (result==IMAGERESULT::OK)
err = LoadAnimated(&data, BITMAPLOADERACTION::LOAD, bm, frame);
return err;
}
Parameters
[in]bdThe bitmap loader animated data. Cinema 4D owns the pointed data.
[in]actionThe bitmap loader action: BITMAPLOADERACTION
[out]bmTo be filled with the frame bitmap in BITMAPLOADERACTION::LOAD action call. Cinema 4D owns the pointed bitmap.
[in]frameThe frame to put into bitmap bm.
Returns
The result of loading the animated file: IMAGERESULT

◆ ExtractSound()

virtual IMAGERESULT ExtractSound ( BitmapLoaderAnimatedData bd,
BaseSound snd 
)
virtual

Called to extract the sound of animated bitmaps.

Parameters
[in]bdThe bitmap loader animated data. Cinema 4D owns the pointed data.
[in]sndThe extracted sound. Cinema 4D owns the pointed sound.
Returns
The result of extracting the sound: IMAGERESULT

◆ HasSound()

virtual IMAGERESULT HasSound ( BitmapLoaderAnimatedData bd)
virtual

Called by the Picture Viewer to determine whether a movie has sound or not.

Parameters
[in]bdThe bitmap loader animated data. Cinema 4D owns the pointed data.
Returns
The result: IMAGERESULT
BitmapLoaderAnimatedData::moviename
Filename moviename
The file name of the movie.
Definition: c4d_filterdata.h:46
IMAGERESULT::OK
@ OK
Image loaded/created.
BITMAPLOADERACTION::LOAD
@ LOAD
Load.
BITMAPLOADERACTION::FREE
@ FREE
Free.
Filename
Manages file and path names.
Definition: c4d_file.h:81
BitmapLoaderAnimatedData
Data structure for loading a movie in a bitmap loader.
Definition: c4d_filterdata.h:35
BITMAPLOADERACTION::INIT
@ INIT
Initialize.
Int32
maxon::Int32 Int32
Definition: ge_sys_math.h:45
BaseBitmap
Definition: c4d_basebitmap.h:406
IMAGERESULT
IMAGERESULT
Definition: ge_prepass.h:3618
BitmapLoaderData::LoadAnimated
virtual IMAGERESULT LoadAnimated(BitmapLoaderAnimatedData *bd, BITMAPLOADERACTION action, BaseBitmap *bm, Int32 frame)