145 lines
2.7 KiB
C++
145 lines
2.7 KiB
C++
#ifndef _BROWSE_THUMBNAIL_HPP_
|
|
#define _BROWSE_THUMBNAIL_HPP_
|
|
#ifndef _COMMON_WINDOWS_HPP_
|
|
#include <common/windows.hpp>
|
|
#endif
|
|
#ifndef _MEDIAPAK_PAKENTRY_HPP_
|
|
#include <mediapak/pakentry.hpp>
|
|
#endif
|
|
#ifndef _BROWSE_JPGIMAGE_HPP_
|
|
#include <browse/jpgimg.hpp>
|
|
#endif
|
|
|
|
class ThumbNail
|
|
{
|
|
public:
|
|
ThumbNail(void);
|
|
virtual ~ThumbNail();
|
|
bool draw(PureDevice &pureDevice,const Point &xyPoint);
|
|
bool setImage(const String &strPathFileName,PureDevice &pureDevice);
|
|
bool setImage(PakEntry &pakEntry);
|
|
bool setImage(PakEntry &pakEntry,PureDevice &pureDevice);
|
|
int width(void)const;
|
|
void width(int width);
|
|
int height(void)const;
|
|
void height(int height);
|
|
void light(const RGBColor &lightColor);
|
|
void dark(const RGBColor &darkColor);
|
|
bool isOkay(void)const;
|
|
const String &pathFileName(void)const;
|
|
bool getRawData(GlobalData<BYTE> &rawData);
|
|
JPGImage &getImage();
|
|
private:
|
|
// enum {DefaultWidth=96,DefaultHeight=96,DefaultResampleWidth=96,OffsetImage=(DefaultWidth-DefaultResampleWidth)/2,BottomBorderHeight=0};
|
|
enum {DefaultWidth=72,DefaultHeight=72,DefaultResampleWidth=72,OffsetImage=(DefaultWidth-DefaultResampleWidth)/2,BottomBorderHeight=0};
|
|
ThumbNail(const ThumbNail &someThumbNail);
|
|
ThumbNail &operator=(const ThumbNail &someThumbNail);
|
|
const RGBColor &light(void)const;
|
|
const RGBColor &dark(void)const;
|
|
|
|
String mStrPathFileName;
|
|
RGBColor mLight;
|
|
RGBColor mDark;
|
|
JPGImage mImage;
|
|
int mWidth;
|
|
int mHeight;
|
|
};
|
|
|
|
inline
|
|
ThumbNail::ThumbNail(void)
|
|
: mWidth(DefaultWidth), mHeight(DefaultHeight), mLight(128,128,128), mDark(0,0,0)
|
|
{
|
|
}
|
|
|
|
inline
|
|
ThumbNail::ThumbNail(const ThumbNail &someThumbNail)
|
|
{ // private implementation
|
|
*this=someThumbNail;
|
|
}
|
|
|
|
inline
|
|
ThumbNail::~ThumbNail()
|
|
{
|
|
}
|
|
|
|
inline
|
|
ThumbNail &ThumbNail::operator=(const ThumbNail &/*someThumbNail*/)
|
|
{ // private implementation
|
|
return *this;
|
|
}
|
|
|
|
inline
|
|
const RGBColor &ThumbNail::light(void)const
|
|
{
|
|
return mLight;
|
|
}
|
|
|
|
inline
|
|
void ThumbNail::light(const RGBColor &lightColor)
|
|
{
|
|
mLight=lightColor;
|
|
}
|
|
|
|
inline
|
|
const RGBColor &ThumbNail::dark(void)const
|
|
{
|
|
return mDark;
|
|
}
|
|
|
|
inline
|
|
void ThumbNail::dark(const RGBColor &darkColor)
|
|
{
|
|
mDark=darkColor;
|
|
}
|
|
|
|
inline
|
|
const String &ThumbNail::pathFileName(void)const
|
|
{
|
|
return mStrPathFileName;
|
|
}
|
|
|
|
inline
|
|
int ThumbNail::width(void)const
|
|
{
|
|
return mWidth;
|
|
}
|
|
|
|
inline
|
|
void ThumbNail::width(int width)
|
|
{
|
|
mWidth=width;
|
|
}
|
|
|
|
inline
|
|
int ThumbNail::height(void)const
|
|
{
|
|
return mHeight;
|
|
}
|
|
|
|
inline
|
|
void ThumbNail::height(int height)
|
|
{
|
|
mHeight=height;
|
|
}
|
|
|
|
inline
|
|
bool ThumbNail::getRawData(GlobalData<BYTE> &rawData)
|
|
{
|
|
if(!isOkay())return false;
|
|
return mImage.getRawData(rawData);
|
|
}
|
|
|
|
inline
|
|
JPGImage &ThumbNail::getImage(void)
|
|
{
|
|
return mImage;
|
|
}
|
|
|
|
inline
|
|
bool ThumbNail::isOkay(void)const
|
|
{
|
|
return mImage.isOkay();
|
|
}
|
|
#endif
|
|
|