/**************************************************************
$Id: objgfx30.h,v 1.6 2003/04/03 04:39:18 reddawg Exp $
**************************************************************/
#ifndef OBJGFX30_H
#define OBJGFX30_H
//#include <stdlib.h> // for NULL, true, false
#define ogVERSION 3.0;
typedef signed char int8;
typedef signed short int int16;
typedef signed long int int32;
typedef signed long long int int64;
typedef unsigned char uInt8;
typedef unsigned short int uInt16;
typedef unsigned long int uInt32;
typedef unsigned long long int uInt64;
enum ogDataState { ogNONE, ogOWNER, ogALIASING };
struct ogRGB {
uInt8 red;
uInt8 green;
uInt8 blue;
};
struct ogRGBA {
uInt8 red;
uInt8 green;
uInt8 blue;
uInt8 alpha;
};
struct ogPoint {
int32 x;
int32 y;
};
typedef
struct ogPixelFmt {
uInt8 BPP;
uInt8 redFieldPosition;
uInt8 greenFieldPosition;
uInt8 blueFieldPosition;
uInt8 alphaFieldPosition;
uInt8 redMaskSize;
uInt8 greenMaskSize;
uInt8 blueMaskSize;
uInt8 alphaMaskSize;
};
// Default pixel formats
const ogPixelFmt OG_NULL_PIXFMT = { 0, 0,0,0,0,0,0,0,0};
const ogPixelFmt OG_PIXFMT_8BPP = { 8, 0,0,0,0,0,0,0,0};
const ogPixelFmt OG_PIXFMT_15BPP = {15, 10,5,0,15,5,5,5,1};
const ogPixelFmt OG_PIXFMT_16BPP = {16, 11,5,0,0,5,6,5,0};
const ogPixelFmt OG_PIXFMT_24BPP = {24, 16,8,0,0,8,8,8,0};
const ogPixelFmt OG_PIXFMT_32BPP = {32, 16,8,0,24,8,8,8,8};
const ogPixelFmt OG_MAC_PIXFMT_16BPP = {16, 8,4,0,12,4,4,4,4};
class ogSurface {
//protected:
public:
float version;
void* buffer;
uInt32* lineOfs;
ogRGBA* pal;
ogSurface* owner;
uInt32 xRes, yRes;
uInt32 maxX, maxY;
uInt32 bSize; // buffer size (in bytes)
uInt32 lSize; // LineOfs size (in bytes)
uInt32 transparentColor;
ogDataState dataState;
uInt32 BPP; // bits per pixel
uInt32 redFieldPosition;
uInt32 greenFieldPosition;
uInt32 blueFieldPosition;
uInt32 alphaFieldPosition;
uInt32 redShifter;
uInt32 greenShifter;
uInt32 blueShifter;
uInt32 alphaShifter;
bool antiAlias;
bool clipLine(int32&, int32&, int32&, int32&);
virtual void rawLine(uInt32, uInt32, uInt32, uInt32, uInt32);
virtual uInt32 rawGetPixel(uInt32, uInt32);
virtual void rawSetPixel(uInt32, uInt32, uInt32);
void aaRawLine(uInt32, uInt32, uInt32, uInt32, uInt32);
// public:
ogSurface(void);
virtual bool ogAlias(ogSurface&, uInt32, uInt32, uInt32, uInt32);
virtual bool ogAvail(void);
void ogArc(int32, int32, uInt32, uInt32, uInt32, uInt32);
void ogBSpline(uInt32, ogPoint*, uInt32, uInt32);
void ogCircle(int32, int32, uInt32, uInt32);
virtual void ogClear(uInt32);
virtual bool ogClone(ogSurface&);
void ogCopy(ogSurface&);
void ogCopyBuf(int32, int32,
ogSurface&, int32, int32, int32, int32);
virtual void ogCopyLineTo(uInt32, uInt32, const void *, uInt32);
virtual void ogCopyLineFrom(uInt32, uInt32, void *, uInt32);
void ogCopyPal(ogSurface&);
virtual bool ogCreate(uInt32, uInt32, ogPixelFmt);
void ogCubicBezierCurve(int32, int32, int32, int32,
int32, int32, int32, int32, uInt32, uInt32);
void ogCurve(int32,int32, int32,int32, int32,int32, uInt32, uInt32);
void ogFillCircle(int32, int32, uInt32, uInt32);
// void ogFillConvexPolygon(uInt32, ogPoint*, uInt32);
void ogFillPolygon(uInt32, ogPoint*, uInt32);
void ogFillRect(int32, int32, int32, int32, uInt32);
void ogFillTriangle(int32,int32, int32,int32, int32,int32, uInt32);
bool ogGetAntiAlias(void) const { return antiAlias; }
uInt8 ogGetBPP(void) const { return BPP; }
ogDataState ogGetDataState(void) const { return dataState; }
uInt32 ogGetMaxX(void) const { return maxX; }
uInt32 ogGetMaxY(void) const { return maxY; }
void ogGetPixFmt(ogPixelFmt&);
virtual uInt32 ogGetPixel(int32, int32);
virtual void * ogGetPtr(uInt32, uInt32);
uInt32 ogGetTransparentColor(void) { return transparentColor; }
void ogHFlip(void);
virtual void ogHLine(int32, int32, int32, uInt32);
void ogLine(int32, int32, int32, int32, uInt32);
virtual bool ogLoadPal(const char *);
void ogPolygon(uInt32, ogPoint*, uInt32);
void ogRect(int32, int32, int32, int32, uInt32);
uInt32 ogRGB(uInt8, uInt8, uInt8);
bool ogSavePal(const char *);
void ogScale(ogSurface&);
void ogScaleBuf(int32, int32, int32, int32,
ogSurface&, int32, int32, int32, int32);
void ogSendSDE(uInt32);
bool ogSetAntiAlias(bool);
virtual void ogSetPixel(int32, int32, uInt32);
virtual void ogSetRGBPalette(uInt8, uInt8, uInt8, uInt8);
uInt32 ogSetTransparentColor(uInt32);
void ogSpline(uInt32, ogPoint*, uInt32, uInt32);
void ogTriangle(int32, int32, int32, int32, int32, int32, uInt32);
void ogUnpackRGB(uInt32, uInt8&, uInt8&, uInt8&);
virtual void ogVFlip(void);
virtual void ogVLine(int32, int32, int32, uInt32);
virtual ~ogSurface(void);
}; // ogSurface
#endif