119 lines
2.3 KiB
C++
119 lines
2.3 KiB
C++
#ifndef _BROWSE_RAWIMAGE_HPP_
|
|
#define _BROWSE_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
|
|
#ifndef _BROWSE_RGB888_HPP_
|
|
#include <browse/rgb888.hpp>
|
|
#endif
|
|
|
|
class RawImage
|
|
{
|
|
public:
|
|
class RawImageInvalidImage{};
|
|
RawImage(void);
|
|
virtual ~RawImage();
|
|
DWORD memoryUsage(void)const;
|
|
int width(void)const;
|
|
int height(void)const;
|
|
bool getRawData(GlobalData<BYTE> &rawData);
|
|
bool setRawData(GlobalData<BYTE> &rawData);
|
|
bool getAt(DWORD row,DWORD col,RGB888 &rgb888)const;
|
|
Array<RGB888> &getRGBArray(void);
|
|
BitmapInfo &getBitmapInfo(void);
|
|
const BitmapInfo &getBitmapInfo(void)const;
|
|
bool isOkay(void)const;
|
|
private:
|
|
RawImage(const RawImage &someRawImage);
|
|
RawImage &operator=(const RawImage &someRawImage);
|
|
|
|
BitmapInfo mBitmapInfo;
|
|
Array<RGB888> mRGBArray;
|
|
};
|
|
|
|
inline
|
|
RawImage::RawImage(void)
|
|
{
|
|
}
|
|
|
|
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
|
|
Array<RGB888> &RawImage::getRGBArray(void)
|
|
{
|
|
return mRGBArray;
|
|
}
|
|
|
|
inline
|
|
BitmapInfo &RawImage::getBitmapInfo(void)
|
|
{
|
|
return mBitmapInfo;
|
|
}
|
|
|
|
inline
|
|
const BitmapInfo &RawImage::getBitmapInfo(void)const
|
|
{
|
|
return mBitmapInfo;
|
|
}
|
|
|
|
inline
|
|
bool RawImage::getAt(DWORD row,DWORD col,RGB888 &rgb888)const
|
|
{
|
|
if(!isOkay())return false;
|
|
if(mBitmapInfo.height()<0)rgb888=((Array<RGB888>&)mRGBArray)[row*width()+col];
|
|
else rgb888=((Array<RGB888>&)mRGBArray)[(mBitmapInfo.width()*(-mBitmapInfo.height()))-(((row*mBitmapInfo.width())+mBitmapInfo.width()))+col];
|
|
return true;
|
|
}
|
|
|
|
inline
|
|
DWORD RawImage::memoryUsage(void)const
|
|
{
|
|
return mRGBArray.size()*sizeof(RGB888);
|
|
}
|
|
|
|
inline
|
|
bool RawImage::isOkay(void)const
|
|
{
|
|
return mRGBArray.size()?true:false;
|
|
}
|
|
#endif |