28 #ifndef YSL_INC_Adaptor_Image_h_
29 #define YSL_INC_Adaptor_Image_h_ 1
31 #include "../Core/YModules.h"
32 #include YFM_YSLib_Core_YGDIBase
33 #include YFM_YSLib_Adaptor_YContainer
119 enum class SamplingFilter
210 template<
typename _fCallable>
215 template<
typename _fCallable>
284 HBitmap(
const char*, ImageFormat,
292 HBitmap(
const char16_t*, ImageFormat,
299 template<
class _tString,
309 template<
class _tString,
311 HBitmap(
const _tString& filename, ImageFormat fmt,
354 PDefHOp(
bool, !, ) const ynothrow
366 operator[](
size_t) const ynothrow;
368 explicit
DefCvt(const ynothrow,
bool, bitmap)
378 GetBPP() const ynothrow;
380 DefGetter(const ynothrow, DataPtr, DataPtr, bitmap)
382 GetHeight() const ynothrow;
384 DefGetter(const ynothrow,
Size, Size, {GetWidth(), GetHeight()});
387 GetPitch() const ynothrow;
395 GetPixels() const ynothrow;
404 PDefH(
byte*, GetScanLine,
size_t idx) const ynothrow
405 ImplRet(bitmap ? (*this)[idx] :
nullptr)
407 GetWidth() const ynothrow;
414 Rescale(const
Size&, SamplingFilter = SamplingFilter::Box);
423 SaveTo(const
char*, ImageFormat = ImageFormat::
BMP,
427 SaveTo(const char16_t*, ImageFormat = ImageFormat::BMP,
433 template<class _tString,
436 SaveTo(const _tString& filename, ImageFormat fmt = ImageFormat::BMP,
439 return SaveTo(&filename[0], fmt, flags);
455 inline DefSwap(ynothrow,
HBitmap)
478 HBitmap, ptrdiff_t, const HBitmap*, HBitmap>
489 : p_bitmaps(&bmps), index(idx)
499 operator==(const
iterator&, const iterator&) ynothrow;
524 HMultiBitmap(const
char*, ImageFormat,
530 HMultiBitmap(const char16_t*,
533 HMultiBitmap(const char16_t*, ImageFormat,
541 template<class _tString,
543 HMultiBitmap(const _tString& filename,
545 : HMultiBitmap(&filename[0], flags)
548 template<
class _tString,
562 PDefHOp(
bool, !, ) const ynothrow
565 explicit
DefCvt(const ynothrow,
bool,
bool(pages))
568 GetPageCount() const ynothrow;
571 Lock(
size_t = 0) const;
575 ImplExpr(std::swap(pages, multi_pixmap.pages))
583 PDefH(iterator, end, ) const ynothrow
592 if(++index == p_bitmaps->GetPageCount())
597 inline HMultiBitmap::iterator::reference
601 return p_bitmaps->Lock(index);
615 return !i.GetHMultiBitmapPtr();
623 class
YF_API ImageCodec final
642 DetectFormat(
const char*);
645 DetectFormat(
const char16_t*);
661 LoadForPlaying(
const char*);
664 LoadForPlaying(
const char16_t*);
669 template<
class _tString,
672 LoadForPlaying(
const _tString& filename)
674 return LoadForPlaying(&filename[0]);
684 template<
class _tSeqCon,
typename _type>
686 LoadSequence(
const _type& path)
688 const auto multi_bitmap(LoadForPlaying(path));
689 _tSeqCon con{multi_bitmap.begin(), multi_bitmap.end()};
692 con.emplace_back(path);
handle(::FreeImage_OpenMemory(static_cast< byte * >(buffer.data()), static_cast< ::DWORD >(buffer.size())))
ImageMemory(_fCallable f, ImageFormat fmt)
构造:以指定格式新建并打开内存缓冲区。
UnknownImageFormat(const std::string &str)
#define ynothrowv
YSLib 无异常抛出保证验证:有条件地使用无异常抛出规范。
#define DefDeCopyCtor(_t)
enable_if_t< is_class< decay_t< _tParam >>::value, int > enable_for_string_class_t
选择字符串类类型的特定重载避免和其它非字符串类型冲突。
ImageMemory(_fCallable f)
构造:新建并打开内存缓冲区。
std::uint16_t SDst
屏幕坐标距离。
#define DefBitmaskEnum(_tEnum)
图像资源分配失败异常:表示存储等资源不足导致无法创建图像。
HBitmap(const _tString &filename, ImageDecoderFlags=ImageDecoderFlags::Default)
构造:使用指定字符串文件名和解码器标识。
void swap(any &x, any &y)
交换对象。
::FIMEMORY * NativeHandle
#define DefDeMoveCtor(_t)
HMultiBitmap(const _tString &filename, ImageFormat fmt, ImageDecoderFlags flags=ImageDecoderFlags::Default)
构造:使用指定字符串文件名和解码器标识。
#define ynothrow
YSLib 无异常抛出保证:若支持 noexcept 关键字, 指定特定的 noexcept 异常规范。
未知图像格式异常:表示请求的操作涉及的图像格式因为不明确而不受库的支持。
GSStringTemplate< char >::basic_string string
iterator(const HMultiBitmap &bmps, size_t idx=0)
#define YAssertNonnull(_expr)
const HMultiBitmap * p_bitmaps
UnsupportedImageFormat(const std::string &str)
bool is_undereferenceable(const HMultiBitmap::iterator &i) ynothrow
HBitmap(DataPtr ptr={}) ynothrow
ImageDecoderFlags
图像解码器标识。
#define DefDeMoveAssignment(_t)
bool operator!=(const HMultiBitmap::iterator &x, const HMultiBitmap::iterator &y) ynothrow
#define DefCvt(_q, _t,...)
shared_ptr< MultiBitmapData > DataPtr
PDefH(void, DrawLineSeg, const Graphics &g, const Rect &bounds, const Point &p1, const Point &p2, Color c) ImplExpr(DrawLineSeg(g
DefGetter(const ynothrow, AlphaType *, BufferAlphaPtr, pBufferAlpha) DefGetter(const ynothrow
取 Alpha 缓冲区的指针。
HBitmap(const _tString &filename, ImageFormat fmt, ImageDecoderFlags=ImageDecoderFlags::Default)
构造:使用指定字符串文件名和解码器标识。
#define DefDeCopyAssignment(_t)
未被支持的图像格式异常:表示请求的操作涉及的图像格式不受库的支持。
reference operator*() const
#define DefDelMoveCtor(_t)