1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
/***************************************************************************
*
* grdevice.h
*
* Graphics device interface
*
* Copyright 1999 - The FreeType Development Team - www.freetype.org
*
*
***************************************************************************/
#ifndef GRDEVICE_H
#define GRDEVICE_H
#include "graph.h"
/********************************************************************
*
* <FuncType>
* grDeviceInitFunc
*
* <Description>
* Simple device initialiser function
*
* <Return>
* error code. 0 means success
*
********************************************************************/
typedef int (*grDeviceInitFunc)( void );
/********************************************************************
*
* <FuncType>
* grDeviceDoneFunc
*
* <Description>
* Simple device finaliser function
*
* <Return>
* error code. 0 means success
*
********************************************************************/
typedef void (*grDeviceDoneFunc)( void );
/********************************************************************
*
* <FuncType>
* grDeviceInitSurfaceFunc
*
* <Description>
* initializes a new surface for the device. This may be a window
* or a video screen, depending on the device.
*
* <Input>
* surface :: handle to target surface
*
* <InOut>
* bitmap :: handle to bitmap descriptor
*
********************************************************************/
typedef int (*grDeviceInitSurfaceFunc)( grSurface* surface,
grBitmap* bitmap );
/********************************************************************
*
* <Struct>
* grDevice
*
* <Description>
* Simple device interface structure
*
* <Fields>
* surface_objsize :: size in bytes of a single surface object for
* this device.
*
* device_name :: name of device, e.g. "x11", "os2pm", "directx" etc..
* init :: device initialisation routine
* done :: device finalisation
* new_surface :: function used to create a new surface (screen or
* window) from the device
*
* num_pixel_modes :: the number of pixel modes supported by this
* device. This value _must_ be set to -1
* default, unless the device provides a
* static set of pixel modes (fullscreen).
*
* pixel_modes :: an array of pixel modes supported by this
* device
*
* <Note>
* the fields "num_pixel_modes" and "pixel_modes" must be
* set by the "init" function.
*
* This allows windowed devices to "discover" at run-time the
* available pixel modes they can provide depending on the
* current screen depth.
*
********************************************************************/
struct grDevice_
{
int surface_objsize;
const char* device_name; /* name of device */
grDeviceInitFunc init;
grDeviceDoneFunc done;
grDeviceInitSurfaceFunc init_surface;
int num_pixel_modes;
grPixelMode* pixel_modes;
};
extern grDeviceChain gr_device_chain[];
extern int gr_num_devices;
#endif /* GRDEVICE_H */