78 lines
2.7 KiB
C++
78 lines
2.7 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
#include <memory>
|
|
#include <cstdint>
|
|
#include <atomic>
|
|
|
|
#include <pdfengine/image_geometry.hpp>
|
|
#include <pdfengine/image_encoding.hpp>
|
|
#include <pdfengine/image_color_profile.hpp>
|
|
#include <pdfengine/image_pixel_buffer.hpp>
|
|
#include <pdfengine/image_mask.hpp>
|
|
#include <pdfengine/image_diagnostics.hpp>
|
|
|
|
namespace pdfengine {
|
|
|
|
using ImageId = uint64_t;
|
|
|
|
ImageId generateNextImageId();
|
|
|
|
class ImageObject {
|
|
public:
|
|
ImageObject(ImageId id,
|
|
std::string name,
|
|
ImageGeometry geometry,
|
|
ImageEncoding encoding,
|
|
ImageColorProfile colorProfile,
|
|
ImagePixelBuffer pixels,
|
|
ImageMask mask,
|
|
std::vector<uint8_t> originalStream,
|
|
ImageDiagnostics diagnostics = {},
|
|
ImageStatistics statistics = {})
|
|
: m_id(id),
|
|
m_name(std::move(name)),
|
|
m_geometry(geometry),
|
|
m_encoding(std::move(encoding)),
|
|
m_colorProfile(std::move(colorProfile)),
|
|
m_pixels(std::move(pixels)),
|
|
m_mask(std::move(mask)),
|
|
m_originalStream(std::move(originalStream)),
|
|
m_diagnostics(diagnostics),
|
|
m_statistics(statistics) {}
|
|
|
|
[[nodiscard]] ImageId id() const noexcept { return m_id; }
|
|
[[nodiscard]] const std::string& name() const noexcept { return m_name; }
|
|
[[nodiscard]] const ImageGeometry& geometry() const noexcept { return m_geometry; }
|
|
[[nodiscard]] const ImageEncoding& encoding() const noexcept { return m_encoding; }
|
|
[[nodiscard]] const ImageColorProfile& colorProfile() const noexcept { return m_colorProfile; }
|
|
[[nodiscard]] const ImagePixelBuffer& pixels() const noexcept { return m_pixels; }
|
|
[[nodiscard]] const ImageMask& mask() const noexcept { return m_mask; }
|
|
[[nodiscard]] const std::vector<uint8_t>& originalStream() const noexcept { return m_originalStream; }
|
|
[[nodiscard]] const ImageDiagnostics& diagnostics() const noexcept { return m_diagnostics; }
|
|
[[nodiscard]] const ImageStatistics& statistics() const noexcept { return m_statistics; }
|
|
|
|
[[nodiscard]] bool isValid() const noexcept {
|
|
return m_id != 0 && m_geometry.isValid() && !m_pixels.empty();
|
|
}
|
|
|
|
[[nodiscard]] size_t byteSize() const noexcept {
|
|
return sizeof(*this) + m_pixels.size() + m_originalStream.size();
|
|
}
|
|
|
|
private:
|
|
ImageId m_id = 0;
|
|
std::string m_name;
|
|
ImageGeometry m_geometry;
|
|
ImageEncoding m_encoding;
|
|
ImageColorProfile m_colorProfile;
|
|
ImagePixelBuffer m_pixels;
|
|
ImageMask m_mask;
|
|
std::vector<uint8_t> m_originalStream;
|
|
ImageDiagnostics m_diagnostics;
|
|
ImageStatistics m_statistics;
|
|
};
|
|
|
|
} // namespace pdfengine
|