00001
00008 #ifndef FILTER2_H
00009 #define FILTER2_H
00010
00011 #include <string.h>
00012 #include "GContainers.h"
00013 #include "GProperties.h"
00014
00015
00016 #define LGI_FILTER_ERROR "ErrorMsg"
00017 #define LGI_FILTER_COLOUR_PROF "ColourProfile"
00018
00019 LgiFunc int FindHeader(int Offset, char *Str, GFile &f);
00020
00022 #define FILTER_CAP_READ 0x0001
00023
00024 #define FILTER_CAP_WRITE 0x0002
00025
00026 #define FILTER_CAP_INFO 0x0004
00027
00031 class LgiClass GFilter : public GFile
00032 {
00033 protected:
00034 GBmpMem *GetSurface(GDeviceContext *pDC) { return pDC->pMem; }
00035 GRect *GetClip(GDeviceContext *pDC) { return &pDC->Clip; }
00036 int GetLineLength(GDeviceContext *pDC) { return (pDC->pMem) ? pDC->pMem->Line : 0; }
00037
00038 Progress *Meter;
00039
00040 public:
00041 ObjProperties Props;
00042
00043 GFilter() { Meter = 0; }
00044 virtual ~GFilter() {}
00045
00047 Progress *GetProgress() { return Meter; }
00049 void SetProgress(Progress *Prg) { Meter = Prg; }
00050
00053 virtual int GetCapabilites() { return 0; }
00055 virtual int GetImages() { return 1; }
00058 virtual bool ReadImage(GSurface *pDC) { return false; }
00061 virtual bool WriteImage(GSurface *pDC) { return false; }
00062 };
00063
00064 #define GDC_RLE_COLOUR 0x0001
00065 #define GDC_RLE_MONO 0x0002
00066 #define GDC_RLE_READONLY 0x0004
00067 #define GDC_RLE_KEY 0x0008 // set if valid
00068
00069 class LgiClass GdcRleDC : public GMemDC
00070 {
00071 protected:
00072 COLOUR Key;
00073
00074 int Flags;
00075 int Length;
00076 int Alloc;
00077 uchar *Data;
00078 uchar **ScanLine;
00079
00080 bool SetLength(int Len);
00081 bool FindScanLines();
00082 void Empty();
00083
00084 public:
00085 GdcRleDC();
00086 virtual ~GdcRleDC();
00087
00088 void Move(GdcRleDC *pDC);
00089
00090 bool Create(int x, int y, int Bits, int LineLen = 0);
00091 bool CreateInfo(int x, int y, int Bits);
00092 void ReadOnly(bool Read);
00093 bool ReadOnly();
00094 void Mono(bool Mono);
00095 bool Mono();
00096
00097 void Update(int Flags);
00098 void Draw(GSurface *Dest, int x, int y);
00099
00100 int SizeOf();
00101 bool Read(GFile &F);
00102 bool Write(GFile &F);
00103 };
00104
00105
00107
00111 class LgiClass GFilterFactory
00112 {
00113 static class GFilterFactory *First;
00114 class GFilterFactory *Next;
00115
00118 virtual bool CheckFile
00119 (
00122 char *File,
00124 int Access,
00127 uchar *Hint
00128 ) = 0;
00130 virtual GFilter *NewObject() = 0;
00131
00132 public:
00133 GFilterFactory();
00134 virtual ~GFilterFactory();
00135
00136 static GFilter *New(char *File, int Access, uchar *Hint);
00137 static GFilter *NewAt(int i);
00138 static int GetItems();
00139 };
00140
00141 #endif