#ifndef _LZWDECOMPRESSION_HPP_ #define _LZWDECOMPRESSION_HPP_ #include #include #include #include class LZWDecompression : public IStream { public: LZWDecompression(const char *pathFileName); virtual ~LZWDecompression(); enum{CMASKSIZE=9,STARTTABLESIZE=5,INCTABLESIZE=5}; enum{OUTROWSIZE=2048,CTSIZE=4096,STACKSIZE=4096}; void unpackData(USHORT imageWide,USHORT imageDeep,USHORT isInterlaced,USHORT pixelSize); protected: virtual void errorHandler(CHAR *errorMessage); virtual void showHandler(UCHAR FAR *lpOutRow,USHORT yLocation); private: 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