home *** CD-ROM | disk | FTP | other *** search
- // Gscreen.hpp
-
- #ifndef gscreen_hpp
- #define gscreen_hpp
-
- #include <dos.h>
- #include <stdio.h>
-
-
- // ************************************************************************
- // this is the 128 byte header at the front of all PCX files. In 256 color
- // mode 0x13 the palette structure is ignored, and the palette can be found
- // in the last 768 bytes of the file.
- // ************************************************************************
-
- struct pcx_hdr {
- char Mfg; // manufacturer, always 0xa0
- char Ver; // encoder version number
- char Enc; // encoding code, always 1
- char Bpp; // bits per pixel, 8 in mode 0x13
- int Xmin,Ymin; // image origin, usually 0,0
- int Xmax,Ymax; // image dimensions
- int Hres; // horizontal resolution value
- int Vres; // vertical resolution value
- char Pal[48]; // palette (not in mode 0x13)
- char Reserved; // who knows?
- char ClrPlanes; // number of planes, 1 in mode 0x13
- int Bpl; // bytes per line, 80 in mode 0x13
- int PalType; // Grey or Color palette flag
- char Filler[58]; // Zsoft wanted a 128 byte header
- };
-
-
- class Gscreen {
- int mode, maxx, maxy;
- char far colregs[3*256]; // Array of color register values
- char far *image_ptr;
- pcx_hdr *pcxh;
- public:
- Gscreen (int=0, int=0, int=0);
- ~Gscreen (void);
- void setmode (int=0);
- int Maxx (void) {return maxx;};
- int Maxy (void) {return maxy;};
- void display ();
- const char far *unpackpcx (char*);
- void setpalette (void);
- void wait_for_vbl (void);
- };
-
-
- class BitMap {
- const char far *image_ptr;
- int maxx, maxy;
- int totalx, totaly;
- int blockx, blocky;
- int countx, county;
- int screnx, screny;
- void wait_for_vbl (void);
- public:
- BitMap (const char far *ptr) {image_ptr=ptr;}
- void set (int mx, int my, int tx, int ty, int bx, int by, int cx, int cy) {
- maxx=mx; maxy=my;
- totalx=tx; totaly=ty;
- blockx=bx; blocky=by;
- countx=cx; county=cy;
- }
- void display (int, int, int, int);
- void erase (void);
- ~BitMap (void) {delete (void*)image_ptr;}
- };
-
-
-
-
- /*
- Interpretation:
-
- Mfg : this byte is always 0x0a for a valid PCX file
- Ver : if Ver == 0 the file is from PC Paintbrush 2.5,
- Ver == 2 the file is from 2.8, and has a palette
- Ver == 3 the file is from 2.8, but has no palette
- Ver == 5 the file is from 3.0 or later
- Enc : encoding scheme, always 1
- Bpp : number of bits ber pixel (8 in mode 13h)
- Xmin : the screen x origin, usually 0
- Ymin : the screen y origin, usually 0
- Xmax : the screen max x, for example Xmin = 0, Xmax = 639
- Ymax : the screen max y, for example Ymin = 0, Ymax = 479
- Hres : the number of pixels in x, for example Hres = 640
- Vres : the number of pixels in y, for example Vres = 480
- Pal[48] : 16 3-byte palette registers, ignored in 256 color PCX's
- ClrPlanes : number of planes, _lines stored interleaved_
- Bpl : number of bytes in one line, for example, 80 in 640 mode
- PalType : 1 if palette is grey scale, 2 if full color
-
- */
-
-
- #endif