visu_dump

visu_dump — Some resources to add the ability to export the rendered data to an other format (usually image format).

Synopsis

                    VisuDump;
                    VisuDumpClass;
enum                VisuDumpErrorFlag;
const VisuDump *    (*VisuDumpInitFunc)                 ();
gboolean            (*VisuDumpWriteFunc)                (ToolFileFormat *format,
                                                         const char *fileName,
                                                         int width,
                                                         int height,
                                                         VisuData *dataObj,
                                                         guchar *image,
                                                         GError **error,
                                                         ToolVoidDataFunc functionWait,
                                                         gpointer data);
void                visu_dump_abort                     (GObject *obj,
                                                         gpointer data);
GList *             visu_dump_getAllModules             ();
gboolean            visu_dump_getAlphaStatus            (VisuDump *dump);
gboolean            visu_dump_getBitmapStatus           (VisuDump *dump);
gboolean            visu_dump_getGlStatus               (VisuDump *dump);
gint                visu_dump_getNModules               ();
GQuark              visu_dump_getQuark                  ();
VisuDump *          visu_dump_new                       (const gchar *descr,
                                                         const gchar **patterns,
                                                         VisuDumpWriteFunc method,
                                                         gboolean bitmap);
void                visu_dump_setGl                     (VisuDump *dump,
                                                         gboolean needGl);
void                visu_dump_setHasAlpha               (VisuDump *dump,
                                                         gboolean hasAlpha);
gboolean            visu_dump_write                     (VisuDump *dump,
                                                         const char *fileName,
                                                         int width,
                                                         int height,
                                                         VisuData *dataObj,
                                                         GArray *image,
                                                         ToolVoidDataFunc functionWait,
                                                         gpointer data,
                                                         GError **error);

Object Hierarchy

  GObject
   +----ToolFileFormat
         +----VisuDump

Description

V_Sim can export loaded data to othe formats. This module descibes the methods and structure to create a dumping extension. Basically, a dumping extension is just a FileFormat and a method that is called when exporting is required. No method exists to create a dumping extension, just allocate and initialize the DumpType structure.

The writeDumpFunc should suspend its process to allow the calling program to refresh itself if the dump process is slow. Ideally, the argument waitFunction should be called exactly 100 times.

Details

VisuDump

typedef struct _VisuDump VisuDump;

An opaque structure.


VisuDumpClass

typedef struct _VisuDumpClass VisuDumpClass;

An opaque structure.


enum VisuDumpErrorFlag

typedef enum {
    DUMP_ERROR_OPENGL,
    DUMP_ERROR_FILE,
    DUMP_ERROR_ENCODE
} VisuDumpErrorFlag;

These are flags used when dumping to a file.

DUMP_ERROR_OPENGL

Error with OpenGL dumping.

DUMP_ERROR_FILE

Error when opening.

DUMP_ERROR_ENCODE

Wrongness when computing the encoding format.

VisuDumpInitFunc ()

const VisuDump *    (*VisuDumpInitFunc)                 ();

This protoype defines initializing function for dumping extension. Create such a function and add its name in the list listInitDumpModuleFunc defined in dumpModules/externalDumpModules.h thus the new dumping extension will be initialized on startup.

Returns :

a newly allocated VisuDump.

VisuDumpWriteFunc ()

gboolean            (*VisuDumpWriteFunc)                (ToolFileFormat *format,
                                                         const char *fileName,
                                                         int width,
                                                         int height,
                                                         VisuData *dataObj,
                                                         guchar *image,
                                                         GError **error,
                                                         ToolVoidDataFunc functionWait,
                                                         gpointer data);

This is a prototype of a method implemented by a dumping extension that is called when the current rendering must be dumped to a file.

format :

a ToolFileFormat object, corresponding to the write method ;

fileName :

a string that defined the file to write to ;

width :

an integer ;

height :

an integer.

dataObj :

the VisuData to be exported ;

image :

the data to be written ;

error :

a location to store some error (not NULL) ;. [allow-none]

functionWait :

a method to call periodically during the dump ;. [allow-none][scope call]

data :

some pointer on object to be passed to the wait function. [closure]

Returns :

TRUE if everything went right.

visu_dump_abort ()

void                visu_dump_abort                     (GObject *obj,
                                                         gpointer data);

Does nothing for the moment.

obj :

an object ;

data :

some data.

visu_dump_getAllModules ()

GList *             visu_dump_getAllModules             ();

All dumping extensions are stored in an opaque way in V_Sim. But they can be listed by a call to this method.

Returns :

a list of all the known dumping extensions. This list is own by V_Sim and should be considered read-only. [transfer none][element-type VisuDump*]

visu_dump_getAlphaStatus ()

gboolean            visu_dump_getAlphaStatus            (VisuDump *dump);

Retrieve if dump use alpha channel or not.

dump :

a VisuDump method.

Returns :

TRUE if dump has an alpha channel.

visu_dump_getBitmapStatus ()

gboolean            visu_dump_getBitmapStatus           (VisuDump *dump);

Retrieve if dump is exporting a bitmap or not (like to a new input file format...).

dump :

a VisuDump method.

Returns :

TRUE if the output is a bitmap indeed.

visu_dump_getGlStatus ()

gboolean            visu_dump_getGlStatus               (VisuDump *dump);

Retrieve if dump requires OpenGL to export or not.

dump :

a VisuDump method.

Returns :

TRUE if OpenGL is required.

visu_dump_getNModules ()

gint                visu_dump_getNModules               ();

A convenient way to know how many dumping extensions are registered.

Returns :

the number of known dumping extensions.

visu_dump_getQuark ()

GQuark              visu_dump_getQuark                  ();

Internal routine to get the GQuark to handle error related to dump actions.


visu_dump_new ()

VisuDump *          visu_dump_new                       (const gchar *descr,
                                                         const gchar **patterns,
                                                         VisuDumpWriteFunc method,
                                                         gboolean bitmap);

Create a new dump format.

descr :

an UTF8 translated string ;

patterns :

a NULL terminated list of pattern for this dump format ;. [array zero-terminated=1]

method :

a method used to dump the current VisuData ;. [scope call]

bitmap :

a flag for bitmap export.

Returns :

a newly created dump format.

Since 3.7


visu_dump_setGl ()

void                visu_dump_setGl                     (VisuDump *dump,
                                                         gboolean needGl);

Set if dump requires OpenGL or not.

dump :

a VisuDump method.

needGl :

a boolean

visu_dump_setHasAlpha ()

void                visu_dump_setHasAlpha               (VisuDump *dump,
                                                         gboolean hasAlpha);

Set if dump has an alpha channel or not.

dump :

a VisuDump method.

hasAlpha :

a boolean.

visu_dump_write ()

gboolean            visu_dump_write                     (VisuDump *dump,
                                                         const char *fileName,
                                                         int width,
                                                         int height,
                                                         VisuData *dataObj,
                                                         GArray *image,
                                                         ToolVoidDataFunc functionWait,
                                                         gpointer data,
                                                         GError **error);

Use the write function of dump to export the current dataObj to file fileName.

dump :

a VisuDump object ;

fileName :

a string that defined the file to write to ;. [type filename]

width :

an integer ;

height :

an integer ;

dataObj :

the VisuData to be exported ;

image :

the data to be written ;. [allow-none][element-type gint8]

error :

a location to store some error (not NULL) ;

functionWait :

a method to call periodically during the dump ;. [allow-none][closure data][scope call]

data :

some pointer on object to be passed to the wait function. [closure]

Returns :

TRUE if dump succeed.

Since 3.6