⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gifcls.h

📁 WIN32高级程序设计书附源码
💻 H
字号:
/*
**  GIFCLS.H
**  Header for the GIF class.
**
**  Author:     C A Marriott
**  Created:    20-FEB-93
**
**  Revised:
**
*/

// Note - these preprocessor commands allow us to #include the class
// header more than once without problems.

#if !defined GIFCLASS

#define GIFCLASS

//  Class to read a GIF and convert to a DIB.

class GIF {

    WORD wRowCount;             // current output row
    int nPassNumber;            // interlaced output pass number
    WORD wHeight;               // height of the image in pixels
    BOOL bInterlaced;           // interlaced image flag

    int hFile;                  // file handle
    WORD wByteCount;            // current byte offset in file buffer
    WORD wByteIndex;            // current index into input buffer
    BYTE FAR *cFileBuffer;      // pointer to file input buffer

    int xdots, ydots;
    int colors;                 // number of colours in the DIB
    int win_xdots;
    int win_ydots;
    BYTE huge *pixels;          // the device-independent bitmap pixels
    int pixels_per_byte;        // pixels/byte in the pixmap
    long pixels_per_bytem1;     // pixels / byte - 1 (for ANDing)
    int pixelshift_per_byte;    // 0, 1, 2, or 3
    int bytes_per_pixelline;    // pixels/line / pixels/byte
    long win_bitmapsize;        // bitmap size, in bytes
    int bad_code_count;         // needed by decoder module

    BYTE GCT[256][3];           // global colour table
    BYTE LCT[256][3];           // local colour table

    BYTE win_andmask[8];        // pixel bitmask for AND ops
    BYTE win_notmask[8];        // pixel bitmask for NOT ops
    BYTE win_bitshift[8];       // shift in bits between pixels

    int skipxdots;              // 0 for every dot, 1 for every 2nd dot, etc
    int skipydots;              // ditto for rows

    short curr_size;            // The current code size
    short clear;                // Value for a clear code
    short ending;               // Value for a ending code
    short newcodes;             // First available code
    short top_slot;             // Highest code for current size
    short slot;                 // Last read code

    short navail_bytes;         // # bytes left in block
    short nbits_left;           // # bits left in current byte
    BYTE b1;                    // Current byte
    BYTE byte_buff[257];        // Current block, reuse shared mem
    BYTE *pbytes;               // Pointer to next byte in block

    // Private member functions:

    void CleanData();
    short Decoder( short );
    int GetByte();
    short GetNextCode();
    void InitializeDecoder( short );
    int OutputLine( BYTE FAR *, int  );
    void StorePixel( int, int, int );
    int StorePixelLine( int, int, int, BYTE FAR * );

    short get_next_code();


    // Public member functions:

public:

    GIF();                                  // default constructor
    ~GIF();                                 // destructor

    HANDLE Read( LPSTR szFileName );        // read a GIF
};


#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -