CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 1999
    Posts
    68

    HELP : Creating Gif image

    Hi,

    I need to create gif files on the fly. E.g. stock views with a climbing red-line to see the progress. To do this i need to write an in memory image and stream it to a file. Does somebody know documentation or code about how the structure of gif files work. The most gif-classes are used to read and and display or convert images so that's no help in my situation. Hope anyone can help !

    -- Ron


  2. #2
    Join Date
    Apr 1999
    Posts
    27,449

    Re: HELP : Creating Gif image

    I did a web search on www.altavista.com entered, "Gif File Format" and found this:

    http://atlas.csd.net/~cgadd/knowbase/FAQ0017.HTM

    When in doubt, use the Internet for it's strength: finding information.

    Also, you must be aware that the GIF format includes LZW compression. This is patented by Unisys corporation. If you plan to sell your program (regardles of whether it's shareware or commercial, 1 dollar or thousands of dollars), you will have to pay big money from Unisys for a license.

    Regards,

    Paul McKenzie


  3. #3
    Join Date
    May 1999
    Posts
    68

    Re: HELP : Creating Gif image

    Hi,

    Thanks for reply.
    I know about the lzw compression but there is also a gif format without this compression ?!

    -- Ron


  4. #4
    Join Date
    Aug 1999
    Posts
    5

    Re: HELP : Creating Gif image

    Here is some code that may help you. Take a look at the function GIFCompressImage();


    /**********************************************************************************************************************************/
    /* Module : SCR2GIF.C */
    /* Executable : SCR2GIF.EXE */
    /* Version type : Standalone program */
    /* Last changed : 25-05-1998 20:30 */
    /* Update count : 2 */
    /* OS type : Generic */
    /* Description : Spectrum .SCR to compressed GIF87a convertor. */
    /* Copyrights : GIF87a functions based on a source from Sverre H. Huseby, Bjoelsengt. 17, N-0468 Oslo, Norway 26-09-1992 */
    /* Implementation taken from Workbench! v2.71.3, copyright (C) 1995-1998 ThunderWare Research Center */
    /* GIF89a extensions added 25-05-1998, "NETSCAPE v2.0" compliant (web-based default) LOOPing */
    /* */
    /* The Graphics Interchange Format(c) is the Copyright property of CompuServe Incorporated. */
    /* GIF(sm) is a Service Mark property of CompuServe Incorporated. */
    /* */
    /* Copyright (C) 1998 by M. van der Heide of ThunderWare Research Center */
    /**********************************************************************************************************************************/

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <malloc.h>
    #include <errno.h>
    #include <unistd.h>

    /**********************************************************************************************************************************/
    /* Add some variables types */
    /**********************************************************************************************************************************/

    typedef char bool;
    typedef unsigned char byte;
    typedef unsigned short word; /* (Must be 16-bit) */
    typedef unsigned long dword; /* (Must be 32-bit) */

    #ifndef TRUE
    #define TRUE (bool)1
    #define FALSE (bool)0
    #endif

    /**********************************************************************************************************************************/
    /* Define the GIF return codes */
    /**********************************************************************************************************************************/

    #define GIF_OK 0x00 /* No errors */
    #define GIF_ERRCREATE 0x01 /* Error creating GIF file */
    #define GIF_ERRWRITE 0x02 /* Error writing to GIF file */
    #define GIF_OUTMEM 0x03 /* Cannot allocate resources */
    #define GIF_OUTMEM2 0x04 /* Cannot allocate resources */

    /**********************************************************************************************************************************/
    /* Define the static variables */
    /**********************************************************************************************************************************/

    static FILE *_OutFile; /* File to write to */
    static char _GIFErrorMessage[50];

    /**********************************************************************************************************************************/
    /* Define the information to write a bit-file */
    /**********************************************************************************************************************************/

    static byte _Buffer[256];
    static int _Index; /* Current byte in buffer */
    static int _BitsLeft; /* Bits left to fill in current byte. These are right-justified */

    /**********************************************************************************************************************************/
    /* Define the information to maintain an LZW-string table */
    /**********************************************************************************************************************************/

    #define RES_CODES 2

    #define HASH_FREE 0xFFFF
    #define NEXT_FIRST 0xFFFF

    #define MAXBITS 12
    #define MAXSTR (1 << MAXBITS)

    #define HASHSIZE 9973
    #define HASHSTEP 2039

    #define HASH(Index, Lastbyte) (((Lastbyte << 8) ^ Index) % HASHSIZE)

    static byte *StrChr = NULL;
    static word *StrNxt = NULL;
    static word *StrHsh = NULL;
    static word NumStrings;

    /**********************************************************************************************************************************/
    /* Define the information on GIF images */
    /**********************************************************************************************************************************/

    typedef struct
    {
    word LocalScreenWidth;
    word LocalScreenHeight;
    byte GlobalColourTableSize : 3;
    byte SortFlag : 1;
    byte ColourResolution : 3;
    byte GlobalColourTableFlag : 1;
    byte BackgroundColourIndex;
    byte PixelAspectRatio;
    } _ScreenDescriptor;

    typedef struct
    {
    byte Separator;
    word LeftPosition;
    word TopPosition;
    word Width;
    word Height;
    byte LocalColourTableSize : 3;
    byte Reserved : 2;
    byte SortFlag : 1;
    byte InterlaceFlag : 1;
    byte LocalColourTableFlag : 1;
    } _ImageDescriptor;

    typedef struct
    {
    byte ExtensionIntroducer;
    byte GraphicControlLabel;
    byte BlockSize;
    byte TransparantColorFlag : 1;
    byte UserInputFlag : 1;
    byte DisposalMethod : 3;
    byte Reserved : 3;
    word DelayTime; /* BIG endian! */
    byte TransparantColorIndex;
    byte BlockTerminator;
    } _GraphicControlExtension;

    static byte _ApplicationExtensionHeader[19] =
    {
    0x21, /* GIF Extension Code */
    0xFF, /* Application Extension Label */
    0x0B, /* Length of Application Block */
    'N', 'E', 'T', 'S', 'C', 'A', 'P', 'E', /* Application Name */
    '2', '.', '0', /* Application ID */
    0x03, /* Length of Data Sub-Block */
    0x01, /* Sub-Block ID */
    0x00, /* Loop Count higher value (big endian) */
    0x00, /* Loop Count lower value (0 = infinite) */
    0x00 /* Data Sub-Block Terminator */
    };

    static short _BitsPrPrimColour; /* Bits per primary colour */
    static short _NumColours; /* Number of colours in colour table */
    static byte *_ColourTable = NULL;
    static word _ScreenHeight;
    static word _ScreenWidth;
    static word _ImageHeight;
    static word _ImageWidth;
    static word _ImageLeft;
    static word _ImageTop;
    static word _RelPixX;
    static word _RelPixY;

    /**********************************************************************************************************************************/
    /* Define the static functions */
    /**********************************************************************************************************************************/

    static byte _Create (char *FileName);
    static byte _Write (void *Buf, word Length);
    static byte _WriteByte (byte B);
    static byte _WriteWord (word W);
    static void _Close (void);

    static void _InitBitFile (void);
    static int _ResetOutBitFile (void);
    static int _WriteBits (short Bits, short NumBits);

    static void _FreeStrtab (void);
    static byte _AllocStrtab (void);
    static word _AddCharString (word Index, byte B);
    static word _FindCharString (word Index, byte B);
    static void _ClearStrtab (short CodeSize);

    static byte _LZW_Compress (short CodeSize, short (*GetPixelFunction)(short PixX, short PixY));

    static short _BitsNeeded (word N);
    static short (*_GetPixel) (short PixX, short PixY);
    static short _InputByte (void);
    static byte _WriteScreenDescriptor (_ScreenDescriptor *Sd);
    static byte _WriteImageDescriptor (_ImageDescriptor *Id);
    static byte _WriteGraphicControlExtension (_GraphicControlExtension *Ext);

    static byte _GIFCreate (char *FileName, short Width, short Height, short NumColours, short ColourRes,
    bool GIF89a);
    static void _GIFSetColour (byte ColourNum, byte Red, byte Green, byte Blue);
    static byte _GIFWriteGlobalColorTable (bool GIF89a);
    static byte _GIFCompressImage (short StartX, short StartY, int Width, int Height,
    short (*GetPixelFunction)(short PixX, short PixY), bool GIF89a, word PictureDelayTime);
    static byte _GIFClose (void);
    static char *_GIFstrerror (byte ErrorCode);

    /**********************************************************************************************************************************/
    /* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> START OF GENERIC LIBRARY FUNCTIONS <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< */
    /**********************************************************************************************************************************/

    static byte _Create (char *FileName)

    /**********************************************************************************************************************************/
    /* Pre : `FileName' points to the name of the file to be created. */
    /* Post : Creates a new file and enables referencing using the global variable _OutFile. */
    /* The return value is GIF_ERRCREATE if the file could not be created, GIF_OK otherwise. */
    /* Import: None. */
    /**********************************************************************************************************************************/

    {
    return (((_OutFile = fopen (FileName, "wb")) == NULL) ? GIF_ERRCREATE : GIF_OK);
    }

    static byte _Write (void *Buf, word Length)

    /**********************************************************************************************************************************/
    /* Pre : `Buf' points to the buffer to be written, `Length' holds the length. */
    /* Post : The buffer has been written to the _OutFile. */
    /* The return value is GIF_ERRWRITE if a write error occured, GIF_OK otherwise. */
    /* Import: None. */
    /**********************************************************************************************************************************/

    {
    return ((fwrite (Buf, 1, Length, _OutFile) < Length) ? GIF_ERRWRITE : GIF_OK);
    }

    static byte _WriteByte (byte B)

    /**********************************************************************************************************************************/
    /* Pre : `B' holds the byte to be written. */
    /* Post : The byte has been written. The return value is GIF_ERRWRITE if an error occured, GIF_OK otherwise. */
    /* Import: None. */
    /**********************************************************************************************************************************/

    {
    return ((putc (B, _OutFile) == EOF) ? GIF_ERRWRITE : GIF_OK);
    }

    static byte _WriteWord (word W)

    /**********************************************************************************************************************************/
    /* Pre : `W' holds the word to be written. */
    /* Post : The word has been written BIG-endian. The return value is GIF_ERRWRITE if an error occured, GIF_OK otherwise. */
    /* Import: None. */
    /**********************************************************************************************************************************/

    {
    if (putc (W & 0xFF, _OutFile) == EOF)
    return (GIF_ERRWRITE);

    return ((putc ((W >> 8), _OutFile) == EOF) ? GIF_ERRWRITE : GIF_OK);
    }

    static void _Close (void)

    /**********************************************************************************************************************************/
    /* Pre : None. */
    /* Post : Closes the _OutFile. */
    /* Import: None. */
    /**********************************************************************************************************************************/

    {
    fclose (_OutFile);
    }

    static void _InitBitFile (void)

    /**********************************************************************************************************************************/
    /* Pre : None. */
    /* Post : Initiate when using a bitfile. */
    /* Import: None. */
    /**********************************************************************************************************************************/

    {
    _Buffer[_Index = 0] = 0;
    _BitsLeft = 8;
    }

    static int _ResetOutBitFile (void)

    /**********************************************************************************************************************************/
    /* Pre : None. */
    /* Post : Tidy up after using a bitfile. Returns 0 if no errors occured, -1 otherwise. */
    /* Import: _WriteByte, _Write. */
    /**********************************************************************************************************************************/

    {
    byte NumBytes;

    NumBytes = _Index + (_BitsLeft == 8 ? 0 : 1); /* Find out how much is in the buffer */
    if (NumBytes) /* Write whatever is in the buffer to the file */
    {
    if (_WriteByte (NumBytes) != GIF_OK)
    return (-1);
    if (_Write (_Buffer, NumBytes) != GIF_OK)
    return (-1);
    _Buffer[_Index = 0] = 0;
    _BitsLeft = 8;
    }
    return (0);
    }

    static int _WriteBits (short Bits, short NumBits)

    /**********************************************************************************************************************************/
    /* Pre : 'Bits' holds the (right justified) bits to be written, `NumBits' holds the number of bits to be written. */
    /* Post : The given number of bits are written to the _OutFile. If an error occured, -1 is returned. */
    /* Import: _WriteByte, _Write. */
    /**********************************************************************************************************************************/

    {
    int register BitsWritten = 0;
    byte register NumBytes = 255;

    do /* If the buffer is full, write it */
    {
    if ((_Index == 254 && !_BitsLeft) || _Index > 254)
    {
    if (_WriteByte (NumBytes) != GIF_OK)
    return (-1);
    if (_Write (_Buffer, NumBytes) != GIF_OK)
    return (-1);
    _Buffer[_Index = 0] = 0;
    _BitsLeft = 8;
    }

    if (NumBits <= _BitsLeft) /* Now take care of the two special cases */
    {
    _Buffer[_Index] |= (Bits & ((1 << NumBits) - 1)) << (8 - _BitsLeft);
    BitsWritten += NumBits;
    _BitsLeft -= NumBits;
    NumBits = 0;
    }
    else
    {
    _Buffer[_Index] |= (Bits & ((1 << _BitsLeft) - 1)) << (8 - _BitsLeft);
    BitsWritten += _BitsLeft;
    Bits >>= _BitsLeft;
    NumBits -= _BitsLeft;
    _Buffer[++ _Index] = 0;
    _BitsLeft = 8;
    }
    } while (NumBits);
    return (BitsWritten);
    }

    static void _FreeStrtab (void)

    /**********************************************************************************************************************************/
    /* Pre : None. */
    /* Post : Free arrays used in string table routines. */
    /* Import: None. */
    /**********************************************************************************************************************************/

    {
    if (StrHsh)
    {
    free (StrHsh);
    StrHsh = NULL;
    }
    if (StrNxt)
    {
    free (StrNxt);
    StrNxt = NULL;
    }
    if (StrChr)
    {
    free (StrChr);
    StrChr = NULL;
    }
    }

    static byte _AllocStrtab (void)

    /**********************************************************************************************************************************/
    /* Pre : None. */
    /* Post : Allocate arrays used in string table routines. Returns GIF_OUTMEM or GIF_OK. */
    /* Import: _FreeStrtab. */
    /**********************************************************************************************************************************/

    {
    _FreeStrtab (); /* Just in case ... */

    if ((StrNxt = (word *)malloc (MAXSTR * 2)) == NULL)
    {
    _FreeStrtab ();
    return (GIF_OUTMEM2);
    }
    if ((StrChr = (byte *)malloc (MAXSTR)) == NULL)
    {
    _FreeStrtab ();
    return (GIF_OUTMEM2);
    }
    if ((StrHsh = (word *)malloc (HASHSIZE * 2)) == NULL)
    {
    _FreeStrtab ();
    return (GIF_OUTMEM2);
    }
    return (GIF_OK);
    }

    static word _AddCharString (word Index, byte B)

    /**********************************************************************************************************************************/
    /* Pre : `Index' holds the index to the first part of the string, or 0xFFFF is only 1 byte is wanted, `B' holds the last byte */
    /* in the new string. */
    /* Post : Add a string consisting of the string of Index plus the byte B. The return value is 0xFFFF if room is not available. */
    /* Import: None. */
    /**********************************************************************************************************************************/

    {
    word register HshIdx;

    if (NumStrings >= MAXSTR) /* Check if there is more room */
    return 0xFFFF;
    HshIdx = HASH (Index, B); /* Search the string table until a free position is found */
    while (StrHsh[HshIdx] != 0xFFFF)
    HshIdx = (HshIdx + HASHSTEP) % HASHSIZE;
    StrHsh[HshIdx] = NumStrings; /* Insert new string */
    StrChr[NumStrings] = B;
    StrNxt[NumStrings] = (Index != 0xFFFF ? Index : NEXT_FIRST);
    return (NumStrings ++);
    }

    static word _FindCharString (word Index, byte B)

    /**********************************************************************************************************************************/
    /* Pre : `Index' holds the index to the first part of the string, or 0xFFFF is only 1 byte is wanted, `B' holds the last byte */
    /* in the new string. */
    /* Post : Find index of string consisting of the string of index plus the byte B. The return value is 0xFFFF if not found. */
    /* Import: None. */
    /**********************************************************************************************************************************/

    {
    word register HshIdx;
    word register NxtIdx;

    if (Index == 0xFFFF) /* Check if Index is 0xFFFF. In that case we need only return B, */
    return (B); /* since all one-character strings has their bytevalue as their index */
    HshIdx = HASH (Index, B); /* Search the string table until the string is found, or */
    while ((NxtIdx = StrHsh[HshIdx]) != 0xFFFF) /* we find HASH_FREE. In that case the string does not exist. */
    {
    if (StrNxt[NxtIdx] == Index && StrChr[NxtIdx] == B)
    return (NxtIdx);
    HshIdx = (HshIdx + HASHSTEP) % HASHSIZE;
    }
    return (0xFFFF); /* No match is found */
    }

    static void _ClearStrtab (short CodeSize)

    /**********************************************************************************************************************************/
    /* Pre : `CodeSize' holds the number of bits to encode one pixel. */
    /* Post : Mark the entire table as free, enter the 2**CodeSize one-byte strings and reserve the RES_CODES reserved codes. */
    /* Import: _AddCharString. */
    /**********************************************************************************************************************************/

    {
    int register Q;
    int register W;
    word register *Wp;

    NumStrings = 0; /* No strings currently in the table */
    Wp = StrHsh; /* Mark entire hashtable as free */
    for (Q = 0 ; Q < HASHSIZE ; Q ++)
    *Wp ++ = HASH_FREE;
    W = (1 << CodeSize) + RES_CODES; /* Insert 2**CodeSize one-character strings, and reserved codes */
    for (Q = 0 ; Q < W ; Q ++)
    _AddCharString (0xFFFF, (byte)Q);
    }

    static byte _LZW_Compress (short CodeSize, short (*GetPixelFunction)(short PixX, short PixY))

    /**********************************************************************************************************************************/
    /* Pre : `CodeSize' holds the number of bits needed to represent one pixelvalue. */
    /* `GetPixelFunction' points to a callback function used to fetch the color value of each pixel of the image. */
    /* Post : Perform LZW compression as specified in the GIF87a standard. The return value is one of GIF_OK or GIF_OUTMEM. */
    /* Import: _InitBitFile, _ClearStrtab, _WriteBits, _FindCharString, _AddCharString, _ResetOutBitFile, _FreeStrtab. */
    /**********************************************************************************************************************************/

    {
    word register Index;
    short register C;
    int ClearCode;
    int EndOfInfo;
    int NumBits;
    int Limit;
    int ErrCode;
    word Prefix = 0xFFFF;

    _GetPixel = GetPixelFunction;
    _InitBitFile (); /* Set up the given _OutFile */
    ClearCode = 1 << CodeSize; /* Set up variables and tables */
    EndOfInfo = ClearCode + 1;
    NumBits = CodeSize + 1;
    Limit = (1 << NumBits) - 1;
    if ((ErrCode = _AllocStrtab ()) != GIF_OK)
    return (ErrCode);
    _ClearStrtab (CodeSize);
    _WriteBits (ClearCode, NumBits); /* First send a code telling the unpacker to clear the stringtable */
    while ((C = _InputByte ()) != -1)
    { /* Now perform the packing */
    if ((Index = _FindCharString (Prefix, (byte)C)) != 0xFFFF) /* Check if the prefix + the new character is a string that */
    { /* exists in the table */
    Prefix = Index; /* The string exists in the table. Make this string the new prefix */
    }
    else
    { /* The string does not exist in the table */
    _WriteBits (Prefix, NumBits); /* First write code of the old prefix to the file */
    if (_AddCharString (Prefix, (byte)C) > Limit) /* Add the new string (the prefix + the new character) to the stringtable */
    {
    if (++ NumBits > 12)
    {
    _WriteBits (ClearCode, NumBits - 1);
    _ClearStrtab (CodeSize);
    NumBits = CodeSize + 1;
    }
    Limit = (1 << NumBits) - 1;
    }
    Prefix = C; /* Set prefix to a string containing only the character read. Since all possible one-character */
    } /* strings exist in the table, there's no need to check if it is found */
    }
    if (Prefix != 0xFFFF) /* End of info is reached. Write last prefix */
    _WriteBits (Prefix, NumBits);
    _WriteBits (EndOfInfo, NumBits); /* Write end of info-mark */
    _ResetOutBitFile (); /* Flush the buffer */
    _FreeStrtab (); /* Tidy up */
    return (GIF_OK);
    }

    static short _BitsNeeded (word N)

    /**********************************************************************************************************************************/
    /* Pre : `N' holds the number of numbers to store (0 to (n - 1)). */
    /* Post : Calculates the number of bits needed to store numbers between 0 and (n - 1). This number is returned. */
    /* Import: None. */
    /**********************************************************************************************************************************/

    {
    short Ret = 1;

    if (!N --)
    return (0);
    while (N >>= 1)
    Ret ++;
    return (Ret);
    }

    static short _InputByte (void)

    /**********************************************************************************************************************************/
    /* Pre : None. */
    /* Post : Get next pixel from the image. Called by the _LZW_Compress function. Returns next pixelvalue or -1 at the end. */
    /* Import: _GetPixel. */
    /**********************************************************************************************************************************/

    {
    short Ret;

    if (_RelPixY >= _ImageHeight)
    return (-1);
    Ret = _GetPixel (_ImageLeft + _RelPixX, _ImageTop + _RelPixY);
    if (++ _RelPixX >= _ImageWidth)
    {
    _RelPixX = 0;
    _RelPixY ++;
    }
    return (Ret);
    }

    static byte _WriteScreenDescriptor (_ScreenDescriptor *Sd)

    /**********************************************************************************************************************************/
    /* Pre : `Sd' points to the screen descriptor to output. */
    /* Post : Output a screen descriptor to the current GIF-file. Returns GIF_ERRWRITE if an error occured. */
    /* Import: _WriteWord, _WriteByte. */
    /**********************************************************************************************************************************/

    {
    byte Tmp;

    if (_WriteWord (Sd->LocalScreenWidth) != GIF_OK)
    return (GIF_ERRWRITE);
    if (_WriteWord (Sd->LocalScreenHeight) != GIF_OK)
    return (GIF_ERRWRITE);
    Tmp = (Sd->GlobalColourTableFlag << 7) | (Sd->ColourResolution << 4) | (Sd->SortFlag << 3) | Sd->GlobalColourTableSize;
    if (_WriteByte (Tmp) != GIF_OK)
    return (GIF_ERRWRITE);
    if (_WriteByte (Sd->BackgroundColourIndex) != GIF_OK)
    return (GIF_ERRWRITE);
    if (_WriteByte (Sd->PixelAspectRatio) != GIF_OK)
    return (GIF_ERRWRITE);
    return (GIF_OK);
    }

    static byte _WriteImageDescriptor (_ImageDescriptor *Id)

    /**********************************************************************************************************************************/
    /* Pre : `Id' points to the image descriptor to output. */
    /* Post : Output an image descriptor to the current GIF-file. Returns GIF_ERRWRITE if an error occured. */
    /* Import: _WriteWord, _WriteByte. */
    /**********************************************************************************************************************************/

    {
    byte Tmp;

    if (_WriteByte (Id->Separator) != GIF_OK)
    return (GIF_ERRWRITE);
    if (_WriteWord (Id->LeftPosition) != GIF_OK)
    return (GIF_ERRWRITE);
    if (_WriteWord (Id->TopPosition) != GIF_OK)
    return (GIF_ERRWRITE);
    if (_WriteWord (Id->Width) != GIF_OK)
    return (GIF_ERRWRITE);
    if (_WriteWord (Id->Height) != GIF_OK)
    return (GIF_ERRWRITE);
    Tmp = (Id->LocalColourTableFlag << 7) | (Id->InterlaceFlag << 6) | (Id->SortFlag << 5) | (Id->Reserved << 3) |
    Id->LocalColourTableSize;
    if (_WriteByte (Tmp) != GIF_OK)
    return (GIF_ERRWRITE);
    return (GIF_OK);
    }

    static byte _WriteGraphicControlExtension (_GraphicControlExtension *Ext)

    /**********************************************************************************************************************************/
    /* Pre : `Ext' points to the graphic control extension block to output. */
    /* Post : Output a graphic control extension block to the current GIF-file. Returns GIF_ERRWRITE if an error occured. */
    /* Import: _WriteWord, _WriteByte. */
    /**********************************************************************************************************************************/

    {
    byte Tmp;

    if (_WriteByte (Ext->ExtensionIntroducer) != GIF_OK)
    return (GIF_ERRWRITE);
    if (_WriteByte (Ext->GraphicControlLabel) != GIF_OK)
    return (GIF_ERRWRITE);
    if (_WriteByte (Ext->BlockSize) != GIF_OK)
    return (GIF_ERRWRITE);
    Tmp = (Ext->Reserved << 5) | (Ext->DisposalMethod << 2) | (Ext->UserInputFlag << 1) | Ext->TransparantColorFlag;
    if (_WriteByte (Tmp) != GIF_OK)
    return (GIF_ERRWRITE);
    if (_WriteWord (Ext->DelayTime) != GIF_OK)
    return (GIF_ERRWRITE);
    if (_WriteByte (Ext->TransparantColorIndex) != GIF_OK)
    return (GIF_ERRWRITE);
    if (_WriteByte (Ext->BlockTerminator) != GIF_OK)
    return (GIF_ERRWRITE);
    return (GIF_OK);
    }

    static byte _GIFCreate (char *FileName, short Width, short Height, short NumColours, sh

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured