## dumpToGif

dumpToGif — add an export capability into GIF files.

## Synopsis

                        ColorPacket;
                        Image;
    unsigned int        dumpToGif_quantizeImage             (unsigned int number_colors,
                                                             GError **error,
                                                             voidDataFunc functionWait,
                                                             gpointer data);
    void                dumpToGif_syncImage                 (void);
    void                dumpToGif_setImage                  (Image *data);

    DumpType*           dumpToGif_init                      ();

## Description

This provides a write routine to export V_Sim views into GIF files.

Most of the routines used there have been modified by L. Billard (1997 - 2001) from the original ones taken from the ImageMagick package of cristy`dupont.com`.

The goal of this is to reduce the colour span into 256 to be able to output as GIF file.

### Note

Copyright 1994 E. I. du Pont de Nemours & Company

Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of E. I. du Pont de Nemours & Company not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. E. I. du Pont de Nemours & Company makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.

E. I. du Pont de Nemours & Company disclaims all warranties with regard to this software, including all implied warranties of merchantability and fitness, in no event shall E. I. du Pont de Nemours & Company be liable for any special, indirect or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action of contract, negligence or other tortious action, arising out of or in connection with the use or performance of this software.

## Details

### ColorPacket

    typedef struct {
      unsigned char red, green, blue;
      unsigned short index;
    } ColorPacket;

A private structure used by the GIF conversion. It is usefull for all convertion from RGB to color table.

unsigned char `red`; | red value ;
unsigned char `green`; | green value ;
unsigned char `blue`; | blue value ;
unsigned short `index`; | ??.

### Image

    typedef struct {
      unsigned int columns, rows, colors;
      ColorPacket *colormap, *pixels, *packet;
      unsigned long packets;
    } Image;

A private structure used by the GIF conversion. It is usefull for all convertion from RGB to color table.

unsigned int `columns`; | number of columns ;
unsigned int `rows`; | number of rows ;
unsigned int `colors`; | number of colours ;
ColorPacket *`colormap`; | an array of colours ;
ColorPacket *`pixels`; | the definition for each pixels ;
ColorPacket *`packet`; | ?? ;
unsigned long `packets`; | ??.

### dumpToGif_quantizeImage ()

    unsigned int        dumpToGif_quantizeImage             (unsigned int number_colors,
                                                             GError **error,
                                                             voidDataFunc functionWait,
                                                             gpointer data);

This routine transform an RGB image to an indexed colours image. To set the image to quantize, use `setImage()`.

`number_colors` : | the number of desired colours ;
`error` : | an error location ;
`functionWait` : | a method that will be called during the quantize process ;
`data` : | an argument to give to the wait function.
Returns : | 0 if everithing went right.

### dumpToGif_syncImage ()

    void                dumpToGif_syncImage                 (void);

Do something in the GIF exoprt process.

### dumpToGif_setImage ()

    void                dumpToGif_setImage                  (Image *data);

Set the image to be manipulated by the GIF convertor (see `dumpToGif_quantizeImage()`).

`data` : | a Image structure.

### dumpToGif_init ()

    DumpType*           dumpToGif_init                      ();

This routine should not be used since it inialised the module and is already called when V_Sim is launched.

Returns : | a newly created dump object to create GIF files.