DisplayDriver class


The DisplayDriver class is not a useful class unto itself. It is to provide a consistent interface for the rest of the app_server to whatever rendering context it is utilizing, whether it be a remote screen, a ServerBitmap, installed graphics hardware, or whatever. Documentation below will describe the role of each function.





Member Functions


DisplayDriver(void)

~DisplayDriver(void)

bool Initialize(void)

void Shutdown(void)

void DrawBitmap(ServerBitmap *bmp, SRect src, SRect dest)

void DrawChar(char c, SPoint pt)

void DrawString(const char *string, int32 length, SPoint pt, escapement_delta *delta=NULL)

void Stroke/FillBezier(SPoint *pts, layerdata *d, int8 *pat)

void Stroke/FillEllipse(SRect r, layerdata *d, int8 *pattern)

void Stroke/FillArc(SRect r, float angle, float span, layerdata *d, int8 *pattern)

void StrokeLine(SPoint start, SPoint end, layerdata *d, int8 *pattern)

void StrokePolygon(SPoint *ptlist, int32 numpts, SRect rect, layerdata *d, int8 *pattern, bool is_closed=true)

void FillPolygon(SPoint *ptlist, int32 numpts, SRect rect, layerdata *d, int8 *pattern)

void Stroke/FillRect(SRect r, layerdata *d, int8 *pattern)

void Stroke/FillRoundRect(SRect r, float xrad, float yrad, layerdata *d, int8 *pattern)

void Stroke/FillShape(SShape *sh, layerdata *d, int8 *pattern)

void Stroke/FillTriangle(SPoints *pts, SRect r, layerdata *d, int8 *pattern)

void StrokeLineArray(SPoint *pts, int32 numlines, rgb_color *colors, layerdata *d)

void DrawPicture(SPicture *pic, SPoint pt)

void CopyBits(SRect src, SRect dest)

void InvertRect(SRect r)

uint8 GetDepth(void)

uint16 GetHeight(void)

uint16 GetWidth(void)

screen_mode GetMode(void)

void SetMode(screen_mode mode)

bool DumpToFile(const char *path)

 





DisplayDriver(void)

~DisplayDriver(void)

bool Initialize(void)

void Shutdown(void)


These four are for general start and stop procedures. The constructor and destructor concern themselves with the internal members common to all drivers, such as the current cursor and the access semaphore. Subclasses will probably end up using these to handle memory allocation-related issues, but likely not much else. Initialize() and Shutdown() are for general setup internal to the module. Note that if Initialize() returns false, the server will not use the module, call Shutdown(), and then delete it as accordingly.


void CopyBits(SRect src, SRect dest)

void InvertRect(SRect r)

void DrawBitmap(ServerBitmap *bmp, SRect src, SRect dest, render_mode mode)

void DrawPicture(SPicture *pic, SPoint pt)

void DrawChar(char c, SPoint pt)

void DrawString(const char *string, int32 length, SPoint pt, escapement_delta *delta=NULL)


void StrokeArc(SRect r, float angle, float span, layerdata *d, int8 *pattern)

void FillArc(SRect r, float angle, float span, layerdata *d, int8 *pattern)

void StrokeBezier(SPoint *pts, layerdata *d, int8 *pat)

void FillBezier(SPoint *pts, layerdata *d, int8 *pat)

void StrokeEllipse(SRect r, layerdata *d, int8 *pattern)

void FillEllipse(SRect r, layerdata *d, int8 *pattern)

void StrokeLine(SPoint start, SPoint end, layerdata *d, int8 *pattern)

void StrokeLineArray(SPoint *pts, int32 numlines, rgb_color *colors, layerdata *d)

void StrokePolygon(SPoint *ptlist, int32 numpts, SRect rect, layerdata *d, int8 *pattern, bool is_closed=true)

void FillPolygon(SPoint *ptlist, int32 numpts, SRect rect, layerdata *d, int8 *pattern)

void StrokeRect(SRect r, layerdata *d, int8 *pattern)

void FillRect(SRect r, layerdata *d, int8 *pattern)

void StrokeRoundRect(SRect r, float xrad, float yrad, layerdata *d, int8 *pattern)

void FillRoundRect(SRect r, float xrad, float yrad, layerdata *d, int8 *pattern)

void StrokeShape(SShape *sh, layerdata *d, int8 *pattern)

void FillShape(SShape *sh, layerdata *d, int8 *pattern)

void StrokeTriangle(SPoints *pts, SRect r, layerdata *d, int8 *pattern)

void FillTriangle(SPoints *pts, SRect r, layerdata *d, int8 *pattern)


These drawing functions are the meat and potatoes of the graphics module. Defining any or all of them is completely optional. However, the default versions of these functions will do nothing. Thus, implementing them is likely a good idea, even if not required.



uint8 GetDepth(void)

uint16 GetHeight(void)

uint16 GetWidth(void)

screen_mode GetMode(void)

void SetMode(screen_mode mode)


These five functions are called internally in order to get information about the current state of the buffer in the module. GetDepth should return 8, 16, or 32, in any event because the server handles RGB color spaces of these depths only.


bool DumpToFile(const char *path)


DumpToFile is completely optional, providing a hook which allows screenshots to be taken. The default version does nothing but return false. If a screenshot is successful, return true.