/**************************************************************
$Id$
**************************************************************/
#ifndef OBJGFX30_H
#define OBJGFX30_H
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#define gm320x200x256 0x13
#define gm640x480x256 0x101
#define gm800x600x256 0x103
#define gm1024x768x256 0x105
#define gm1280x1024x256 0x107
/* 32768 color video mode constants */
#define gm640x480x32k 0x110
#define gm800x600x32k 0x113
#define gm1024x768x32k 0x116
#define gm1280x1024x32k 0x119
/* 65536 color video mode constants */
#define gm640x480x64k 0x111
#define gm800x600x64k 0x114
#define gm1024x768x64k 0x117
#define gm1280x1024x64k 0x11A
/* 16.8 million color video mode constants */
#define gm640x480x16m 0x112
#define gm800x600x16m 0x115
#define gm1024x768x16m 0x118
#define gm1280x1024x16m 0x11B
typedef signed char Int8;
typedef signed short int Int16;
typedef signed long int Int32;
typedef unsigned char UInt8;
typedef unsigned short int UInt16;
typedef unsigned long int UInt32;
enum og_DataState { og_None, og_Owner, og_Aliasing };
typedef struct {
UInt8 red;
UInt8 green;
UInt8 blue;
} TRGB;
typedef struct {
UInt16 ModeAttributes;
UInt8 WindowAFlags;
UInt8 WindowBFlags;
UInt16 Granularity;
UInt16 WindowSize;
UInt16 WindowASeg;
UInt16 WindowBSeg;
void* BankSwitch;
UInt16 BytesPerLine;
UInt16 xRes, yRes;
UInt8 CharWidth;
UInt8 CharHeight;
UInt8 NumBitPlanes;
UInt8 BitsPerPixel;
UInt8 NumberOfBanks;
UInt8 MemoryModel;
UInt8 BankSize;
UInt8 NumOfImagePages;
UInt8 Reserved;
// Direct colour fields (required for Direct/6 and YUV/7 memory models
UInt8 RedMaskSize;
UInt8 RedFieldPosition;
UInt8 GreenMaskSize;
UInt8 GreenFieldPosition;
UInt8 BlueMaskSize;
UInt8 BlueFieldPosition;
UInt8 RsvdMaskSize;
UInt8 RsvdFieldPosition;
UInt8 DirectColourMode;
// VESA 2.0 specific fields
UInt32 PhysBasePtr;
void* OffScreenMemOffset;
UInt16 OffScreenMemSize;
UInt8 paddington[461];
} TMode_Rec;
typedef struct {
char VBESignature[4];
UInt8 minVersion;
UInt8 majVersion;
char * OEMStringPtr;
UInt32 Capabilities;
UInt16* VideoModePtr;
UInt16 TotalMemory;
// VESA 2.0 specific fields
UInt16 OEMSoftwareRev;
char * OEMVendorNamePtr;
char * OEMProductNamePtr;
char * OEMProductRevPtr;
UInt8 paddington[474];
} TVESA_Rec;
typedef struct {
UInt8 BPP;
UInt8 RedFieldPosition;
UInt8 GreenFieldPosition;
UInt8 BlueFieldPosition;
UInt8 RedMaskSize;
UInt8 GreenMaskSize;
UInt8 BlueMaskSize;
} TPixelFmt;
// Default pixel formats
const TPixelFmt def_pixfmt_8bpp = {8,0,0,0,0,0,0};
const TPixelFmt def_pixfmt_15bpp = {15,10,5,0,5,5,5};
const TPixelFmt def_pixfmt_16bpp = {16,11,5,0,5,6,5};
const TPixelFmt def_pixfmt_24bpp = {24,16,8,0,8,8,8};
const TPixelFmt def_pixfmt_32bpp = {32,16,8,0,8,8,8};
class TGfx0 {
protected:
TGfx0* Owner;
void* Buffer;
UInt32* LineOfs;
TRGB* pal;
UInt32 xRes, yRes;
UInt32 MaxX, MaxY;
UInt32 bSize; // buffer size (in bytes)
UInt32 lSize; // LineOfs size (in bytes)
UInt32 TransparentColor;
og_DataState DataState;
UInt8 BPP; // bits per pixel
UInt8 RedFieldPosition;
UInt8 GreenFieldPosition;
UInt8 BlueFieldPosition;
UInt8 RedShifter;
UInt8 GreenShifter;
UInt8 BlueShifter;
public:
TGfx0(void);
bool create(UInt32, UInt32,TPixelFmt*);
void flip(TGfx0*);
UInt32 getMaxX(void);
UInt32 getMaxY(void);
UInt32 getpixel(UInt32, UInt32);
void putpixel(UInt32, UInt32, UInt32);
UInt32 RGB(UInt8, UInt8, UInt8);
void setRGBPalette(UInt8, UInt8, UInt8, UInt8);
void unpackRGB(UInt32, UInt8*, UInt8*, UInt8*);
~TGfx0(void);
}; // gfx0
#endif