Files
Work/proto/source/pureimg.hpp
2024-08-07 09:16:27 -04:00

122 lines
2.5 KiB
C++

#ifndef _REMOTEPSAPP_JPGIMAGE_HPP_
#define _REMOTEPSAPP_JPGIMAGE_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _COMMON_DIBITMAP_HPP_
#include <common/dib.hpp>
#endif
#ifndef _COMMON_BITMAPINFO_HPP_
#include <common/bminfo.hpp>
#endif
#ifndef _REMOTEPSAPP_RGB888_HPP_
#include <proto/rgb888.hpp>
#endif
#ifndef _REMOTEPSAPP_RAWIMAGE_HPP_
#include <proto/rawimg.hpp>
#endif
class String;
class PureDevice;
class RGB888;
class PureImage : public RawImage
{
public:
PureImage(void);
virtual ~PureImage();
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 resample(PureDevice &pureDevice,int width);
bool resample(PureDevice &pureDevice,int newWidth,int newHeight);
bool resample(int newWidth,int newHeight);
DWORD memoryUsage(void)const;
bool isOkay(void)const;
int width(void)const;
int height(void)const;
bool getRawData(GlobalData<BYTE> &rawData);
bool setRawData(GlobalData<BYTE> &rawData,PureDevice &pureDevice);
bool setRawData(GlobalData<BYTE> &rawData);
bool getAt(DWORD row,DWORD col,RGB888 &rgb888)const;
private:
PureImage(const PureImage &somePureImage);
PureImage &operator=(const PureImage &somePureImage);
void destroy(void);
HBITMAP mhBitmap;
};
inline
PureImage::PureImage(void)
: mhBitmap(0)
{
}
inline
PureImage::PureImage(const PureImage &somePureImage)
: mhBitmap(0)
{ // private implementation
*this=somePureImage;
}
inline
PureImage &PureImage::operator=(const PureImage &somePureImage)
{ // private implementation
return *this;
}
inline
PureImage::~PureImage()
{
destroy();
}
inline
int PureImage::width(void)const
{
return getBitmapInfo().width();
}
inline
int PureImage::height(void)const
{
if(getBitmapInfo().height()<0)return -getBitmapInfo().height();
return getBitmapInfo().height();
}
inline
bool PureImage::getAt(DWORD row,DWORD col,RGB888 &rgb888)const
{
return RawImage::getAt(row,col,rgb888);
}
inline
bool PureImage::isOkay(void)const
{
return mhBitmap?TRUE:FALSE;
}
inline
void PureImage::destroy(void)
{
if(!mhBitmap)return;
::DeleteObject(mhBitmap);
mhBitmap=0;
}
inline
DWORD PureImage::memoryUsage(void)const
{
return RawImage::memoryUsage();
}
inline
bool PureImage::setRawData(GlobalData<BYTE> &rawData)
{
destroy();
return RawImage::setRawData(rawData);
}
#endif