/************************************************************** $Id$ **************************************************************/ #ifndef OBJGFX30_H #define OBJGFX30_H #include <stdlib.h> // for NULL #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif #define gm320x200x256 0x13 #define gm640x480x256 0x4101 #define gm800x600x256 0x4103 #define gm1024x768x256 0x4105 #define gm1280x1024x256 0x4107 /* 32768 color video mode constants */ #define gm640x480x32k 0x4110 #define gm800x600x32k 0x4113 #define gm1024x768x32k 0x4116 #define gm1280x1024x32k 0x4119 /* 65536 color video mode constants */ #define gm640x480x64k 0x4111 #define gm800x600x64k 0x4114 #define gm1024x768x64k 0x4117 #define gm1280x1024x64k 0x411A /* 16.8 million color video mode constants */ #define gm640x480x16m 0x4112 #define gm800x600x16m 0x4115 #define gm1024x768x16m 0x4118 #define gm1280x1024x16m 0x411B #define RadToDeg 180.0/3.14159265358979; 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; bool AntiAlias; bool clipLine(Int32&, Int32&, Int32&, Int32&); void rawLine(UInt32, UInt32, UInt32, UInt32, UInt32); public: TGfx0(void); bool alias(TGfx0&, UInt32, UInt32, UInt32, UInt32); void arc(UInt32, UInt32, UInt32, UInt32, UInt32, UInt32); void bar(Int32, Int32, Int32, Int32, UInt32); // void bSpline void circle(Int32, Int32, UInt32, UInt32); bool create(UInt32, UInt32, TPixelFmt); void clear(UInt32); void clone(TGfx0&); void copy(TGfx0&); void copyBuf(Int32, Int32, TGfx0&, Int32, Int32, Int32, Int32); // cubicBezierCurve // curve // drawpoly UInt8 getBPP(void); void * getBufferPtr(void); og_DataState getDataState(void); UInt32 * getLineOfsPtr(void); TRGB * getPalPtr(void); UInt32 getMaxX(void); UInt32 getMaxY(void); // getPal void getPixFmt(TPixelFmt&); UInt32 getPixel(Int32, Int32); UInt32 getTransparentColor(void); void hFlip(void); void hLine(Int32, Int32, Int32, UInt32); void line(Int32, Int32, Int32, Int32, UInt32); // loadPal void putPixel(UInt32, UInt32, UInt32); void rect(Int32, Int32, Int32, Int32, UInt32); UInt32 RGB(UInt8, UInt8, UInt8); // savePal void setRGBPalette(UInt8, UInt8, UInt8, UInt8); void setTransparentColor(UInt32); void unpackRGB(UInt32, UInt8&, UInt8&, UInt8&); void vLine(Int32, Int32, Int32, UInt32); void vFlip(void); ~TGfx0(void); }; // TGfx0 class TScreen: public TGfx0 { protected: TVESA_Rec* VESARec; TMode_Rec* ModeRec; bool InGraphics; public: TScreen(void); void setupMode(UInt16); ~TScreen(void); }; // TScreen #endif