init view abstractions

This commit is contained in:
m-aXimilian
2025-06-16 13:19:28 +02:00
parent 189c11aea4
commit 08e27170a3
7 changed files with 72 additions and 26 deletions
+15
View File
@@ -0,0 +1,15 @@
#include "ImageViewFactory.hpp"
#include <memory>
#include <optional>
using namespace pixelarium::ui;
std::unique_ptr<PixelariumImageView> ImageViewFactory::RenderImage(size_t image_id)
{
auto img{this->image_pool_.GetResource(image_id)};
if (!img.has_value()) return nullptr;
// beware: here we copy the actual image resource over to the new image
return std::make_unique<PixelariumImageView>(std::make_shared<Image>(*img.value()));
}