74 lines
1.5 KiB
C++
74 lines
1.5 KiB
C++
#ifndef _SPACIAL_HPP_
|
|
#define _SPACIAL_HPP_
|
|
//#include <stdio.h>
|
|
#include <common/windows.hpp>
|
|
//#include <mdiwin/main.hpp>
|
|
//#include <mdiwin/types.hpp>
|
|
#include <mdiwin/cache.hpp>
|
|
#include <mdiwin/byte.hpp>
|
|
#include <mdiwin/rgb.hpp>
|
|
|
|
class SpacialTransform
|
|
{
|
|
public:
|
|
SpacialTransform(HPALETTE hPalette,UHUGE *hpImage,WORD width,WORD height,WORD sizeFactor);
|
|
virtual ~SpacialTransform();
|
|
HGLOBAL resizeImage(void);
|
|
void cancelThread(void);
|
|
WORD isCancelled(void)const;
|
|
private:
|
|
enum {MaxColors=256};
|
|
UINT nextPixel(void);
|
|
void putPixel(void);
|
|
void loadPaletteEntries(void);
|
|
void processTransform(void);
|
|
|
|
LONG mRedAccumulator;
|
|
LONG mGreenAccumulator;
|
|
LONG mBlueAccumulator;
|
|
WORD mSizeFactor;
|
|
WORD mInverseFactor;
|
|
UINT mInSegment;
|
|
UINT mOutSegment;
|
|
LONG mSrcWidth;
|
|
LONG mSrcHeight;
|
|
LONG mSrcExtent;
|
|
LONG mDstWidth;
|
|
LONG mDstHeight;
|
|
LONG mDstExtent;
|
|
LONG mCurrentRed;
|
|
LONG mCurrentGreen;
|
|
LONG mCurrentBlue;
|
|
LONG mNextRed;
|
|
LONG mNextGreen;
|
|
LONG mNextBlue;
|
|
LONG mNextPixelIndex;
|
|
LONG mNextDestinationIndex;
|
|
HGLOBAL mhGlobal;
|
|
UHUGE *mhpImage;
|
|
UHUGE *mhpDestinationImage;
|
|
HPALETTE mhPalette;
|
|
PALETTEENTRY mPaletteData[MaxColors];
|
|
WORD mIsInThread;
|
|
Cache<RGBStruct,Byte,175> mSimpleCache;
|
|
};
|
|
|
|
inline
|
|
void SpacialTransform::loadPaletteEntries(void)
|
|
{
|
|
::GetPaletteEntries(mhPalette,0,MaxColors,(PALETTEENTRY FAR *)&mPaletteData);
|
|
}
|
|
|
|
inline
|
|
void SpacialTransform::cancelThread(void)
|
|
{
|
|
mIsInThread=FALSE;
|
|
}
|
|
|
|
inline
|
|
WORD SpacialTransform::isCancelled(void)const
|
|
{
|
|
return !mIsInThread;
|
|
}
|
|
#endif
|