45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
#ifndef _MDIWIN_AVERAGE_HPP_
|
|
#define _MDIWIN_AVERAGE_HPP_
|
|
#ifndef _COMMON_WINDOWS_HPP_
|
|
#include <mdiwin/windows.hpp>
|
|
#endif
|
|
#include <mdiwin/types.hpp>
|
|
#include <mdiwin/block.hpp>
|
|
#include <mdiwin/int.hpp>
|
|
|
|
class Average
|
|
{
|
|
public:
|
|
typedef enum Criterion{RangeClipping,Normalization};
|
|
Average(char *imageName,HPALETTE hPalette,UHUGE *hpImage,WORD width,WORD height,WORD *isThreaded);
|
|
~Average();
|
|
void processImage(Block<Integer> &averagingMatrix,Criterion criterion);
|
|
private:
|
|
enum {MaxColors=256};
|
|
enum {MatrixDimension=3};
|
|
enum {MaxImageName=100};
|
|
void getPaletteEntries(void);
|
|
void performAverage(void);
|
|
BYTE NEAR averageImageIndex(LONG imageIndex);
|
|
void performAverageRangeClipping(void);
|
|
BYTE NEAR averageImageIndexRangeClipping(LONG imageIndex);
|
|
|
|
WORD *mIsThreaded;
|
|
int mDivisor;
|
|
char mImageName[MaxImageName+1];
|
|
WORD mAvMatrix[MatrixDimension][MatrixDimension];
|
|
HPALETTE mhPalette;
|
|
PALETTEENTRY mPaletteData[MaxColors];
|
|
UHUGE *mhpImage;
|
|
WORD mWidth;
|
|
WORD mHeight;
|
|
};
|
|
|
|
inline
|
|
void Average::getPaletteEntries(void)
|
|
{
|
|
::GetPaletteEntries(mhPalette,0,MaxColors,(PALETTEENTRY FAR*)&mPaletteData);
|
|
}
|
|
#endif
|
|
|