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

67 lines
2.0 KiB
C++

#include <remotepsapp/rawimg.hpp>
RawImage &RawImage::operator=(const RawImage &/*rawImage*/)
{ // private implementation
return *this;
}
bool RawImage::draw(PureDevice &pureDevice)
{
PureDevice compatibleDevice;
if(!isOkay())return FALSE;
compatibleDevice.compatibleDevice(pureDevice);
compatibleDevice.select((GDIObj)mhBitmap,TRUE);
pureDevice.bitBlt(Rect(0,0,width(),height()),compatibleDevice,Point(0,0));
compatibleDevice.select((GDIObj)mhBitmap,FALSE);
return TRUE;
}
bool RawImage::draw(PureDevice &pureDevice,int xSrc,int ySrc)
{
PureDevice compatibleDevice;
if(!isOkay())return FALSE;
compatibleDevice.compatibleDevice(pureDevice);
compatibleDevice.select((GDIObj)mhBitmap,TRUE);
pureDevice.bitBlt(Rect(xSrc,ySrc,width(),height()),compatibleDevice,Point(0,0));
compatibleDevice.select((GDIObj)mhBitmap,FALSE);
return TRUE;
}
bool RawImage::draw(PureDevice &pureDevice,const Rect &dstRect,const Point &srcPoint)
{
PureDevice compatibleDevice;
if(!isOkay())return FALSE;
compatibleDevice.compatibleDevice(pureDevice);
compatibleDevice.select((GDIObj)mhBitmap,TRUE);
pureDevice.bitBlt(dstRect,compatibleDevice,srcPoint);
compatibleDevice.select((GDIObj)mhBitmap,FALSE);
return TRUE;
}
bool RawImage::stretch(PureDevice &pureDevice,const Point &xyPoint,int strwidth,int strheight)
{
PureDevice compatibleDevice;
if(!isOkay())return FALSE;
compatibleDevice.compatibleDevice(pureDevice);
compatibleDevice.select((GDIObj)mhBitmap,TRUE);
pureDevice.stretchBlt(Rect(xyPoint.x(),xyPoint.y(),strwidth,strheight),compatibleDevice,Rect(0,0,width(),height()));
compatibleDevice.select((GDIObj)mhBitmap,FALSE);
return FALSE;
}
bool RawImage::createImage(PureDevice &pureDevice,int width,int height,GlobalData<BYTE> &rawData)
{
destroy();
mBitmapInfo.width(width);
mBitmapInfo.height(height);
mhBitmap=::CreateCompatibleBitmap(pureDevice,width,height);
if(!mhBitmap)return false;
::SetDIBits(pureDevice,mhBitmap,0,height,&rawData[0],(BITMAPINFO*)mBitmapInfo,DIB_RGB_COLORS);
return isOkay();
}