Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

ScreenClient Class Reference

A client to send screen buffers from VCC. More...

#include <ScreenClient.h>

Inherits PClient.

List of all members.

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


Detailed Description

This object is responsible for writting screen buffers to a pipe

Definition at line 19 of file ScreenClient.h.


Member Typedef Documentation

typedef struct ScreenClient::screenInfo ScreenClient::screenInfo [private]
 

See the documentation of ScreenPipe::screenInfo


Constructor & Destructor Documentation

ScreenClient::ScreenClient const TString   name
 

Parameters:
name  : A TString used to generate unique names for the various kernel objects

Definition at line 17 of file ScreenClient.cpp.

00018 :PClient(TString( TEXT("SCREEN") ) + name, true)
00019 {}


Member Function Documentation

bool ScreenClient::write const int    width,
const int    height,
const int    clrUsed,
const int    bitCount,
const RGBTRIPLE *    palette,
const LPBYTE    imageBits
 

Writes a screen buffer to the pipe

Parameters:
width  : The screen buffers width
height  : The screen bufers signed height
clrUsed  : The number of colours in the palette
bitCount  : The number of bits per pixel
palette  : An array of RGBTRIPLE structures
imageBits  : An array of bytes representing pixels (index or colour values depending on bpp)

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 }


The documentation for this class was generated from the following files:
Generated on Mon Mar 25 06:30:00 2002 for Window Dressing by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001