#ifndef _DDRAW_DRAWINGSURFACE_HPP_ #define _DDRAW_DRAWINGSURFACE_HPP_ #ifndef _DDRAW_SURFACE_HPP_ #include #endif #ifndef _DDRAW_ROWINFO_HPP_ #include #endif class Point; class RGBColor; class DrawingSurface : public Surface { public: DrawingSurface(void); virtual ~DrawingSurface(); void setByte(WORD row,WORD col,BYTE byteValue); BYTE getByte(WORD row,WORD col); void clear(void); void setBits(BYTE byteValue); void line(const Point &firstPoint,const Point &secondPoint,BYTE byteValue); WORD square(const Point ¢erPoint,WORD lineLength,const RGBColor &lineColor); WORD square(const Point ¢erPoint,WORD lineLength,BYTE indexColor); WORD circle(const Point &xyPoint,WORD radius,WORD palIndex,WORD aspectValue=100); BOOL lock(BOOL initRowArray=TRUE); BOOL unlock(void); BOOL isLocked(void)const; DWORD width(void)const; DWORD height(void)const; DWORD pitch(void)const; DWORD extent(void)const; LPVOID ptrSurface(void); private: DrawingSurface(const DrawingSurface &someDrawingSurface); DrawingSurface &operator=(const DrawingSurface &someDrawingSurface); void setRowInfo(void); void extent(DWORD extent); SurfaceDescription mSurfaceDescription; RowInfo mRowInfo; BOOL mIsLocked; DWORD mExtent; }; inline DrawingSurface::DrawingSurface(void) : mIsLocked(FALSE), mExtent(0) { } inline DrawingSurface::~DrawingSurface() { } inline DrawingSurface::DrawingSurface(const DrawingSurface &someDrawingSurface) { // private implementation *this=someDrawingSurface; } inline DrawingSurface &DrawingSurface::operator=(const DrawingSurface &/*someDrawingSurface*/) { // private implementation return *this; } inline BOOL DrawingSurface::lock(BOOL initRowArray) { if(isLocked())return FALSE; if(Surface::lock(mSurfaceDescription).okResult())mIsLocked=TRUE; extent(width()*height()); if(initRowArray)setRowInfo(); return mIsLocked; } inline BOOL DrawingSurface::unlock(void) { mIsLocked=FALSE; return Surface::unlock().okResult(); } inline BOOL DrawingSurface::isLocked(void)const { return mIsLocked; } inline DWORD DrawingSurface::width(void)const { if(!isLocked())return FALSE; return mSurfaceDescription.width(); } inline DWORD DrawingSurface::height(void)const { if(!isLocked())return FALSE; return mSurfaceDescription.height(); } inline DWORD DrawingSurface::pitch(void)const { if(!isLocked())return FALSE; return mSurfaceDescription.lPitch(); } inline DWORD DrawingSurface::extent(void)const { if(!isLocked())return FALSE; return mExtent; } inline void DrawingSurface::extent(DWORD extent) { mExtent=extent; } inline void DrawingSurface::setByte(WORD row,WORD col,BYTE byteValue) { if(!isLocked())return; if(row>=mSurfaceDescription.height()||col>=mSurfaceDescription.width())return; *((BYTE*)mRowInfo[row]+col)=byteValue; } inline BYTE DrawingSurface::getByte(WORD row,WORD col) { if(!isLocked())return 0; return *((BYTE*)mRowInfo[row]+col); } inline LPVOID DrawingSurface::ptrSurface(void) { if(!isLocked())return 0; return mSurfaceDescription.ptrSurface(); } #endif