#ifndef ColorMap_First #define ColorMap_First #ifdef __GNUG__ #pragma interface #endif #include "RefCounted.h" #include "Ink.h" class WindowColorMap; class DevBitmap; //---- ColorMapper ------------------------------------------------------------- class ColorMapper : public RefCounted { static int cnt; int id; public: MetaDef(ColorMapper); ColorMapper(); int GetId() { return id; } virtual bool ChangeRGB(u_long pixel, RGB *rgb); virtual void Pixel2RGB(u_long pixel, RGB *result); virtual bool RGB2Pixel(RGB *rgb, u_long *pixel); virtual bool IsGrey(); virtual u_long MaxPixel(); virtual bool HasMask(); virtual DevBitmap *MapColors(WindowColorMap *wcm, DevBitmap *from, int d); OStream& PrintOn(OStream&); IStream& ReadFrom(IStream&); }; //---- MonoMapper -------------------------------------------------------------- class MonoMapper : public ColorMapper { public: MetaDef(MonoMapper); MonoMapper(); u_long MaxPixel(); bool IsGrey(); void Pixel2RGB(u_long pixel, RGB *result); bool RGB2Pixel(RGB *rgb, u_long *pixel); bool ChangeRGB(u_long pixel, RGB *rgb); }; //---- IndexMapper ---------------------------------------------------------------- class IndexMapper : public ColorMapper { public: MetaDef(IndexMapper); IndexMapper(int sz); bool IsGrey(); u_long MaxPixel(); bool ChangeRGB(u_long pixel, RGB *rgb); void Pixel2RGB(u_long pixel, RGB *result); bool RGB2Pixel(RGB *rgb, u_long *pixel); bool HasMask(); DevBitmap *MapColors(WindowColorMap *wcm, DevBitmap *from, int d); OStream& PrintOn(OStream&); IStream& ReadFrom(IStream&); protected: void Expand(int sz); ~IndexMapper(); private: int size, maxsize; RGB *map; bool mask; }; //---- DirectMapper ------------------------------------------------------------ class DirectMapper : public ColorMapper { public: MetaDef(DirectMapper); DirectMapper(); u_long MaxPixel(); bool IsGrey(); void Pixel2RGB(u_long pixel, RGB *result); bool RGB2Pixel(RGB *rgb, u_long *pixel); DevBitmap *MapColors(WindowColorMap *wcm, DevBitmap *from, int d); }; #endif