| 1 | // Aseprite |
| 2 | // Copyright (C) 2019 Igara Studio S.A. |
| 3 | // |
| 4 | // This program is distributed under the terms of |
| 5 | // the End-User License Agreement for Aseprite. |
| 6 | |
| 7 | #ifndef APP_FILE_PNG_OPTIONS_H_INCLUDED |
| 8 | #define APP_FILE_PNG_OPTIONS_H_INCLUDED |
| 9 | #pragma once |
| 10 | |
| 11 | #include "app/file/format_options.h" |
| 12 | #include "base/buffer.h" |
| 13 | |
| 14 | namespace app { |
| 15 | |
| 16 | // Data for PNG files |
| 17 | class PngOptions : public FormatOptions { |
| 18 | public: |
| 19 | struct Chunk { |
| 20 | std::string name; |
| 21 | base::buffer data; |
| 22 | // Flags PNG_HAVE_IHDR/PNG_HAVE_PLTE/PNG_AFTER_IDAT |
| 23 | int location; |
| 24 | }; |
| 25 | |
| 26 | using Chunks = std::vector<Chunk>; |
| 27 | |
| 28 | void addChunk(Chunk&& chunk) { |
| 29 | m_userChunks.emplace_back(std::move(chunk)); |
| 30 | } |
| 31 | |
| 32 | bool isEmpty() const { |
| 33 | return m_userChunks.empty(); |
| 34 | } |
| 35 | |
| 36 | int size() const { |
| 37 | return int(m_userChunks.size()); |
| 38 | } |
| 39 | |
| 40 | const Chunks& chunks() const { return m_userChunks; } |
| 41 | |
| 42 | private: |
| 43 | Chunks m_userChunks; |
| 44 | }; |
| 45 | |
| 46 | } // namespace app |
| 47 | |
| 48 | #endif |
| 49 | |