YSTest: Image.h 源文件

YSTest PreAlpha_b900_20201012 The YSLib Test Project

Image.h
浏览该文件的文档.
1 /*
2 © 2013-2017, 2019-2020 FrankHB.
3
4 This file is part of the YSLib project, and may only be used,
5 modified, and distributed under the terms of the YSLib project
6 license, LICENSE.TXT. By continuing to use, modify, or distribute
7 this file you indicate that you have read the license and
8 understand and accept it fully.
9 */
10
28 #ifndef YSL_INC_Adaptor_Image_h_
29 #define YSL_INC_Adaptor_Image_h_ 1
30
31 #include "../Core/YModules.h"
32 #include YFM_YSLib_Core_YGraphics // for ystdex::unsupported,
33 // ystdex::copy_and_swap;
34 #include YFM_YSLib_Core_YClock // for TimeSpan;
35 //#include <FreeImage.h>
36 #include <ystdex/type_op.hpp> // for ystdex::exclude_self_params_t;
37
39 struct FIBITMAP;
41 struct FIMETADATA;
43 struct FITAG;
45 struct FIMEMORY;
46
47 namespace YSLib
48 {
49
50 namespace Drawing
51 {
52
54 class CompactPixmap;
56 class HBitmap;
57
59 using BitPerPixel = std::uint8_t;
60
61
68 enum class ImageFormat : int
69 {
70 Unknown = -1,
71 BMP = 0,
72 ICO = 1,
73 JPEG = 2,
75 PNG = 13,
76 GIF = 25
77 };
78
79
85 enum class ImageDecoderFlags : int
86 {
87 Default = 0,
88 GIF_Load256 = 1,
89 GIF_Playback = 2,
90 ICO_MakeAlpha = 1,
91 JPEG_Fast = 0x0001,
92 JPEG_Accurate = 0x0002,
93 JPEG_CMYK = 0x0004,
94 JPEG_EXIFRotate = 0x0008,
95 JPEG_GreyScale = 0x0010,
96 JPEG_QualitySuperb = 0x80,
97 JPEG_QualityGood = 0x0100,
98 JPEG_QualityNormal = 0x0200,
99 JPEG_QualityAverage = 0x0400,
100 JPEG_QualityBad = 0x0800,
101 JPEG_Progressive = 0x2000,
102 JPEG_Subsampling_411 = 0x1000,
103 JPEG_Subsampling_420 = 0x4000,
104 JPEG_Subsampling_422 = 0x8000,
105 JPEG_Subsampling_444 = 0x10000,
106 JPEG_Optimize = 0x20000,
107 JPEG_Baseline = 0x40000
108 };
109
114 DefBitmaskEnum(ImageDecoderFlags)
115
116
117
123 enum class SamplingFilter
124 {
125 Box = 0,
126 Bicubic = 1,
127 Bilinear = 2,
128 BSpline = 3,
129 CatmullRom = 4,
130 Lanczos3 = 5
131 };
132
133
139 enum class ImageMetadataModel
140 {
141 NoData = -1,
142 Comments = 0,
143 EXIF_Main = 1,
144 EXIF_EXIF = 2,
145 EXIF_GPS = 3,
146 EXIF_MakerNote = 4,
147 EXIF_Interop = 5,
148 IPTC = 6,
149 XMP = 7,
150 GeoTIFF = 8,
151 Animation = 9,
152 Custom = 10,
153 EXIF_RAW = 11
154 };
155
156
161 class YF_API BadImageAlloc : public std::bad_alloc
162 {
163 public:
165
166 DefDeCtor(BadImageAlloc)
167 DefDeCopyCtor(BadImageAlloc)
169 ~BadImageAlloc() override;
171 };
172
173
178 class YF_API UnsupportedImageFormat
179 : public GeneralEvent, public ystdex::unsupported
180 {
181 public:
183 using GeneralEvent::GeneralEvent;
184
186 DefDeCopyCtor(UnsupportedImageFormat)
191 ~UnsupportedImageFormat() override;
192 };
193
194
196
197
200 class YF_API UnknownImageFormat : public UnsupportedImageFormat
201 {
202 public:
204 using UnsupportedImageFormat::UnsupportedImageFormat;
205
207 DefDeCopyCtor(UnknownImageFormat)
212 ~UnknownImageFormat() override;
213 };
214
215
220 class YF_API ImageMemory final
221 {
222 public:
223 using NativeHandle = ::FIMEMORY*;
225 using Buffer = vector<octet>;
226
227 private:
229 class YF_API Deleter
230 {
231 public:
232 using pointer = NativeHandle;
233
234 void
235 operator()(pointer) const ynothrow;
236 };
237
238 Buffer buffer;
239 ImageFormat format;
241 unique_ptr_from<Deleter> p_memory;
242
243 public:
259 explicit
260 ImageMemory(const HBitmap&, ImageFormat = ImageFormat::BMP,
261 ImageDecoderFlags = ImageDecoderFlags::Default);
268 ImageMemory(Buffer);
271 ImageMemory(Buffer, ImageFormat);
273 template<typename _func>
274 ImageMemory(_func f)
275 : ImageMemory(f())
276 {}
278 template<typename _func>
279 ImageMemory(_func f, ImageFormat fmt)
280 : ImageMemory(f(), fmt)
281 {}
283 DefDelMoveCtor(ImageMemory)
285 DefDeDtor(ImageMemory)
287
288
289 DefGetter(const ynothrow, const Buffer&, Buffer, buffer)
290 DefGetter(const ynothrow, ImageFormat, Format, format)
291 DefGetter(const ynothrow, NativeHandle, NativeHandle, p_memory.get())
292 };
294
295
301 class YF_API HBitmap final
302 {
303 public:
304 using DataPtr = observer_ptr<::FIBITMAP>;
306 class YF_API Deleter
307 {
308 public:
309 using pointer = ::FIBITMAP*;
310
311 void
312 operator()(pointer) const ynothrow;
313 };
314
315 private:
317 unique_ptr_from<Deleter> p_bitmap;
318
319 public:
324 DefDeCtor(HBitmap)
330 HBitmap(DataPtr ptr) ynothrow
331 : p_bitmap(ptr.get())
332 {}
334
335 HBitmap(const Size&, BitPerPixel = 0);
346 explicit YB_NONNULL(2)
347 HBitmap(BitmapPtr, const Size&, size_t = 0);
349
354 HBitmap(const CompactPixmap&);
366 YB_NONNULL(2)
367 HBitmap(const char*, ImageDecoderFlags = ImageDecoderFlags::Default);
369 YB_NONNULL(2)
370 HBitmap(const char*, ImageFormat,
371 ImageDecoderFlags = ImageDecoderFlags::Default);
376 YB_NONNULL(2)
377 HBitmap(const char16_t*, ImageDecoderFlags = ImageDecoderFlags::Default);
379 YB_NONNULL(2)
380 HBitmap(const char16_t*, ImageFormat,
381 ImageDecoderFlags = ImageDecoderFlags::Default);
387 template<class _tString,
388 yimpl(typename = ystdex::enable_for_string_class_t<_tString>)>
389 HBitmap(const _tString& filename,
390 ImageDecoderFlags = ImageDecoderFlags::Default)
391 : HBitmap(&filename[0])
392 {}
397 template<class _tString,
398 yimpl(typename = ystdex::enable_for_string_class_t<_tString>)>
399 HBitmap(const _tString& filename, ImageFormat fmt,
400 ImageDecoderFlags = ImageDecoderFlags::Default)
401 : HBitmap(&filename[0], fmt)
402 {}
404
408 HBitmap(const ImageMemory&, ImageDecoderFlags = ImageDecoderFlags::Default);
416 HBitmap(const HBitmap&, BitPerPixel);
418
419
424 HBitmap(const HBitmap&, const Size&, SamplingFilter);
426 HBitmap(const HBitmap&);
427 DefDeMoveCtor(HBitmap)
429 DefDeDtor(HBitmap)
431
433
434 PDefHOp(HBitmap&, =, const HBitmap& pixmap)
436 ImplRet(ystdex::copy_and_swap(*this, pixmap))
437 DefDeMoveAssignment(HBitmap)
439
441
442 DefBoolNeg(explicit, bool(p_bitmap))
443
452 YB_ATTR_returns_nonnull YB_PURE byte*
453 operator[](size_t) const ynothrowv;
455
460 YB_ATTR_nodiscard YB_PURE
461 operator CompactPixmap() const;
462
463 YB_ATTR_nodiscard YB_PURE BitPerPixel
464 GetBPP() const ynothrow;
466 DefGetter(const ynothrow, DataPtr, DataPtr, make_observer(p_bitmap.get()))
467 YB_ATTR_nodiscard YB_PURE SDst
468 GetHeight() const ynothrow;
470 DefGetter(const ynothrow, Size, Size, {GetWidth(), GetHeight()})
472 YB_ATTR_nodiscard YB_PURE SDst
473 GetPitch() const ynothrow;
480 YB_ATTR_nodiscard YB_PURE byte*
481 GetPixels() const ynothrow;
490 YB_ATTR_nodiscard YB_PURE
491 PDefH(byte*, GetScanLine, size_t idx) const ynothrow
492 ImplRet(p_bitmap ? (*this)[idx] : nullptr)
493 YB_ATTR_nodiscard YB_PURE SDst
494 GetWidth() const ynothrow;
495
501 YB_ATTR_nodiscard Deleter::pointer
502 Release() ynothrow;
503
508 void
509 Rescale(const Size&, SamplingFilter = SamplingFilter::Box);
510
517 void
519 SaveTo(const char*, ImageFormat = ImageFormat::BMP,
520 ImageDecoderFlags = ImageDecoderFlags::Default) const;
522 void
523 SaveTo(const char16_t*, ImageFormat = ImageFormat::BMP,
524 ImageDecoderFlags = ImageDecoderFlags::Default) const;
529 template<class _tString,
530 yimpl(typename = ystdex::enable_for_string_class_t<_tString>)>
531 void
532 SaveTo(const _tString& filename, ImageFormat fmt = ImageFormat::BMP,
533 ImageDecoderFlags flags = ImageDecoderFlags::Default) const
534 {
535 SaveTo(&filename[0], fmt, flags);
536 }
538
543 friend PDefH(void, swap, HBitmap& x, HBitmap& y) ynothrow
544 ImplExpr(std::swap(x.p_bitmap, y.p_bitmap))
545 };
546
548
549
556 YB_ATTR_nodiscard YF_API YB_PURE Timers::TimeSpan
557 GetFrameTimeOf(const HBitmap&);
558
567 YB_ATTR_nodiscard YF_API YB_PURE Size
568 GetLogicalSizeOf(const HBitmap&);
570
571
573
574
578 class MultiBitmapData;
579
586 class YF_API HMultiBitmap final
587 {
588 public:
589 using DataPtr = shared_ptr<MultiBitmapData>;
591 using iterator = ystdex::subscriptive_iterator<const HMultiBitmap, HBitmap,
592 ptrdiff_t, const HBitmap*, HBitmap>;
594 using const_iterator = iterator;
595
596 private:
597 DataPtr pages{};
598
599 public:
605 DefDeCtor(HMultiBitmap)
617 HMultiBitmap(const char*, ImageDecoderFlags = ImageDecoderFlags::Default);
619 HMultiBitmap(const char*, ImageFormat,
620 ImageDecoderFlags = ImageDecoderFlags::Default);
625 HMultiBitmap(const char16_t*,
626 ImageDecoderFlags = ImageDecoderFlags::Default);
628 HMultiBitmap(const char16_t*, ImageFormat,
629 ImageDecoderFlags = ImageDecoderFlags::Default);
631
632
636 template<class _tString,
637 yimpl(typename = ystdex::enable_for_string_class_t<_tString>)>
638 HMultiBitmap(const _tString& filename,
639 ImageDecoderFlags flags = ImageDecoderFlags::Default)
640 : HMultiBitmap(&filename[0], flags)
641 {}
643 template<class _tString,
644 yimpl(typename = ystdex::enable_for_string_class_t<_tString>)>
645 HMultiBitmap(const _tString& filename, ImageFormat fmt,
646 ImageDecoderFlags flags = ImageDecoderFlags::Default)
647 : HMultiBitmap(&filename[0], fmt, flags)
648 {}
650
651 DefDeCopyMoveCtorAssignment(HMultiBitmap)
652
653 DefBoolNeg(explicit, bool(pages))
654
656 PDefHOp(HBitmap, [], size_t idx) const ynothrowv
657 ImplRet(Lock(idx))
658
659 YB_ATTR_nodiscard YB_PURE size_t
660 GetPageCount() const ynothrow;
661
662 YB_ATTR_nodiscard YB_PURE HBitmap
663 Lock(size_t = 0) const ynothrowv;
664
669 friend PDefH(void, swap, HMultiBitmap& x, HMultiBitmap& y) ynothrow
670 ImplExpr(std::swap(x.pages, y.pages))
671
673
674 YB_ATTR_nodiscard YB_PURE PDefH(iterator, begin, ) const ynothrow
675 ImplRet(HMultiBitmap::iterator(*this, 0))
676
677 YB_ATTR_nodiscard YB_PURE PDefH(iterator, end, ) const ynothrow
678 ImplRet(HMultiBitmap::iterator(*this, GetPageCount()))
680 };
682
683
690 class YF_API ImageTag final
691 {
692 public:
693 using DataPtr = ::FITAG*;
694 using ID = std::uint16_t;
699 enum Type
700 {
701 NoType = 0,
702 Byte = 1,
703 ASCII = 2,
704 Short = 3,
705 Long = 4,
706 Rational = 5,
707 SByte = 6,
708 Undefined = 7,
709 SShort = 8,
710 SLong = 9,
711 SRational = 10,
712 Float = 11,
713 Double = 12,
714 IFD = 13,
715 Palette = 14,
716 Long8 = 16,
717 SLong8 = 17,
718 IFD8 = 18
719 };
720
721 private:
722 DataPtr p_tag = {};
724 bool owns = {};
725
726 public:
731 DefDeCtor(ImageTag)
738 ImageTag(DataPtr ptr, bool o = true) ynothrow
739 : p_tag(ptr), owns(o)
740 {}
750 ImageTag(HBitmap::DataPtr, ImageMetadataModel, const char*);
753 ImageTag(const HBitmap&, ImageMetadataModel, const char*);
754 template<typename _tBitmap, class _tString,
755 yimpl(typename = ystdex::enable_for_string_class_t<_tString>)>
756 ImageTag(const _tBitmap& bmp, ImageMetadataModel model, _tString& name)
757 : ImageTag(bmp, model, &name[0])
758 {}
760 ImageTag(const ImageTag&) ythrow(BadImageAlloc);
766 ImageTag(const ImageTag& tag, ystdex::false_) ynothrow
767 : ImageTag(tag.p_tag, {})
768 {}
769 ~ImageTag();
770
771 DefBoolNeg(explicit, p_tag)
772
773 YB_ATTR_nodiscard YB_PURE size_t
774 GetCount() const ynothrow;
776 DefGetter(const ynothrow, DataPtr, DataPtr, p_tag)
777 YB_ATTR_nodiscard YB_PURE const char*
778 GetDescription() const ynothrow;
779 YB_ATTR_nodiscard YB_PURE ID
780 GetID() const ynothrow;
781 YB_ATTR_nodiscard YB_PURE const char*
782 GetKey() const ynothrow;
783 YB_ATTR_nodiscard YB_PURE size_t
784 GetLength() const ynothrow;
785 YB_ATTR_nodiscard YB_PURE Type
786 GetType() const ynothrow;
792 template<typename _type>
793 YB_ATTR_nodiscard YB_PURE const _type&
794 GetValue() const ythrow(GeneralEvent)
795 {
796 if(const auto p = GetValuePtr())
797 return Deref(static_cast<const _type*>(p));
798 throw GeneralEvent("Null tag value found.");
799 }
801 const void*
802 GetValuePtr() const ynothrow;
803
805 bool
806 SetCount(size_t) const ynothrow;
807 bool
808 SetDescription(const char*) const ynothrow;
809 bool
810 SetID(ID) const ynothrow;
811 bool
812 SetKey(const char*) const ynothrow;
814 bool
815 SetLength(size_t) const ynothrow;
816 bool
817 SetType(Type) const ynothrow;
818 bool
819 SetValue(const void*) const ynothrow;
820
825 YB_ATTR_nodiscard DataPtr
826 Release() ynothrow;
827 };
828
835 YB_ATTR_nodiscard YF_API YB_PURE string
836 to_string(const ImageTag&, ImageMetadataModel);
837
838
845 class YF_API ImageMetadataFindData
846 {
847 public:
848 using DataPtr = ::FIMETADATA*;
849
855 ImageMetadataModel CurrentModel;
856
857 private:
858 HBitmap::DataPtr p_bitmap = {};
859 ImageTag::DataPtr p_tag = {};
860 DataPtr p_metadata = {};
861
862 public:
864 DefDeCtor(ImageMetadataFindData)
866
867 ImageMetadataFindData(HBitmap::DataPtr, ImageMetadataModel);
868 ImageMetadataFindData(const HBitmap&, ImageMetadataModel);
870 ImageMetadataFindData(ImageMetadataFindData&&) ynothrow;
873 ~ImageMetadataFindData();
874
876 PDefHOp(ImageMetadataFindData&, =, ImageMetadataFindData&& dat) ynothrow
877 ImplRet(swap(*this, dat), *this)
878
879 DefBoolNeg(explicit, p_metadata)
880
881 DefGetter(const ynothrow, ImageTag, Tag, {p_tag, {}})
882
883 private:
884 void
885 Close() ynothrow;
886
887 public:
889 void
890 Read() ynothrow;
891
892 void
893 Rewind() ynothrow;
894
896 friend DefSwap(ynothrow, ImageMetadataFindData,
897 std::swap(_x.p_bitmap, _y.p_bitmap), std::swap(_x.p_tag, _y.p_tag),
898 std::swap(_x.p_metadata, _y.p_metadata))
899 };
900
901
907 class YF_API HImageMetadata final : private ImageMetadataFindData,
908 private ystdex::deref_self<HImageMetadata>
909 {
910 public:
912 template<typename... _tParams, yimpl(typename
913 = ystdex::exclude_self_params_t<HImageMetadata, _tParams...>)>
914 explicit
915 HImageMetadata(_tParams&&... args)
916 : ImageMetadataFindData(yforward(args)...)
917 {}
918 DefDeMoveCtor(HImageMetadata)
919
920 DefDeMoveAssignment(HImageMetadata)
921
922
926 using deref_self<HImageMetadata>::operator*;
927
929 PDefHOp(HImageMetadata&, ++, ) ynothrow
930 ImplRet(Read(), *this)
931
933 DefBoolNeg(explicit, bool(static_cast<const ImageMetadataFindData&>(*this)))
934
936 DefCvt(const, ImageTag, GetTag())
937
939 using ImageMetadataFindData::Rewind;
940 };
941
942
947 using HImageMetadataIterator = ystdex::indirect_input_iterator<HImageMetadata*>;
948
949
951 class YF_API ImageCodec final
952 {
953 public:
955 ImageCodec();
957 ~ImageCodec();
958
969 YB_ATTR_nodiscard static ImageFormat
970 DetectFormat(ImageMemory::NativeHandle, size_t);
972 YB_ATTR_nodiscard static ImageFormat
973 DetectFormat(const char*);
975 YB_ATTR_nodiscard static ImageFormat
976 DetectFormat(const char16_t*);
978
980 YB_ATTR_nodiscard YB_PURE static CompactPixmap
981 Load(ImageMemory::Buffer);
982
990 YB_ATTR_nodiscard static HMultiBitmap
992 LoadForPlaying(const char*);
994 YB_ATTR_nodiscard static HMultiBitmap
995 LoadForPlaying(const char16_t*);
1000 template<class _tString,
1001 yimpl(typename = ystdex::enable_for_string_class_t<_tString>)>
1002 YB_ATTR_nodiscard static HMultiBitmap
1003 LoadForPlaying(const _tString& filename)
1004 {
1005 return LoadForPlaying(&filename[0]);
1006 }
1008
1015 template<class _tSeqCon, typename _type>
1016 YB_ATTR_nodiscard static _tSeqCon
1017 LoadSequence(const _type& path)
1018 {
1019 const auto multi_bitmap(LoadForPlaying(path));
1020 _tSeqCon con(multi_bitmap.begin(), multi_bitmap.end());
1021
1022 if(con.empty())
1023 con.emplace_back(path);
1024 return con;
1025 }
1026 };
1027
1028 } // namespace Drawing;
1029
1030 } // namespace YSLib;
1031
1032 #endif
1033
YSLib::Drawing::ImageMetadataModel
ImageMetadataModel
图像元数据模型标识。
Definition: Image.h:140
YSLib::Drawing::ImageMetadataModel::Custom
@ Custom
YSLib::Drawing::buffer
The boundary is out of the buffer
Definition: YDraw.h:118
YSLib::Drawing::MultiBitmapData
Definition: Image.cpp:464
YSLib::Drawing::HBitmap::Deleter::pointer
::FIBITMAP * pointer
Definition: Image.h:309
DefDeCtor
#define DefDeCtor(_t)
简单通用成员函数定义。
Definition: YBaseMacro.h:157
YB_ATTR_nodiscard
#define YB_ATTR_nodiscard
标记返回值不被忽略的属性。
Definition: ydef.h:715
YSLib::Drawing::ImageTag::DefBoolNeg
DefBoolNeg(explicit, p_tag) YB_ATTR_nodiscard YB_PURE size_t GetCount() const ynothrow
YSLib::Drawing::ImageDecoderFlags::JPEG_QualitySuperb
@ JPEG_QualitySuperb
YSLib::swap
void swap(ValueNode &x, ValueNode &y) ynothrowv
Definition: ValueNode.cpp:95
ystdex::cpp2017::swap
void swap(optional< _type > &x, optional< _type > &y)
Definition: optional.h:888
YSLib::Drawing::ImageMemory::format
ImageFormat format
Definition: Image.h:239
YSLib::Drawing::GetLogicalSizeOf
YB_ATTR_nodiscard YF_API YB_PURE Size GetLogicalSizeOf(const HBitmap &)
取图像逻辑大小。
Definition: Image.cpp:454
YSLib::Drawing::Size
屏幕区域大小。
Definition: YGDIBase.h:536
YSLib::Drawing::ImplRet
YB_ATTR_nodiscard YB_STATELESS yconstfn Rotation rot ImplRet(Rotation((size_t(rot)+1) % 4)) YB_ATTR_nodiscard YB_STATELESS yconstfn PDefH(Rotation
YB_PURE
#define YB_PURE
指示函数或函数模板实例为纯函数。
Definition: ydef.h:919
YSLib::Drawing::BadImageAlloc::DefDeCtor
DefDeCtor(BadImageAlloc) DefDeCopyCtor(BadImageAlloc) ~BadImageAlloc() override
虚析构：类定义外默认实现。
YSLib::Drawing::HBitmap::HBitmap
HBitmap(const _tString &filename, ImageFormat fmt, ImageDecoderFlags=ImageDecoderFlags::Default)
构造：使用指定字符串文件名和解码器标识。
Definition: Image.h:399
YSLib::Drawing::ImageDecoderFlags::GIF_Playback
@ GIF_Playback
platform::references::unique_ptr_from
unique_ptr< ystdex::defer_element< ystdex::unique_ptr_pointer< void, _tDeleter >, _tDefault >, _tDeleter > unique_ptr_from
取删除器对应的 unique_ptr 实例。
Definition: Reference.h:110
YSLib::Drawing::UnsupportedImageFormat::DefDeCopyCtor
DefDeCopyCtor(UnsupportedImageFormat) ~UnsupportedImageFormat() override
虚析构：类定义外默认实现。
YSLib::Drawing::ImageMemory::ImageMemory
ImageMemory(const HBitmap &, ImageFormat=ImageFormat::BMP, ImageDecoderFlags=ImageDecoderFlags::Default)
构造：从现有图像打开。
YSLib::Drawing::ImageDecoderFlags::JPEG_Subsampling_411
@ JPEG_Subsampling_411
YSLib::Drawing::x
const TextState &ts const TextState &ts const TextState &ts TextState SPos x
Definition: TextBase.h:190
YSLib::Drawing::ImageMetadataFindData::DataPtr
::FIMETADATA * DataPtr
Definition: Image.h:848
YSLib::Drawing::HMultiBitmap::DefDeCtor
DefDeCtor(HMultiBitmap) HMultiBitmap(const char *
无参数构造：默认实现。
YSLib::Drawing::ImageMetadataModel::EXIF_Main
@ EXIF_Main
DefDeMoveCtor
#define DefDeMoveCtor(_t)
Definition: YBaseMacro.h:167
YSLib::Drawing::UnknownImageFormat::DefDeCopyCtor
DefDeCopyCtor(UnknownImageFormat) ~UnknownImageFormat() override
虚析构：类定义外默认实现。
YSLib::Drawing::HBitmap::p_bitmap
unique_ptr_from< Deleter > p_bitmap
Definition: Image.h:317
YSLib::Drawing::ImageDecoderFlags::GIF_Load256
@ GIF_Load256
YSLib::Drawing::ImageDecoderFlags::JPEG_Accurate
@ JPEG_Accurate
YSLib::Drawing::ImageMemory::Deleter::operator()
void operator()(pointer) const ynothrow
ystdex::exclude_self_params_t
enable_if_t< not_< cond_or_t< bool_< sizeof...(_tParams)==1 >, false_, is_same_param, _tSelected, _tParams... > >::value, void > exclude_self_params_t
排除选择类型的特定参数类型的重载。
Definition: type_op.hpp:295
YSLib::Drawing::ImageDecoderFlags::JPEG_QualityNormal
@ JPEG_QualityNormal
YSLib::Drawing::ImageTag::ImageTag
ImageTag(const _tBitmap &bmp, ImageMetadataModel model, _tString &name)
Definition: Image.h:756
YSLib::IO::int
YF_API int
Definition: File.h:51
CHRLib::CharSet::ASCII
yconstexpr const Encoding ASCII(US_ASCII)
YSLib::Drawing::ImageMetadataModel::XMP
@ XMP
YSLib::Drawing::ImageTag::ImageTag
ImageTag(const ImageTag &tag, ystdex::false_) ynothrow
Definition: Image.h:766
YSLib::Drawing::ImageTag::DefDeCtor
DefDeCtor(ImageTag) ImageTag(DataPtr ptr
构造：使用现有数据指针。
Type
const EncapsulationBase const EncapsulationBase &y ynothrow const EncapsulationBase *this const shared_ptr< void > Type
Definition: NPLA1Forms.cpp:1542
YSLib::Drawing::ImageMemory::ImageMemory
ImageMemory(_func f, ImageFormat fmt)
构造：以指定格式新建并打开内存缓冲区。
Definition: Image.h:279
YF_API
#define YF_API
Definition: Platform.h:56
ystdex::copy_and_swap
_type & copy_and_swap(_type &obj, const _type2 &new_val)
复制对象并交换。
Definition: swap.hpp:514
YSLib::GeneralEvent
std::runtime_error GeneralEvent
一般运行时异常事件类。
Definition: YException.h:46
ythrow
#define ythrow(...)
YSLib 动态异常规范：根据是否使用异常规范宏指定或忽略动态异常规范。
Definition: ydef.h:1256
YSLib::Drawing::ImageMetadataModel::NoData
@ NoData
ystdex::enable_for_string_class_t
enable_if_t< is_string_class< decay_t< _tParam > >::value, _type > enable_for_string_class_t
选择字符串类类型的特定重载避免和其它非字符串类型冲突。
Definition: string.hpp:1019
YSLib::Drawing::GetFrameTimeOf
TimeSpan GetFrameTimeOf(const HBitmap &bmp)
Definition: Image.cpp:446
YSLib::Drawing::ImageDecoderFlags::Default
@ Default
YSLib::Drawing::ImageFormat::BMP
@ BMP
ystdex::indirect_input_iterator
间接输入迭代器。
Definition: iterator.hpp:791
CHRLib::f
f(d, s)
YSLib::Drawing::ImageMemory
图像内存对象；保存图像内容的数据缓冲对象。
Definition: Image.h:221
YSLib::Drawing::ImageTag
图像元数据标签。
Definition: Image.h:691
YSLib::Drawing::ImageMetadataModel::EXIF_MakerNote
@ EXIF_MakerNote
YSLib::Drawing::ImageCodec::LoadForPlaying
static YB_ATTR_nodiscard HMultiBitmap LoadForPlaying(const _tString &filename)
构造：使用指定字符串文件名。
Definition: Image.h:1003
YSLib::Drawing::HBitmap::DefDeMoveCtor
DefDeMoveCtor(HBitmap) DefDeDtor(HBitmap) PDefHOp(HBitmap &
复制赋值：使用复制和交换。
YSLib::Drawing::ImageMetadataFindData::CurrentModel
ImageMetadataModel CurrentModel
当前生效的模型。
Definition: Image.h:855
platform::KeyCategory::Lock
@ Lock
表示锁定键。
Definition: Keys.h:115
ystdex::deref_self
bases::deref_self< _type > deref_self
Definition: base.h:222
YSLib::Drawing::ImageDecoderFlags::JPEG_QualityGood
@ JPEG_QualityGood
YSLib::Drawing::PDefH
YB_ATTR_nodiscard YB_PURE yconstfn PDefH(Size, Transpose, const Size &s) ynothrow ImplRet(
转置。
Definition: YGDIBase.h:763
YSLib::Drawing::ImageFormat::PNG
@ PNG
YSLib::Drawing::ImageMetadataModel::EXIF_GPS
@ EXIF_GPS
YSLib::Drawing::BadImageAlloc
图像资源分配失败异常：表示存储等资源不足导致无法创建图像。
Definition: Image.h:162
YSLib::Drawing::HBitmap
位图句柄：指向位图数据。
Definition: Image.h:302
YSLib::Drawing::ImageDecoderFlags::JPEG_Subsampling_444
@ JPEG_Subsampling_444
YSLib::Drawing::HImageMetadata
元数据句柄：表示打开的元数据和内容迭代状态。
Definition: Image.h:909
YB_ATTR_returns_nonnull
#define YB_ATTR_returns_nonnull
指示返回非空属性。
Definition: ydef.h:761
DefBoolNeg
#define DefBoolNeg(_spec,...)
定义表示显式转换 bool 操作符及其否定的 operator! 。
Definition: YBaseMacro.h:228
YSLib::Drawing::get
YB_ATTR_nodiscard YB_PURE yconstfn _type & get(GBinaryGroup< _type > &val)
取分量。
Definition: YGDIBase.h:484
DefDeDtor
#define DefDeDtor(_t)
Definition: YBaseMacro.h:177
YSLib::Drawing::ImageDecoderFlags::JPEG_EXIFRotate
@ JPEG_EXIFRotate
YSLib::IO::_tString
const string &path const String &path class class class _tString
Definition: YSLib/Service/FileSystem.h:612
YSLib::Drawing::HBitmap::YB_NONNULL
YB_NONNULL(2) HBitmap(BitmapPtr
构造：从矩形像素图缓冲区按指定大小和扫描线跨距增量复制并转换图像数据。
ystdex::make_observer
observer_ptr< _type > make_observer(_type *p)
Definition: pointer.hpp:405
YSLib::Drawing::HMultiBitmap::HMultiBitmap
HMultiBitmap(const _tString &filename, ImageFormat fmt, ImageDecoderFlags flags=ImageDecoderFlags::Default)
构造：使用指定字符串文件名和解码器标识。
Definition: Image.h:645
YSLib::Drawing::ImageDecoderFlags::JPEG_QualityAverage
@ JPEG_QualityAverage
yforward
#define yforward(_expr)
根据参数类型使用 std::forward 转发对应参数。
Definition: ydef.h:1508
YSLib::Drawing::ImageFormat::GIF
@ GIF
YSLib::Drawing::ImageMetadataModel::EXIF_RAW
@ EXIF_RAW
DefSwap
#define DefSwap(_q, _t,...)
定义交换函数。
Definition: YBaseMacro.h:302
YSLib::Drawing::UnknownImageFormat
未知图像格式异常：表示请求的操作涉及的图像格式因为不明确而不受库的支持。
Definition: Image.h:201
YSLib::Drawing::HMultiBitmap
多页面位图句柄：指向多页面位图数据。
Definition: Image.h:587
ystdex::cpp2017::end
auto end(_tRange &c) -> decltype(c.end())
Definition: range.hpp:345
YSLib::Drawing::ImageMetadataModel::Comments
@ Comments
std
Definition: optional.h:982
YSLib::Drawing::ImageDecoderFlags::JPEG_Subsampling_422
@ JPEG_Subsampling_422
YSLib::Drawing::ImageFormat::ICO
@ ICO
YSLib::yimpl
YF_API yimpl(GUIApplication &) FetchGlobalInstance()
取全局应用程序实例。
YSLib::Drawing::ImageFormat
ImageFormat
图像格式。
Definition: Image.h:69
type_op.hpp
C++ 类型操作。
YSLib::Drawing::ImageDecoderFlags::JPEG_QualityBad
@ JPEG_QualityBad
YSLib::Drawing::ImageFormat::Unknown
@ Unknown
YSLib::Drawing::ImageMetadataModel::EXIF_Interop
@ EXIF_Interop
YSLib::Drawing::BitPerPixel
std::uint8_t BitPerPixel
Definition: Image.h:59
platform::SDst
std::uint16_t SDst
屏幕坐标距离。
Definition: Video.h:44
YSLib::Drawing::ImageFormat::JPEG
@ JPEG
YSLib::UI::Close
void Close(IWidget &wgt)
Definition: YWidget.cpp:92
YSLib::Drawing::CompactPixmap
标准矩形像素图缓冲区。
Definition: YGDI.h:233
platform::containers::vector
std::vector< _type, _tAlloc > vector
Definition: Container.h:102
YSLib::UI::y
SPos SPos y
Definition: YWidget.cpp:44
YSLib::Drawing::ImageTag::ID
std::uint16_t ID
Definition: Image.h:694
YSLib::Drawing::ImageDecoderFlags
ImageDecoderFlags
图像解码器标识。
Definition: Image.h:86
YSLib::path
YB_ATTR_nodiscard YF_API const char * path
Definition: Initialization.h:116
YSLib::Drawing::ImageCodec::LoadSequence
static YB_ATTR_nodiscard _tSeqCon LoadSequence(const _type &path)
读取指定路径的图片文件为用于直接呈现的帧序列。
Definition: Image.h:1017
YSLib
YSLib 命名空间。
Definition: AndroidHost.h:46
YSLib::Drawing::ImageMetadataModel::Animation
@ Animation
YSLib::Drawing::PDefHOp
YB_ATTR_nodiscard yconstfn YB_PURE x x x Bottom YB_ATTR_nodiscard yconstfn YB_PURE PDefHOp(Padding,+, const Padding &x, const Padding &y) ynothrow ImplRet(Padding(x.Left+y.Left
加法：对应分量调用 operator+ 。
YSLib::Drawing::ImageMemory::Buffer
vector< octet > Buffer
Definition: Image.h:225
YSLib::Drawing::ImageDecoderFlags::JPEG_GreyScale
@ JPEG_GreyScale
YSLib::Drawing::HImageMetadata::HImageMetadata
HImageMetadata(_tParams &&... args)
Definition: Image.h:915
NPL::A1::name
const char * name
Definition: NPLA1.h:1876
YSLib::Drawing::ynothrow
YB_ATTR_nodiscard yconstfn YB_PURE x x x Bottom YB_ATTR_nodiscard yconstfn YB_PURE x Right y x Top y x Bottom y Bottom YB_ATTR_nodiscard yconstfn YB_PURE x Right y x Top y x Bottom y Bottom YB_ATTR_nodiscard yconstfn YB_PURE const Padding & ynothrow
Definition: YGDI.h:132
YSLib::Drawing::ImplExpr
const TextState &ts const TextState &ts const TextState &ts TextState SPos SPos y ImplExpr(ts.Pen=Point(x, y)) YF_API void SetCurrentTextLineNOf(TextState &
设置笔的行位置。
platform::Deref
YB_PURE yconstfn auto Deref(_type &&p) -> decltype(*p)
断言并解引用非空指针。
Definition: Debug.h:547
YSLib::Drawing::ImageDecoderFlags::JPEG_Optimize
@ JPEG_Optimize
YSLib::Drawing::HBitmap::DataPtr
observer_ptr<::FIBITMAP > DataPtr
Definition: Image.h:304
YSLib::Drawing::HMultiBitmap::DataPtr
shared_ptr< MultiBitmapData > DataPtr
Definition: Image.h:589
CHRLib::char16_t
YB_ATTR_nodiscard YB_PURE char16_t((*c_ptr<< CHAR_BIT)|c_ptr[1])) YB_ATTR_nodiscard YB_PURE inline PDefH(char16_t
取 c_ptr 指向的小端序双字节字符。
YSLib::Drawing::ImageDecoderFlags::JPEG_CMYK
@ JPEG_CMYK
ynothrowv
#define ynothrowv
YSLib 无异常抛出保证验证：有条件地使用无异常抛出规范。
Definition: ydef.h:1219
YSLib::Drawing::ImageDecoderFlags::JPEG_Progressive
@ JPEG_Progressive
ystdex
<memory> 特性测试宏。
Definition: ydef.h:1262
YSLib::Drawing::ImageMemory::ImageMemory
ImageMemory(_func f)
构造：新建并打开内存缓冲区。
Definition: Image.h:274
YSLib::Drawing::HImageMetadata::PDefHOp
DefDeMoveCtor(HImageMetadata) DefDeMoveAssignment(HImageMetadata) using deref_self< HImageMetadata > PDefHOp(HImageMetadata &,++,) ynothrow ImplRet(Read()
间接操作：取自身引用。
YSLib::Drawing::ImageMetadataModel::EXIF_EXIF
@ EXIF_EXIF
YSLib::_tParams
YB_ATTR_nodiscard YB_PURE typename _tParams
Definition: ValueNode.h:1294
YSLib::Drawing::ImageDecoderFlags::JPEG_Subsampling_420
@ JPEG_Subsampling_420
DefDeCopyCtor
#define DefDeCopyCtor(_t)
Definition: YBaseMacro.h:162
YSLib::YB_NONNULL
YB_ATTR_nodiscard YF_API YB_NONNULL(1, 2) ValueNode LoadNPLA1File(const char *disp
载入 NPLA1 配置文件。
YSLib::Drawing::HBitmap::DefDeCtor
DefDeCtor(HBitmap) HBitmap(DataPtr ptr) ynothrow
构造：使用现有数据指针。
Definition: Image.h:324
DefCvt
#define DefCvt(_q, _t,...)
Definition: YBaseMacro.h:206
YSLib::Drawing::ImageMemory::buffer
Buffer buffer
Definition: Image.h:238
YSLib::Drawing::ImageMetadataModel::GeoTIFF
@ GeoTIFF
DefGetter
#define DefGetter(_q, _t, _n,...)
Definition: YBaseMacro.h:241
DefBitmaskEnum
#define DefBitmaskEnum(_tEnum)
Definition: YBaseMacro.h:505
YSLib::Drawing::ImageMetadataFindData
图像元数据。
Definition: Image.h:846
YSLib::Drawing::ImageMemory::p_memory
unique_ptr_from< Deleter > p_memory
Definition: Image.h:241
ystdex::unsupported
异常：不支持的操作。
Definition: ystdex/exception.h:116
platform::p
return p p
Definition: YCLib/FileSystem.h:209
platform::ID
std::uintmax_t ID
YF_Platform_* 宏替换值的公共类型。
Definition: YCommon.h:54
const
const Decapsulate const Decapsulate &y ynothrow ContextNode &ctx const
Definition: NPLA1Forms.cpp:1629
DefDeMoveAssignment
#define DefDeMoveAssignment(_t)
Definition: YBaseMacro.h:191
YSLib::Drawing::ImageTag::DataPtr
::FITAG * DataPtr
Definition: Image.h:693
YSLib::Drawing::BitmapPtr
Pixel * BitmapPtr
Definition: YGraphics.h:42
ystdex::false_
bool_< false > false_
Definition: integral_constant.hpp:110
YSLib::Timers::TimeSpan
std::chrono::duration< Duration::rep, std::milli > TimeSpan
低精度时间间隔。
Definition: YClock.h:81
YSLib::Drawing::GetHeight
YB_ATTR_nodiscard YB_PURE tr GetHeight())) inline PDefH(void
按字体高度和行距调整文本区域的底边距。
YSLib::Drawing::ImageMemory::NativeHandle
::FIMEMORY * NativeHandle
Definition: Image.h:223
YSLib::Drawing::ImageDecoderFlags::JPEG_Fast
@ JPEG_Fast
YSLib::args
YB_ATTR_nodiscard YB_PURE typename _tParams && args
Definition: ValueNode.h:1299
YSLib::Drawing::ImageMemory::Deleter::pointer
NativeHandle pointer
Definition: Image.h:232
YSLib::Drawing::ImageCodec
Definition: Image.h:952
YSLib::Drawing::HMultiBitmap::DefDeCopyMoveCtorAssignment
DefDeCopyMoveCtorAssignment(HMultiBitmap) DefBoolNeg(explicit
YSLib::Drawing::ImageMetadataModel::IPTC
@ IPTC
YSLib::Drawing::UnsupportedImageFormat
未被支持的图像格式异常：表示请求的操作涉及的图像格式不受库的支持。
Definition: Image.h:180
YSLib::Drawing::HBitmap::Deleter
Definition: Image.h:307
YSLib::Drawing::ImageDecoderFlags::JPEG_Baseline
@ JPEG_Baseline
ystdex::subscriptive_iterator
成员下标迭代器。
Definition: iterator.hpp:1193
YSLib::Drawing::ImageDecoderFlags::ICO_MakeAlpha
@ ICO_MakeAlpha
YSLib::Drawing::ImageMemory::DefDelMoveCtor
DefDelMoveCtor(ImageMemory) DefDeDtor(ImageMemory) DefGetter(const ynothrow
YSLib::Drawing::ImageMemory::Deleter
Definition: Image.h:230
YSLib::Drawing::to_string
YB_ATTR_nodiscard YB_PURE std::string to_string(const GBinaryGroup< _type > &val)
转换为字符串。
Definition: YGDIBase.h:507
ystdex::cpp2017::begin
auto begin(_tRange &c) -> decltype(c.begin())
Definition: range.hpp:323
YSLib::Drawing::ImageTag::Type
Type
元数据类型标识。
Definition: Image.h:700