MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ choose_image()

MAYAFLUX_API std::shared_ptr< Buffers::TextureBuffer > MayaFlux::choose_image ( int  desired_channels = 4,
std::optional< Kakshya::Region >  region = std::nullopt 
)

Present a native open-file dialog filtered to image formats and load the chosen file via IOManager::load_image().

Blocks until the user confirms or cancels. Returns nullptr on cancellation, backend error, or if Portal::System is not initialized.

Parameters
desired_channelsChannel count passed to ImageReader (0 keeps the source layout).
regionOptional source-pixel rectangle with inclusive end coordinates.

Definition at line 228 of file Depot.cpp.

230{
231 if (!require_portal("choose_image"))
232 return nullptr;
233
234 return Portal::System::Dialog::open_file<std::shared_ptr<Buffers::TextureBuffer>>(
235 [desired_channels, region = std::move(region)](const fs::path& p) {
236 return get_io_manager()->load_image(p.string(), desired_channels, region);
237 },
238 [](Core::SystemDialogError) { },
239 k_image_filters);
240}
std::shared_ptr< IO::IOManager > get_io_manager()
Retrieves the global IOManager instance for file loading and buffer management.
Definition Depot.cpp:575

References get_io_manager().

Referenced by MayaFlux::Creator::read_image().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: