Files
pixelarium/lib/imaging/impl/include/PixelariumPng.hpp
T

43 lines
1.1 KiB
C++
Raw Normal View History

2025-09-22 23:13:28 +02:00
#pragma once
#include <stdexcept>
#include <string>
#include "IPixelariumImage.hpp"
2025-09-22 23:13:28 +02:00
namespace pixelarium::imaging
{
2025-09-26 21:09:51 +02:00
/// @brief Implements support for .png-images in the realm of IPixelariumImage
2026-01-23 23:00:35 +00:00
class PixelariumPng : public IPixelariumImageCvMat
2025-09-22 23:13:28 +02:00
{
public:
explicit PixelariumPng(const std::string& url);
// IPixelariumImage member implementations
public:
2026-01-23 23:00:35 +00:00
std::optional<cv::Mat> TryGetImage() override;
2025-09-22 23:13:28 +02:00
2026-01-23 23:00:35 +00:00
std::optional<cv::Mat> TryGetImage(const IImageQuery&) override
2025-09-22 23:13:28 +02:00
{
// ToDo: proper error
throw std::runtime_error("Not possible with png.");
}
2026-01-23 23:00:35 +00:00
std::vector<std::optional<cv::Mat>> TryGetImages(const IImageQuery&) override
2025-09-22 23:13:28 +02:00
{
2025-09-23 21:57:08 +02:00
// ToDo: proper error
throw std::runtime_error("Not possible with png.");
2025-09-22 23:13:28 +02:00
}
bool Empty() const noexcept override { return this->is_empty_; }
public:
2025-10-07 12:18:00 +02:00
const static ImageFileType type_{ImageFileType::kPng};
2025-09-22 23:13:28 +02:00
private:
// this should be set by each image getter
// after a new cv::Mat could be instantiated
bool is_empty_{true};
};
} // namespace pixelarium::imaging