home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Computer Panoráma
/
computer_panorama_1997-12-hibas.iso
/
SHARE
/
GRAPH
/
PTC051.ZIP
/
SRC
/
IFACE.H
< prev
next >
Wrap
C/C++ Source or Header
|
1997-09-22
|
8KB
|
208 lines
//////////////////////
// device interface //
//////////////////////
#ifndef __INTERFACE_H
#define __INTERFACE_H
#include "lang.h"
#include "misc.h"
#include "list.h"
#include "rect.h"
#include "color.h"
#include "config.h"
#include "format.h"
#include "native.h"
#include "convert.h"
#include "effects.h"
#include "globals.h"
#include "palette.h"
#include "classes.h"
// surface "handle"
typedef void* HSURFACE;
// surface information struct
struct SURFACEINFO
{
int type; // type of surface
int height; // height of surface
int width; // width of surface
int layout; // memory layout
int advance; // surface line advance
int area; // area of surface (pixels)
int size; // size of surface (bytes)
FORMAT format; // surface format
};
// interface info
struct INFO
{
// name
char name[8]; // interface name
// surfaces
uint system : 1; // interface allows system surfaces
uint video : 1; // interface allows video surfaces
uint primary : 1; // interface allows primary surface manipulation
// layouts
uint linear : 1; // interface is capable of setting modes with linear layout
uint banked : 1; // interface is capable of setting modes with banked layout
uint planar : 1; // interface is capable of setting modes with planar layout
uint fakemode : 1; // interface is capable of setting modes with fakemode layout
// output
uint fullscreen : 1; // interface is capable of fullscreen output
uint windowed : 1; // interface is capable of windowed output
// modeset
uint frequency : 1; // interface is able to work with mode refresh frequency
// acceleration
uint clear : 1; // interface is capable of hardware accelerated clears
uint bitblt : 1; // interface is capable of hardware accelerated bitblt
uint stretchblt : 1; // interface is capable of hardware accelerated stretchblt
};
// mode info
struct MODE
{
char i[8]; // interface name
int x; // x resolution
int y; // y resolution
FORMAT format; // pixel format
int layout; // memory layout
int output; // output method
int frequency; // video refresh frequency
};
class Interface
{
// friend classes
friend class Surface;
public:
// virtual destructor
virtual ~Interface() {};
// interface information
virtual INFO GetInfo() = 0;
virtual int GetModeList(List<MODE> &modelist) = 0;
// display mode routines
virtual int SetMode(MODE const &info) = 0;
virtual int SetMode(int x,int y,int id,int layout,int output,int frequency) = 0;
virtual int SetMode(int x,int y,FORMAT const &format,int layout,int output,int frequency) = 0;
virtual int QueryMode(MODE const &info) = 0;
virtual int QueryMode(int x,int y,int id,int layout,int output,int frequency) = 0;
virtual int QueryMode(int x,int y,FORMAT const &format,int layout,int output,int frequency) = 0;
virtual MODE GetMode() = 0;
// palette routines
virtual int SetPalette(Palette &palette) = 0;
virtual int GetPalette(Palette &palette) = 0;
// hardware functions
virtual int WaitForRetrace() = 0;
virtual int SaveState() = 0;
virtual int RestoreState() = 0;
// primary surface operations
virtual int SetPrimary(Surface &surface) = 0;
virtual Surface* GetPrimary() = 0;
virtual int SetOrigin(int x,int y) = 0;
virtual int GetOrigin(int &x,int &y) = 0;
// video memory management
virtual int GetTotalVideoMemory() = 0;
virtual int GetFreeVideoMemory() = 0;
virtual int CompactVideoMemory() = 0;
// console routines
virtual int getch() = 0;
virtual int kbhit() = 0;
virtual int keydown(int key) = 0;
// native access
virtual void* GetNative() = 0;
virtual int NativeType() = 0;
// data access
virtual void GetName(char name[]) const = 0;
virtual int GetXResolution() const = 0;
virtual int GetYResolution() const = 0;
virtual int GetBitsPerPixel() const = 0;
virtual int GetBytesPerPixel() const = 0;
virtual int GetLayout() const = 0;
virtual int GetOutput() const = 0;
virtual int GetFrequency() const = 0;
virtual FORMAT GetFormat() const = 0;
virtual HWINDOW GetWindow() const = 0;
// object state
virtual int ok() const = 0;
protected:
// surface management
virtual HSURFACE RequestSurface(Surface &owner,int x,int y,FORMAT const &format,int type,int layout,int advance) = 0;
virtual void FreeSurface(HSURFACE handle) = 0;
virtual void* LockSurface(HSURFACE handle,int wait) = 0;
virtual void UnlockSurface(HSURFACE handle) = 0;
virtual int GetSurfaceLockCount(HSURFACE handle) = 0;
virtual int RestoreSurface(HSURFACE handle) = 0;
virtual SURFACEINFO GetSurfaceInfo(HSURFACE handle) = 0;
virtual void* GetNativeSurface(HSURFACE handle) = 0;
virtual int GetNativeSurfaceType(HSURFACE handle) = 0;
virtual void SetOwnerSurface(HSURFACE handle,Surface *owner) = 0;
// surface clear
virtual int Clear(Surface &surface,COLOR const &color) = 0;
virtual int Clear(Surface &surface,RECTANGLE const &rect,COLOR const &color) = 0;
// surface update
virtual int Update(Surface &src,void *extra) = 0;
virtual int Update(Surface &src,RECTANGLE const &rect,void *extra) = 0;
virtual int Update(Surface &src,RECTANGLE const &dest_rect,RECTANGLE const &src_rect,void *extra) = 0;
// surface bitblt
virtual int BitBlt(Surface &src,Surface &dest,EFFECTS const *effects,void *extra) = 0;
virtual int BitBlt(Surface &src,Surface &dest,RECTANGLE const &rect,EFFECTS const *effects,void *extra) = 0;
virtual int BitBlt(Surface &src,RECTANGLE const &src_rect,
Surface &dest,RECTANGLE const &dest_rect,EFFECTS const *effects,void *extra) = 0;
// surface stretchblt
virtual int StretchBlt(Surface &src,Surface &dest,EFFECTS const *effects,void *extra) = 0;
virtual int StretchBlt(Surface &src,Surface &dest,RECTANGLE const &rect,EFFECTS const *effects,void *extra) = 0;
virtual int StretchBlt(Surface &src,RECTANGLE const &src_rect,
Surface &dest,RECTANGLE const &dest_rect,EFFECTS const *effects,void *extra) = 0;
};
#endif