Files
Work/browse/thmbnail.cpp
2024-08-07 09:12:07 -04:00

38 lines
1.3 KiB
C++

#include <browse/thmbnail.hpp>
bool ThumbNail::setImage(PakEntry &pakEntry,PureDevice &pureDevice)
{
mImage.setRawData(pakEntry.rawData(),pureDevice);
if(!mImage.isOkay())return false;
mStrPathFileName=pakEntry.name();
return true;
}
bool ThumbNail::setImage(PakEntry &pakEntry)
{
mImage.setRawData(pakEntry.rawData());
mStrPathFileName=pakEntry.name();
return true;
}
bool ThumbNail::setImage(const String &strPathFileName,PureDevice &pureDevice)
{
mImage.decode(strPathFileName,pureDevice);
if(!mImage.isOkay())return false;
mStrPathFileName=strPathFileName;
mImage.resample(pureDevice,DefaultResampleWidth,DefaultResampleWidth);
return true;
}
bool ThumbNail::draw(PureDevice &pureDevice,const Point &xyPoint)
{
if(!isOkay())return false;
pureDevice.line(xyPoint,Point(xyPoint.x()+width(),xyPoint.y()),light());
pureDevice.line(xyPoint,Point(xyPoint.x(),xyPoint.y()+height()),light());
pureDevice.line(Point(xyPoint.x()+width(),xyPoint.y()),Point(xyPoint.x()+width(),xyPoint.y()+height()),dark());
pureDevice.line(Point(xyPoint.x(),xyPoint.y()+height()),Point(xyPoint.x()+width(),xyPoint.y()+height()),dark());
mImage.stretch(pureDevice,Point(xyPoint.x()+OffsetImage,xyPoint.y()+OffsetImage),DefaultResampleWidth,DefaultResampleWidth-BottomBorderHeight);
return true;
}