#include <ScreenClient.h>
Inherits PClient.
Public Methods | |
bool | write (const int, const int, const int, const int, const RGBTRIPLE *, const LPBYTE) |
ScreenClient (const TString &) | |
Private Types | |
typedef ScreenClient::screenInfo | screenInfo |
Definition at line 19 of file ScreenClient.h.
|
See the documentation of ScreenPipe::screenInfo |
|
Definition at line 17 of file ScreenClient.cpp.
|
|
Writes a screen buffer to the pipe
Definition at line 36 of file ScreenClient.cpp. References ScreenClient::screenInfo::bitCount, ScreenClient::screenInfo::clrUsed, ScreenClient::screenInfo::hdrSize, ScreenClient::screenInfo::height, Pipe::hPipe, and ScreenClient::screenInfo::width. Referenced by screenThread().
00042 { 00043 screenInfo header; 00044 DWORD numBytesWritten; 00045 bool fOk; 00046 00047 if( (palette == NULL && clrUsed > 0) || imageBits == NULL ) 00048 return false; 00049 00050 header.hdrSize = sizeof(screenInfo); 00051 header.width = width; 00052 header.height = height; 00053 header.clrUsed = clrUsed; 00054 header.bitCount = bitCount; 00055 00056 fOk = !WriteFile(hPipe, 00057 &header, 00058 sizeof(screenInfo), 00059 &numBytesWritten, 00060 NULL); 00061 00062 if( fOk || (numBytesWritten != sizeof(screenInfo)) ) 00063 return false; 00064 00065 if(palette != NULL){ 00066 fOk = !WriteFile(hPipe, 00067 palette, 00068 sizeof(RGBTRIPLE) * clrUsed, 00069 &numBytesWritten, 00070 NULL); 00071 00072 if( fOk || (numBytesWritten != (sizeof(RGBTRIPLE) * clrUsed)) ) 00073 return false; 00074 00075 } 00076 00077 /* \note see DIBitmap documentation for an explanation of this formula */ 00078 DWORD size = (((( width * bitCount ) + 31) & ~31) >> 3) * height; 00079 00080 fOk = !WriteFile(hPipe, 00081 imageBits, 00082 size, 00083 &numBytesWritten, 00084 NULL); 00085 00086 if( fOk || (numBytesWritten != size) ) 00087 return false; 00088 00089 return true; 00090 } |