2025-09-22 23:13:28 +02:00
|
|
|
#include "PixelariumImageFactory.hpp"
|
|
|
|
|
|
|
|
|
|
#include <cctype>
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
#include "impl/PixelariumCzi.hpp"
|
|
|
|
|
#include "impl/PixelariumJpg.hpp"
|
|
|
|
|
#include "impl/PixelariumPng.hpp"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*static*/ std::unique_ptr<pixelarium::imaging::IPixelariumImage>
|
2025-09-26 21:09:51 +02:00
|
|
|
pixelarium::imaging::PixelariumImageFactory::CreateImage(const std::string& uri, const Log& log)
|
2025-09-22 23:13:28 +02:00
|
|
|
{
|
|
|
|
|
const auto res{std::filesystem::path(uri)};
|
|
|
|
|
const auto target_type{ExtensionToType(res.extension().string())};
|
|
|
|
|
|
|
|
|
|
switch (target_type)
|
|
|
|
|
{
|
2025-10-07 12:18:00 +02:00
|
|
|
case ImageFileType::kUnknown:
|
2025-09-22 23:13:28 +02:00
|
|
|
return {};
|
|
|
|
|
break;
|
2025-10-07 12:18:00 +02:00
|
|
|
case ImageFileType::kAbstract:
|
2025-09-22 23:13:28 +02:00
|
|
|
return {};
|
|
|
|
|
break;
|
2025-10-07 12:18:00 +02:00
|
|
|
case ImageFileType::kPng:
|
2025-09-22 23:13:28 +02:00
|
|
|
return std::make_unique<PixelariumPng>(uri);
|
|
|
|
|
break;
|
2025-10-07 12:18:00 +02:00
|
|
|
case ImageFileType::kJpg:
|
2025-09-22 23:13:28 +02:00
|
|
|
return std::make_unique<PixelariumJpg>(uri);
|
|
|
|
|
break;
|
2025-10-07 12:18:00 +02:00
|
|
|
case ImageFileType::kCzi:
|
2025-09-26 21:09:51 +02:00
|
|
|
return std::make_unique<PixelariumCzi>(uri, log);
|
2025-09-22 23:13:28 +02:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|