120 lines
2.2 KiB
C++
120 lines
2.2 KiB
C++
#ifndef _BONEYARD_RAWIMAGE_HPP_
|
|
#define _BONEYARD_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();
|
|
DWORD memoryUsage(void)const;
|
|
int width(void)const;
|
|
int height(void)const;
|
|
void width(int width);
|
|
void height(int height);
|
|
bool getRawData(GlobalData<BYTE> &rawData)const;
|
|
bool setRawData(const GlobalData<BYTE> &rawData);
|
|
bool draw(PureDevice &displayDevice,const Point &dstPoint=Point(),const Point &srcPoint=Point());
|
|
bool stretch(PureDevice &displayDevice,const Point &dstDim,const Point &srcPoint=Point());
|
|
bool isOkay(void)const;
|
|
private:
|
|
RawImage(const RawImage &someRawImage);
|
|
RawImage &operator=(const RawImage &someRawImage);
|
|
BitmapInfo &getBitmapInfo(void);
|
|
const BitmapInfo &getBitmapInfo(void)const;
|
|
|
|
BitmapInfo mBitmapInfo;
|
|
GlobalData<BYTE> mImageData;
|
|
};
|
|
|
|
inline
|
|
RawImage::RawImage(void)
|
|
{
|
|
mBitmapInfo.bitCount(BitmapInfo::Bit24);
|
|
mBitmapInfo.colorUsed(0);
|
|
mBitmapInfo.colorImportant(0);
|
|
mBitmapInfo.compression(BI_RGB);
|
|
}
|
|
|
|
inline
|
|
RawImage::RawImage(const RawImage &someRawImage)
|
|
{ // private implementation
|
|
*this=someRawImage;
|
|
}
|
|
|
|
inline
|
|
RawImage &RawImage::operator=(const RawImage &someRawImage)
|
|
{ // private implementation
|
|
return *this;
|
|
}
|
|
|
|
inline
|
|
RawImage::~RawImage()
|
|
{
|
|
}
|
|
|
|
inline
|
|
int RawImage::width(void)const
|
|
{
|
|
return mBitmapInfo.width();
|
|
}
|
|
|
|
inline
|
|
int RawImage::height(void)const
|
|
{
|
|
if(mBitmapInfo.height()<0)return -mBitmapInfo.height();
|
|
return mBitmapInfo.height();
|
|
}
|
|
|
|
inline
|
|
void RawImage::width(int width)
|
|
{
|
|
mBitmapInfo.width(width);
|
|
}
|
|
|
|
inline
|
|
void RawImage::height(int height)
|
|
{
|
|
mBitmapInfo.height(height);
|
|
}
|
|
|
|
|
|
inline
|
|
BitmapInfo &RawImage::getBitmapInfo(void)
|
|
{
|
|
return mBitmapInfo;
|
|
}
|
|
|
|
inline
|
|
const BitmapInfo &RawImage::getBitmapInfo(void)const
|
|
{
|
|
return mBitmapInfo;
|
|
}
|
|
|
|
inline
|
|
DWORD RawImage::memoryUsage(void)const
|
|
{
|
|
return mImageData.size();
|
|
}
|
|
|
|
inline
|
|
bool RawImage::isOkay(void)const
|
|
{
|
|
return mImageData.size()?true:false;
|
|
}
|
|
#endif |