|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef IMAGE_BUILDERS_H
|
|
Toshihiro Shimizu |
890ddd |
#define IMAGE_BUILDERS_H
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tfilepath.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/imagemanager.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//======================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Forward declarations
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TImageInfo;
|
|
Toshihiro Shimizu |
890ddd |
class TXshSimpleLevel;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//======================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//***************************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// ImageLoader class declaration
|
|
Toshihiro Shimizu |
890ddd |
//***************************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*!
|
|
Toshihiro Shimizu |
890ddd |
ImageLoader is the specialized ImageBuilder class used to automatically load
|
|
Toshihiro Shimizu |
890ddd |
images from a level file on hard disk.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Refer to ImageLoader::BuildExtData for a description of the allowed options for
|
|
Toshihiro Shimizu |
890ddd |
image loading.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
class ImageLoader : public ImageBuilder
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
struct BuildExtData {
|
|
Toshihiro Shimizu |
890ddd |
const TXshSimpleLevel *m_sl; //!< TXshSimpleLevel instance associated to an image loading request
|
|
Toshihiro Shimizu |
890ddd |
TFrameId m_fid; //!< m_sl's fid at which the image will be loaded
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int m_subs; //!< The subsampling factor for image loading (0 meaning either
|
|
Toshihiro Shimizu |
890ddd |
//!< 'the currently stored one' if an image is already cached, or
|
|
Toshihiro Shimizu |
890ddd |
//!< m_sl's subsampling property otherwise)
|
|
Toshihiro Shimizu |
890ddd |
bool m_icon; //!< Whether the icon (if any) should be loaded instead
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
BuildExtData(const TXshSimpleLevel *sl, const TFrameId &fid, int subs = 0, bool icon = false)
|
|
Toshihiro Shimizu |
890ddd |
: m_sl(sl), m_fid(fid), m_subs(subs), m_icon(icon) {}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
ImageLoader(const TFilePath &path, const TFrameId &fid);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool isImageCompatible(int imFlags, void *extData);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*-- ImageBuilder仮想関数の実装。アイコン、画像をLoad時に全てキャッシュに格納する --*/
|
|
Toshihiro Shimizu |
890ddd |
void buildAllIconsAndPutInCache(TXshSimpleLevel *level,
|
|
Toshihiro Shimizu |
890ddd |
std::vector<tframeid> fids,</tframeid>
|
|
Toshihiro Shimizu |
890ddd |
std::vector<std::string> iconIds,</std::string>
|
|
Toshihiro Shimizu |
890ddd |
bool cacheImagesAsWell);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Toshihiro Shimizu |
890ddd |
bool getInfo(TImageInfo &info, int imFlags, void *extData);
|
|
Toshihiro Shimizu |
890ddd |
TImageP build(int imFlags, void *extData);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void invalidate();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
inline int buildSubsampling(int imFlags, BuildExtData *data);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
TFilePath m_path; //!< Level path to load images from
|
|
Toshihiro Shimizu |
890ddd |
TFrameId m_fid; //!< Frame of the level to load
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool m_64bitCompatible; //!< Whether current image is 64-bit compatible
|
|
Toshihiro Shimizu |
890ddd |
int m_subsampling; //!< Current image subsampling
|
|
Toshihiro Shimizu |
890ddd |
//!< NOTE: Should this be replaced by requests to the TImageCache?
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class ImageRasterizer : public ImageBuilder
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
ImageRasterizer() {}
|
|
Toshihiro Shimizu |
890ddd |
~ImageRasterizer() {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool isImageCompatible(int imFlags, void *extData) { return true; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Toshihiro Shimizu |
890ddd |
bool getInfo(TImageInfo &info, int imFlags, void *extData);
|
|
Toshihiro Shimizu |
890ddd |
TImageP build(int imFlags, void *extData);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class ImageFiller : public ImageBuilder
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
ImageFiller() {}
|
|
Toshihiro Shimizu |
890ddd |
~ImageFiller() {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool isImageCompatible(int imFlags, void *extData) { return true; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Toshihiro Shimizu |
890ddd |
bool getInfo(TImageInfo &info, int imFlags, void *extData);
|
|
Toshihiro Shimizu |
890ddd |
TImageP build(int imFlags, void *extData);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif // IMAGE_BUILDERS_H
|