Files
pixelarium/lib/rendering/ImageViewFactory.cpp
T
m-aXimilian bce12b0bb4 Proper image rendering ux (#5)
* can draw from selection

* add light-weight render manager to render many images simultaneously

* [debug me] currently the image close button does not do

* the unselected image can be closed now

* can close images and manually open them on demand

* cosmetic

* image view stuff in render subdirectory

* cosmetic

* generate docs

* review

windows support

some cosmetics

💅 and pin libCZI module
2026-02-16 20:36:45 +01:00

23 lines
781 B
C++

#include "ImageViewFactory.hpp"
#include <memory>
#include <optional>
/// @brief Creates a PixelariumImageView from a resource image.
/// @param image_id The ID of the image resource to render.
/// @return A unique pointer to the PixelariumImageView, or nullptr if the image resource is not found or is empty. The image data is copied.
std::unique_ptr<pixelarium::render::PixelariumImageView> pixelarium::render::ImageViewFactory::RenderImage(
size_t image_id)
{
auto img{this->image_pool_.GetResource(image_id)};
if (!img.has_value() || img.value()->Empty())
{
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()));
}