LIBPOLYMNIA
pngio.h
[詳解]
1 /**************************************************************************
2  *
3  * pngoio.h
4  * by oZ/acy
5  * (c) 2002-2018 oZ/acy. ALL RIGHTS RESERVED.
6  *
7  * PNG IO for part "polymnia"
8  * PNG`摜o̓NX (libpngbp)
9  *
10  * Classes defined in this file are inplemented with "libpng" library.
11  * The author thanks authors of "libpng."
12  *
13  * * 2018.12.23 C++17 * *************************************************************************/ #ifndef INC_POLYMNIA_PNGIO_H__ #define INC_POLYMNIA_PNGIO_H__ #include "picture.h" #include "pictio.h" namespace polymnia { class PngLoader; class IndexedPngLoader; class PngSaver; class IndexedPngSaver; } /*---------------------------------- * PngLoader * PNG`[_ * RGB24bit摜ƂĎ荞 */ class polymnia::PngLoader : public polymnia::PictLoader<polymnia::Picture> { public: PngLoader() {} ~PngLoader() {} polymnia::Picture* load(const std::filesystem::path& path) override; }; /*----------------------------------------------- * IndexedPngLoader * PNG`[_ (8bitȉindexed) * 8bit indexed 摜ƂĎ荞 */ class polymnia::IndexedPngLoader : public polymnia::PictLoader<polymnia::PictureIndexed> { public: IndexedPngLoader() {} ~IndexedPngLoader() {} polymnia::PictureIndexed* load(const std::filesystem::path& path) override; }; /*------------------------------------------- * PngSaver * 24bit RGB PNG`̃Z[o * C^[X̗L/ݒ”\ */ class polymnia::PngSaver : public polymnia::PictSaver<polymnia::Picture> { private: bool interlace; public: PngSaver() : interlace(false) {} ~PngSaver() {} void enableInterlace() { interlace = true; } void disableInterlace() { interlace = false; } bool save( const polymnia::Picture* p, const std::filesystem::path& path) override; }; /*-------------------------------------------------- * IndexedPngSaver * 8bit indexed PNG`̃Z[o * C^[X̗L/, ߐFݒ”\ */ class polymnia::IndexedPngSaver : public polymnia::PictSaver<polymnia::PictureIndexed> { private: bool interlace; bool trans; themis::UByte paltp; public: IndexedPngSaver() : interlace(false), trans(false), paltp(0) {} ~IndexedPngSaver() {} void enableInterlace() { interlace = true; } void disableInterlace() { interlace = false; } void enableTransparent(themis::UByte pl) { trans = true; paltp = pl; } void disableTransparent() { trans = false; } bool save( const polymnia::PictureIndexed* p, const std::filesystem::path& path) override; }; #endif //eof
14  * 2018.12.23 C++17 * *************************************************************************/ #ifndef INC_POLYMNIA_PNGIO_H__ #define INC_POLYMNIA_PNGIO_H__ #include "picture.h" #include "pictio.h" namespace polymnia { class PngLoader; class IndexedPngLoader; class PngSaver; class IndexedPngSaver; } /*---------------------------------- * PngLoader * PNG`[_ * RGB24bit摜ƂĎ荞 */ class polymnia::PngLoader : public polymnia::PictLoader<polymnia::Picture> { public: PngLoader() {} ~PngLoader() {} polymnia::Picture* load(const std::filesystem::path& path) override; }; /*----------------------------------------------- * IndexedPngLoader * PNG`[_ (8bitȉindexed) * 8bit indexed 摜ƂĎ荞 */ class polymnia::IndexedPngLoader : public polymnia::PictLoader<polymnia::PictureIndexed> { public: IndexedPngLoader() {} ~IndexedPngLoader() {} polymnia::PictureIndexed* load(const std::filesystem::path& path) override; }; /*------------------------------------------- * PngSaver * 24bit RGB PNG`̃Z[o * C^[X̗L/ݒ”\ */ class polymnia::PngSaver : public polymnia::PictSaver<polymnia::Picture> { private: bool interlace; public: PngSaver() : interlace(false) {} ~PngSaver() {} void enableInterlace() { interlace = true; } void disableInterlace() { interlace = false; } bool save( const polymnia::Picture* p, const std::filesystem::path& path) override; }; /*-------------------------------------------------- * IndexedPngSaver * 8bit indexed PNG`̃Z[o * C^[X̗L/, ߐFݒ”\ */ class polymnia::IndexedPngSaver : public polymnia::PictSaver<polymnia::PictureIndexed> { private: bool interlace; bool trans; themis::UByte paltp; public: IndexedPngSaver() : interlace(false), trans(false), paltp(0) {} ~IndexedPngSaver() {} void enableInterlace() { interlace = true; } void disableInterlace() { interlace = false; } void enableTransparent(themis::UByte pl) { trans = true; paltp = pl; } void disableTransparent() { trans = false; } bool save( const polymnia::PictureIndexed* p, const std::filesystem::path& path) override; }; #endif //eof
15  *
16  *************************************************************************/
17 #ifndef INC_POLYMNIA_PNGIO_H__
18 #define INC_POLYMNIA_PNGIO_H__
19 
20 #include "picture.h"
21 #include "pictio.h"
22 
23 namespace polymnia
24 {
25  class PngLoader;
26  class IndexedPngLoader;
27  class PngSaver;
28  class IndexedPngSaver;
29 }
30 
31 
32 /*----------------------------------
33  * PngLoader
34  * PNG`[_
35  * RGB24bit摜ƂĎ荞 */ class polymnia::PngLoader : public polymnia::PictLoader<polymnia::Picture> { public: PngLoader() {} ~PngLoader() {} polymnia::Picture* load(const std::filesystem::path& path) override; }; /*----------------------------------------------- * IndexedPngLoader * PNG`[_ (8bitȉindexed) * 8bit indexed 摜ƂĎ荞 */ class polymnia::IndexedPngLoader : public polymnia::PictLoader<polymnia::PictureIndexed> { public: IndexedPngLoader() {} ~IndexedPngLoader() {} polymnia::PictureIndexed* load(const std::filesystem::path& path) override; }; /*------------------------------------------- * PngSaver * 24bit RGB PNG`̃Z[o * C^[X̗L/ݒ”\ */ class polymnia::PngSaver : public polymnia::PictSaver<polymnia::Picture> { private: bool interlace; public: PngSaver() : interlace(false) {} ~PngSaver() {} void enableInterlace() { interlace = true; } void disableInterlace() { interlace = false; } bool save( const polymnia::Picture* p, const std::filesystem::path& path) override; }; /*-------------------------------------------------- * IndexedPngSaver * 8bit indexed PNG`̃Z[o * C^[X̗L/, ߐFݒ”\ */ class polymnia::IndexedPngSaver : public polymnia::PictSaver<polymnia::PictureIndexed> { private: bool interlace; bool trans; themis::UByte paltp; public: IndexedPngSaver() : interlace(false), trans(false), paltp(0) {} ~IndexedPngSaver() {} void enableInterlace() { interlace = true; } void disableInterlace() { interlace = false; } void enableTransparent(themis::UByte pl) { trans = true; paltp = pl; } void disableTransparent() { trans = false; } bool save( const polymnia::PictureIndexed* p, const std::filesystem::path& path) override; }; #endif //eof
36  */
37 class polymnia::PngLoader : public polymnia::PictLoader<polymnia::Picture>
38 {
39 public:
40  PngLoader() {}
42  polymnia::Picture* load(const std::filesystem::path& path) override;
43 };
44 
45 
46 /*-----------------------------------------------
47  * IndexedPngLoader
48  * PNG`[_ (8bitȉindexed)
49  * 8bit indexed 摜ƂĎ荞 */ class polymnia::IndexedPngLoader : public polymnia::PictLoader<polymnia::PictureIndexed> { public: IndexedPngLoader() {} ~IndexedPngLoader() {} polymnia::PictureIndexed* load(const std::filesystem::path& path) override; }; /*------------------------------------------- * PngSaver * 24bit RGB PNG`̃Z[o * C^[X̗L/ݒ”\ */ class polymnia::PngSaver : public polymnia::PictSaver<polymnia::Picture> { private: bool interlace; public: PngSaver() : interlace(false) {} ~PngSaver() {} void enableInterlace() { interlace = true; } void disableInterlace() { interlace = false; } bool save( const polymnia::Picture* p, const std::filesystem::path& path) override; }; /*-------------------------------------------------- * IndexedPngSaver * 8bit indexed PNG`̃Z[o * C^[X̗L/, ߐFݒ”\ */ class polymnia::IndexedPngSaver : public polymnia::PictSaver<polymnia::PictureIndexed> { private: bool interlace; bool trans; themis::UByte paltp; public: IndexedPngSaver() : interlace(false), trans(false), paltp(0) {} ~IndexedPngSaver() {} void enableInterlace() { interlace = true; } void disableInterlace() { interlace = false; } void enableTransparent(themis::UByte pl) { trans = true; paltp = pl; } void disableTransparent() { trans = false; } bool save( const polymnia::PictureIndexed* p, const std::filesystem::path& path) override; }; #endif //eof
50  */
52 : public polymnia::PictLoader<polymnia::PictureIndexed>
53 {
54 public:
57  polymnia::PictureIndexed* load(const std::filesystem::path& path) override;
58 };
59 
60 
61 
62 /*-------------------------------------------
63  * PngSaver
64  * 24bit RGB PNG`̃Z[o
65  * C^[X̗Lݒ”\ */ class polymnia::PngSaver : public polymnia::PictSaver<polymnia::Picture> { private: bool interlace; public: PngSaver() : interlace(false) {} ~PngSaver() {} void enableInterlace() { interlace = true; } void disableInterlace() { interlace = false; } bool save( const polymnia::Picture* p, const std::filesystem::path& path) override; }; /*-------------------------------------------------- * IndexedPngSaver * 8bit indexed PNG`̃Z[o * C^[X̗L/, ߐFݒ”\ */ class polymnia::IndexedPngSaver : public polymnia::PictSaver<polymnia::PictureIndexed> { private: bool interlace; bool trans; themis::UByte paltp; public: IndexedPngSaver() : interlace(false), trans(false), paltp(0) {} ~IndexedPngSaver() {} void enableInterlace() { interlace = true; } void disableInterlace() { interlace = false; } void enableTransparent(themis::UByte pl) { trans = true; paltp = pl; } void disableTransparent() { trans = false; } bool save( const polymnia::PictureIndexed* p, const std::filesystem::path& path) override; }; #endif //eof /ݒ”\
66  */
67 class polymnia::PngSaver : public polymnia::PictSaver<polymnia::Picture>
68 {
69 private:
70  bool interlace;
71 
72 public:
73  PngSaver() : interlace(false) {}
74  ~PngSaver() {}
75  void enableInterlace() { interlace = true; }
76  void disableInterlace() { interlace = false; }
77 
78  bool
79  save(
80  const polymnia::Picture* p, const std::filesystem::path& path) override;
81 };
82 
83 
84 /*--------------------------------------------------
85  * IndexedPngSaver
86  * 8bit indexed PNG`̃Z[o
87  * C^[X̗L, ߐFݒ”\ */ class polymnia::IndexedPngSaver : public polymnia::PictSaver<polymnia::PictureIndexed> { private: bool interlace; bool trans; themis::UByte paltp; public: IndexedPngSaver() : interlace(false), trans(false), paltp(0) {} ~IndexedPngSaver() {} void enableInterlace() { interlace = true; } void disableInterlace() { interlace = false; } void enableTransparent(themis::UByte pl) { trans = true; paltp = pl; } void disableTransparent() { trans = false; } bool save( const polymnia::PictureIndexed* p, const std::filesystem::path& path) override; }; #endif //eof /, ߐFݒ”\
88  */
90 : public polymnia::PictSaver<polymnia::PictureIndexed>
91 {
92 private:
93  bool interlace;
94  bool trans;
95  themis::UByte paltp;
96 
97 public:
98  IndexedPngSaver() : interlace(false), trans(false), paltp(0) {}
100  void enableInterlace() { interlace = true; }
101  void disableInterlace() { interlace = false; }
102  void enableTransparent(themis::UByte pl) { trans = true; paltp = pl; }
103  void disableTransparent() { trans = false; }
104 
105  bool
106  save(
107  const polymnia::PictureIndexed* p,
108  const std::filesystem::path& path) override;
109 };
110 
111 
112 #endif
113 //eof
void enableInterlace()
Definition: pngio.h:75
Definition: pngio.h:37
~PngLoader()
Definition: pngio.h:41
Definition: dibio.h:20
void disableInterlace()
Definition: pngio.h:101
PngLoader()
Definition: pngio.h:40
~IndexedPngLoader()
Definition: pngio.h:56
polymnia::Picture * load(const std::filesystem::path &path) override
Definition: pngin.cpp:176
bool save(const polymnia::Picture *p, const std::filesystem::path &path) override
Definition: pngout.cpp:81
Definition: pngio.h:67
RGB24bit256色パレットカラー畫像バッファ
Definition: picture.h:71
void enableTransparent(themis::UByte pl)
Definition: pngio.h:102
PngSaver()
Definition: pngio.h:73
RGB24bitカラー畫像バッファ
Definition: picture.h:31
IndexedPngLoader()
Definition: pngio.h:55
Definition: pictio.h:26
Definition: pngio.h:51
bool save(const polymnia::PictureIndexed *p, const std::filesystem::path &path) override
Definition: pngout.cpp:130
Definition: pngio.h:89
~IndexedPngSaver()
Definition: pngio.h:99
void enableInterlace()
Definition: pngio.h:100
RGB24bit色とRGB256パレットカラーの畫像バッファクラス
void disableTransparent()
Definition: pngio.h:103
void disableInterlace()
Definition: pngio.h:76
polymnia::PictureIndexed * load(const std::filesystem::path &path) override
Definition: pngin.cpp:234
~PngSaver()
Definition: pngio.h:74
IndexedPngSaver()
Definition: pngio.h:98
Definition: pictio.h:25