00001 00011 #ifndef MEMORY_DRAWENV_H 00012 #define MEMORY_DRAWENV_H 00013 00014 #include <basic.h> 00015 00017 00020 class MemoryDrawEnv { 00021 00022 private: 00023 00024 CSPEC cspec; 00025 B bitmap_entity[sizeof(BMP)+sizeof(UB*)*28]; 00026 BMP* bmp; 00027 PAT pat; 00028 mutable GID gid; 00029 00031 void getCSPEC(); 00032 00034 void createBitmap(); 00035 00037 void releaseBitmap() throw(); 00038 00039 public: 00040 00042 MemoryDrawEnv() : bmp(reinterpret_cast<BMP*>(bitmap_entity)), gid(-1) { 00043 bmp->baseaddr[0] = 0; 00044 setrect(bmp->bounds, 0, 0, SCREEN.hpixels, SCREEN.vpixels); 00045 bmp->planes = SCREEN.planes; 00046 bmp->pixbits = SCREEN.pixbits; 00047 pat.spat.kind = 0; 00048 pat.spat.vsize = pat.spat.hsize = 1; 00049 pat.spat.fgcol = 0x10ffffff; 00050 pat.spat.bgcol = 0x10000000; 00051 pat.spat.mask = FILL100; 00052 getCSPEC(); 00053 createBitmap(); 00054 clear(); 00055 } 00056 00058 ~MemoryDrawEnv() { 00059 if (gid > 0){ 00060 gcls_env(gid); 00061 } 00062 releaseBitmap(); 00063 } 00064 00066 00070 void setPos(const PNT& p) { 00071 bmp->bounds.p.lefttop = p; 00072 bmp->bounds.c.right = bmp->bounds.c.left + SCREEN.hpixels; 00073 bmp->bounds.c.bottom = bmp->bounds.c.top + SCREEN.vpixels; 00074 if (gid > 0){ 00075 gcls_env(gid); 00076 } 00077 gid = -1; 00078 } 00079 00081 00085 const PNT& getPos() const { 00086 return bmp->bounds.p.lefttop; 00087 } 00088 00090 00093 void clear() { 00094 gfil_rec(getGID(), bmp->bounds, &pat, 0, G_STORE); 00095 } 00096 00098 00103 GID getGID() const; 00104 00106 00110 const BMP* getBMP() const { 00111 return bmp; 00112 } 00113 00114 }; 00115 00116 #endif // MEMORY_DRAWENV_H