haiku/docs/develop/servers/app_server/DisplayDriver.htm
DarkWyrm d5d7a2437a Many, many API updates
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2176 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-12-07 21:39:48 +00:00

291 lines
15 KiB
HTML

<HTML>
<HEAD>
<TITLE>DisplayDriver.htm</TITLE>
<style type="text/css">
<!--
.Default {background-color: rgb(255,255,255); color: rgb(0,0,0); font-family: 'Dutch801 Rm BT'; font-size: 12pt}
.OBOS-Function-Def {background-color: rgb(255,255,255); color: rgb(0,0,0); font-family: 'Dutch801 Rm BT'; font-size: 16pt}
.OBOS-Title {background-color: rgb(255,255,255); color: rgb(0,128,0); font-family: 'Dutch801 Rm BT'; font-size: 24pt}
.Text-Background {background-color: rgb(255,255,255)}
.GR-Default {}
.Body {margin: 0px}
.Footer {margin: 0px}
.Header {margin: 0px}
.WP-Default {text-align: left; text-indent: 0px; margin-left: 0px; margin-right: 0px}
-->
</style>
</HEAD>
<BODY BGCOLOR="#ffffff">
<DIV class="sheet" id="Sheet 1">
<P class="Body" style="margin: 0px"><span class="OBOS-Title">DisplayDriver class</span><span style="color: rgb(0,0,0); font-size: 24pt"></span></P>
<P class="Body" style="margin: 0px"><BR>
</P>
<P class="Body" style="margin: 0px">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.</P>
<P class="Body" style="margin: 0px">
<HR>
</P>
<P class="Body" style="margin: 0px">Member Functions</P>
<P class="Body" style="margin: 0px"><BR>
</P>
<TABLE WIDTH=464 HEIGHT=474 BORDER=1 CELLPADDING=1 CELLSPACING=2>
<TR>
<TD WIDTH=224 HEIGHT=17>
<P class="Body" style="margin: 0px">DisplayDriver(void)</P>
</TD>
<TD WIDTH=240 HEIGHT=17>
<P class="Body" style="margin: 0px">~DisplayDriver(void)</P>
</TD>
</TR>
<TR>
<TD WIDTH=224 HEIGHT=17>
<P class="Body" style="margin: 0px">bool Initialize(void)</P>
</TD>
<TD WIDTH=240 HEIGHT=17>
<P class="Body" style="margin: 0px">void Shutdown(void)</P>
</TD>
</TR>
<TR>
<TD WIDTH=224 HEIGHT=32>
<P class="Body" style="margin: 0px">void DrawBitmap(ServerBitmap *bmp, BRect src, BRect dest)</P>
</TD>
<TD WIDTH=240 HEIGHT=32>
<P class="Body" style="margin: 0px">void DrawChar(char c, BPoint pt)</P>
</TD>
</TR>
<TR>
<TD WIDTH=224 HEIGHT=47>
<P class="Body" style="margin: 0px">void DrawString(const char *string, int32 length, BPoint pt, escapement_delta *delta=NULL)</P>
</TD>
<TD WIDTH=240 HEIGHT=47>
<P class="Body" style="margin: 0px">void Stroke/FillBezier(BPoint *pts, layerdata *d, int8 *pat)</P>
</TD>
</TR>
<TR>
<TD WIDTH=224 HEIGHT=32>
<P class="Body" style="margin: 0px">void Stroke/FillEllipse(BRect r, layerdata *d, int8 *pattern)</P>
</TD>
<TD WIDTH=240 HEIGHT=32>
<P class="Body" style="margin: 0px">void Stroke/FillArc(BRect r, float angle, float span, layerdata *d, int8 *pattern)</P>
</TD>
</TR>
<TR>
<TD WIDTH=224 HEIGHT=47>
<P class="Body" style="margin: 0px">void StrokeLine(BPoint start, BPoint end, layerdata *d, int8 *pattern)</P>
</TD>
<TD WIDTH=240 HEIGHT=47>
<P class="Body" style="margin: 0px">void StrokePolygon(BPoint *ptlist, int32 numpts, BRect rect, layerdata *d, int8 *pattern, bool is_closed=true)</P>
</TD>
</TR>
<TR>
<TD WIDTH=224 HEIGHT=47>
<P class="Body" style="margin: 0px">void FillPolygon(BPoint *ptlist, int32 numpts, BRect rect, layerdata *d, int8 *pattern)</P>
</TD>
<TD WIDTH=240 HEIGHT=47>
<P class="Body" style="margin: 0px">void Stroke/FillRect(BRect r, layerdata *d, int8 *pattern)</P>
</TD>
</TR>
<TR>
<TD WIDTH=224 HEIGHT=47>
<P class="Body" style="margin: 0px">void Stroke/FillRoundRect(BRect r, float xrad, float yrad, layerdata *d, int8 *pattern)</P>
</TD>
<TD WIDTH=240 HEIGHT=47>
<P class="Body" style="margin: 0px">void Stroke/FillShape(SShape *sh, layerdata *d, int8 *pattern)</P>
</TD>
</TR>
<TR>
<TD WIDTH=224 HEIGHT=32>
<P class="Body" style="margin: 0px">void Stroke/FillTriangle(BPoints *pts, BRect r, layerdata *d, int8 *pattern)</P>
</TD>
<TD WIDTH=240 HEIGHT=32>
<P class="Body" style="margin: 0px">void StrokeLineArray(BPoint *pts, int32 numlines, rgb_color *colors, layerdata *d)</P>
</TD>
</TR>
<TR>
<TD WIDTH=224 HEIGHT=22>
<P class="Body" style="margin: 0px">void DrawPicture(SPicture *pic, BPoint pt)</P>
</TD>
<TD WIDTH=240 HEIGHT=22>
<P class="Body" style="margin: 0px">void CopyBits(BRect src, BRect dest)</P>
</TD>
</TR>
<TR>
<TD WIDTH=224 HEIGHT=17>
<P class="Body" style="margin: 0px">void InvertRect(BRect r)</P>
</TD>
<TD WIDTH=240 HEIGHT=17>
<P class="Body" style="margin: 0px">uint8 GetDepth(void)</P>
</TD>
</TR>
<TR>
<TD WIDTH=224 HEIGHT=17>
<P class="Body" style="margin: 0px">uint16 GetHeight(void)</P>
</TD>
<TD WIDTH=240 HEIGHT=17>
<P class="Body" style="margin: 0px">uint16 GetWidth(void)</P>
</TD>
</TR>
<TR>
<TD WIDTH=224 HEIGHT=17>
<P class="Body" style="margin: 0px">screen_mode GetMode(void)</P>
</TD>
<TD WIDTH=240 HEIGHT=17>
<P class="Body" style="margin: 0px">void SetMode(screen_mode mode)</P>
</TD>
</TR>
<TR>
<TD WIDTH=224 HEIGHT=17>
<P class="Body" style="margin: 0px">bool DumpToFile(const char *path)</P>
</TD>
<TD WIDTH=240 HEIGHT=17>
<P class="Body" style="margin: 0px">void ShowCursor(void)</P>
</TD>
</TR>
<TR>
<TD WIDTH=224 HEIGHT=17>
<P class="Body" style="margin: 0px">void HideCursor(void)</P>
</TD>
<TD WIDTH=240 HEIGHT=17>
<P class="Body" style="margin: 0px">void ObscureCursor(void)</P>
</TD>
</TR>
<TR>
<TD WIDTH=224 HEIGHT=17>
<P class="Body" style="margin: 0px">bool IsCursorHidden(void)</P>
</TD>
<TD WIDTH=240 HEIGHT=17>
<P class="Body" style="margin: 0px">void SetCursor(ServerCursor *csr)</P>
</TD>
</TR>
<TR>
<TD WIDTH=224 HEIGHT=32>
<P class="Body" style="margin: 0px">virtual float StringWidth(const char *string, int32 length, LayerData *d)</P>
</TD>
<TD WIDTH=240 HEIGHT=32>
<P class="Body" style="margin: 0px">virtual float StringHeight(const char *string, int32 length, LayerData *d)</P>
</TD>
</TR>
</TABLE>
<P class="Body" style="margin: 0px"><BR>
<BR>
Protected Functions</P>
<P class="Body" style="margin: 0px"><BR>
</P>
<TABLE WIDTH=533 HEIGHT=90 BORDER=1 CELLPADDING=1 CELLSPACING=2>
<TR>
<TD WIDTH=200 HEIGHT=17>
<P class="Body" style="margin: 0px">void Lock(void)</P>
</TD>
<TD WIDTH=200 HEIGHT=17>
<P class="Body" style="margin: 0px">void Unlock(void)</P>
</TD>
</TR>
<TR>
<TD WIDTH=200 HEIGHT=17>
<P class="Body" style="margin: 0px">void SetDepth(void)</P>
</TD>
<TD WIDTH=200 HEIGHT=17>
<P class="Body" style="margin: 0px">void SetHeight(void)</P>
</TD>
</TR>
<TR>
<TD WIDTH=200 HEIGHT=17>
<P class="Body" style="margin: 0px">void SetWidth(void)</P>
</TD>
<TD WIDTH=200 HEIGHT=17>
<P class="Body" style="margin: 0px">void SetMode(void)</P>
</TD>
</TR>
<TR>
<TD WIDTH=200 HEIGHT=17>
<P class="Body" style="margin: 0px">void SetCursorHidden(void)</P>
</TD>
<TD WIDTH=200 HEIGHT=17>
<P class="Body" style="margin: 0px">void SetCursorObscured(void)</P>
</TD>
</TR>
</TABLE>
<P class="Body" style="margin: 0px"><BR>
<BR>
<HR>
</P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">DisplayDriver(void)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">~DisplayDriver(void)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">bool Initialize(void)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void Shutdown(void)</span></P>
<P class="Body" style="margin: 0px"><BR>
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.</P>
<P class="Body" style="margin: 0px"><BR>
<span class="OBOS-Function-Def">void CopyBits(BRect src, BRect dest)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void InvertRect(BRect r)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void DrawBitmap(ServerBitmap *bmp, BRect src, BRect dest, render_mode mode)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void DrawPicture(SPicture *pic, BPoint pt)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void DrawChar(char c, BPoint pt)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void DrawString(const char *string, int32 length, BPoint pt, escapement_delta *delta=NULL)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def"><BR>
void StrokeArc(BRect r, float angle, float span, layerdata *d, int8 *pattern)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void FillArc(BRect r, float angle, float span, layerdata *d, int8 *pattern)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void StrokeBezier(BPoint *pts, layerdata *d, int8 *pat)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void FillBezier(BPoint *pts, layerdata *d, int8 *pat)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void StrokeEllipse(BRect r, layerdata *d, int8 *pattern)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void FillEllipse(BRect r, layerdata *d, int8 *pattern)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void StrokeLine(BPoint start, BPoint end, layerdata *d, int8 *pattern)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void StrokeLineArray(BPoint *pts, int32 numlines, rgb_color *colors, layerdata *d)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void StrokePolygon(BPoint *ptlist, int32 numpts, BRect rect, layerdata *d, int8 *pattern, bool is_closed=true)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void FillPolygon(BPoint *ptlist, int32 numpts, BRect rect, layerdata *d, int8 *pattern)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void StrokeRect(BRect r, layerdata *d, int8 *pattern)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void FillRect(BRect r, layerdata *d, int8 *pattern)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void StrokeRoundRect(BRect r, float xrad, float yrad, layerdata *d, int8 *pattern)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void FillRoundRect(BRect r, float xrad, float yrad, layerdata *d, int8 *pattern)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void StrokeShape(SShape *sh, layerdata *d, int8 *pattern)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void FillShape(SShape *sh, layerdata *d, int8 *pattern)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void StrokeTriangle(BPoints *pts, BRect r, layerdata *d, int8 *pattern)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void FillTriangle(BPoints *pts, BRect r, layerdata *d, int8 *pattern)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void ShowCursor(void)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void HideCursor(void)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void ObscureCursor(void)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">bool IsCursorHidden(void)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void SetCursor(ServerCursor *csr)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">float StringWidth(const char *string, int32 length, LayerData *d)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">float StringHeight(const char *string, int32 length, LayerData *d)</span></P>
<P class="Body" style="margin: 0px"><BR>
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.</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">uint8 GetDepth(void)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">uint16 GetHeight(void)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">uint16 GetWidth(void)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">screen_mode GetMode(void)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void SetMode(screen_mode mode)</span></P>
<P class="Body" style="margin: 0px"><BR>
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.</P>
<P class="Body" style="margin: 0px"><BR>
<span class="OBOS-Function-Def">bool DumpToFile(const char *path)</span></P>
<P class="Body" style="margin: 0px"><BR>
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.</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">void Lock(void)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void Unlock(void)</span></P>
<P class="Body" style="margin: 0px"><BR>
These two functions provide a locking scheme for the driver in order to easily make it thread safe. Note that it is not publicly callable.</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">void SetDepthInternal(uint8 d)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void SetHeightInternal(uint16 h)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void SetWidthInternal(uint16 w)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void SetModeInternal(int32 m)</span></P>
<P class="Body" style="margin: 0px"><BR>
These four functions set the internal state variables for height, width, etc. If the driver reimplements the public members SetDepth(), etc, be sure to call the respective internal call so that calls to GetDepth(), etc. return the proper values.</P>
<P class="Body" style="margin: 0px"><BR>
<BR>
<span class="OBOS-Function-Def">void SetCursorHidden(bool state)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">void SetCursorObscured(bool state)</span></P>
<P class="Body" style="margin: 0px"><span class="OBOS-Function-Def">bool IsCursorObscured(void)</span></P>
<P class="Body" style="margin: 0px"><BR>
These calls handle internal state tracking so that subclasses don't have to.</P>
<DIV class="layer" id="Layer 1">
</DIV>
</DIV>
</BODY>
</HTML>