Files
Work/remotepsapp/rawimg.hpp
2024-08-07 09:16:27 -04:00

90 lines
1.8 KiB
C++

#ifndef _REMOTEPSAPP_RAWIMAGE_HPP_
#define _REMOTEPSAPP_RAWIMAGE_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _COMMON_SMARTPOINTER_HPP_
#include <common/pointer.hpp>
#endif
#ifndef _COMMON_RGBCOLOR_HPP_
#include <common/rgbcolor.hpp>
#endif
#ifndef _COMMON_DIBITMAP_HPP_
#include <common/dib.hpp>
#endif
#ifndef _COMMON_BITMAPINFO_HPP_
#include <common/bminfo.hpp>
#endif
class RawImage
{
public:
class RawImageInvalidImage{};
RawImage(void);
virtual ~RawImage();
int width(void)const;
int height(void)const;
bool draw(PureDevice &pureDevice);
bool draw(PureDevice &pureDevice,int xSrc,int ySrc);
bool draw(PureDevice &pureDevice,const Rect &dstRect,const Point &srcPoint);
bool stretch(PureDevice &pureDevice,const Point &xyPoint,int strwidth,int strheight);
bool createImage(PureDevice &pureDevice,int width,int height,GlobalData<BYTE> &rawData);
bool isOkay(void)const;
private:
RawImage(const RawImage &someRawImage);
RawImage &operator=(const RawImage &rawImage);
void destroy(void);
BitmapInfo mBitmapInfo;
HBITMAP mhBitmap;
};
inline
RawImage::RawImage(void)
: mhBitmap(0)
{
mBitmapInfo.bitCount(BitmapInfo::Bit24);
mBitmapInfo.colorUsed(0);
mBitmapInfo.colorImportant(0);
mBitmapInfo.compression(BI_RGB);
}
inline
RawImage::RawImage(const RawImage &/*someRawImage*/)
{ // private implementation
}
inline
RawImage::~RawImage()
{
destroy();
}
inline
int RawImage::height(void)const
{
if(mBitmapInfo.height()<0)return -mBitmapInfo.height();
return mBitmapInfo.height();
}
inline
int RawImage::width(void)const
{
return mBitmapInfo.width();
}
inline
bool RawImage::isOkay(void)const
{
return mhBitmap?true:false;
}
inline
void RawImage::destroy(void)
{
if(!isOkay())return;
::DeleteObject(mhBitmap);
mhBitmap=0;
}
#endif