Files
Work/gif/LZW.HPP
2024-08-07 09:16:27 -04:00

70 lines
1.6 KiB
C++
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#ifndef _LZWDECOMPRESSION_HPP_
#define _LZWDECOMPRESSION_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _COMMON_STRING_HPP_
#include <common/string.hpp>
#endif
#ifndef _GIF_ISTREAM_HPP_
#include <gif/istream.hpp>
#endif
class LZWDecompression : public IStream
{
public:
LZWDecompression(void);
virtual ~LZWDecompression();
BOOL unpackData(USHORT imageWide,USHORT imageDeep,USHORT isInterlaced,USHORT pixelSize);
protected:
virtual void errorHandler(CHAR *errorMessage);
virtual void showHandler(UCHAR FAR *lpOutRow,USHORT yLocation);
private:
enum{CMASKSIZE=9,STARTTABLESIZE=5,INCTABLESIZE=5};
enum{OUTROWSIZE=2048,CTSIZE=4096,STACKSIZE=4096};
BOOL initialize(void);
void cleanup(void);
void flush(void);
void initializeTable(SHORT clearCode);
WORD insertCode(SHORT code);
void putx(SHORT code,SHORT pixelSize);
void doPixel(CHAR tempCode);
USHORT getCode(USHORT reqct);
USHORT getBCode(USHORT code);
UCHAR getGB(void);
static USHORT mcMask[];
static USHORT mStartTable[];
static USHORT mIncTable[];
static CHAR errorMessage[];
USHORT mImageWide;
USHORT mImageDeep;
USHORT mIsInterlaced;
USHORT mOldCode;
USHORT mNextCode;
USHORT mCode;
USHORT mPixelSize;
USHORT mNextLimit;
USHORT mBufferCount;
USHORT mRemct;
USHORT mReqct;
USHORT mRem;
USHORT mPass;
USHORT mxLocation;
USHORT myLocation;
USHORT mRowCount;
CHAR FAR *mlpctFirst;
CHAR FAR *mlpctLast;
SHORT FAR *mlpctLink;
UCHAR FAR *mlpOutRow;
UCHAR FAR *mlpStack;
HGLOBAL mhGlobalctFirst;
HGLOBAL mhGlobalctLast;
HGLOBAL mhGlobalctLink;
HGLOBAL mhGlobalOutRow;
HGLOBAL mhGlobalStack;
WORD mIsConstructed;
};
#endif