visu_dump

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

Synopsis

gboolean            (*VisuDumpWriteFunc)                (ToolFileFormat *format,
                                                         const char *fileName,
                                                         int width,
                                                         int height,
                                                         VisuData *dataObj,
                                                         guchar *image,
                                                         GError **error,
                                                         ToolVoidDataFunc functionWait,
                                                         gpointer data);
                    VisuDump;
#define             VISU_ERROR_DUMP
GQuark              visu_dump_getQuark                  ();
enum                DumpErrorFlag;
VisuDump *          (*VisuDumpInitFunc)                 ();
void                visuDumpAdd                         (VisuDump *dump);
gboolean            visu_dump_callWriteFunc             (VisuDump *dump,
                                                         const char *fileName,
                                                         int width,
                                                         int height,
                                                         VisuData *dataObj,
                                                         GArray *image,
                                                         ToolVoidDataFunc functionWait,
                                                         gpointer data,
                                                         GError **error);
GList*              visu_dump_getAllModules             ();
gint                visu_dump_getNModules               ();
void                visuDumpAbort                       (GObject *obj,
                                                         gpointer data);

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

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 ;. scope call

data :

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

Returns :

TRUE if everything went right.

VisuDump

typedef struct {
  gboolean bitmap, glRequired;
  ToolFileFormat *fileType;
  gboolean hasAlpha;
  VisuDumpWriteFunc writeFunc;
} VisuDump;

This structure is used to store a dumping extension. Such an extension is characterized by its ToolFileFormat and a method that can write a file from the current rendered data.

gboolean bitmap;

TRUE if the format requires to export the view into a bitmap ;. in.

gboolean glRequired;

TRUE if the method requires to run OpenGL.. in.

ToolFileFormat *fileType;

a ToolFileFormat ;

gboolean hasAlpha;

TRUE if the format support alpha channel ;

VisuDumpWriteFunc writeFunc;

a pointer to a write func.. scope call

VISU_ERROR_DUMP

#define VISU_ERROR_DUMP visu_dump_getQuark()

visu_dump_getQuark ()

GQuark              visu_dump_getQuark                  ();

enum DumpErrorFlag

typedef enum
  {
    DUMP_ERROR_OPENGL,
    DUMP_ERROR_FILE,
    DUMP_ERROR_ENCODE
  } DumpErrorFlag;

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 ()

VisuDump *          (*VisuDumpInitFunc)                 ();

visuDumpAdd ()

void                visuDumpAdd                         (VisuDump *dump);

Add the provided dump method to the list of available ones.

dump :

a VisuDump method.

Since 3.6


visu_dump_callWriteFunc ()

gboolean            visu_dump_callWriteFunc             (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 ;

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 ;. scope call

data :

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

Returns :

TRUE if dump succeed.

Since 3.6


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_getNModules ()

gint                visu_dump_getNModules               ();

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

Returns :

the number of known dumping extensions.

visuDumpAbort ()

void                visuDumpAbort                       (GObject *obj,
                                                         gpointer data);

Does nothing for the moment.

obj :

an object ;

data :

some data.