Files
pixelarium/lib/imaging/impl/PixelariumJpg.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"
namespace pixelarium::imaging
{
2025-09-26 21:09:51 +02:00
/// @brief Implements support for .jpg-images in the realm of IPixelariumImage
2025-09-22 23:13:28 +02:00
class PixelariumJpg : public IPixelariumImage
{
public:
explicit PixelariumJpg(const std::string& url);
// IPixelariumImage member implementations
public:
2025-09-23 21:57:08 +02:00
std::unique_ptr<cv::Mat> TryGetImage() override;
2025-09-22 23:13:28 +02:00
2025-09-23 21:57:08 +02:00
std::unique_ptr<cv::Mat> TryGetImage(const IImageQuery&) override
2025-09-22 23:13:28 +02:00
{
// ToDo: proper error
throw std::runtime_error("Not possible with jpg.");
}
2025-09-23 21:57:08 +02:00
std::vector<std::unique_ptr<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 jpg.");
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::kJpg};
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