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

◆ save_image() [2/2]

MAYAFLUX_API bool MayaFlux::save_image ( const std::shared_ptr< Buffers::TextureBuffer > &  buffer,
const std::string &  suggested_name = "output.png" 
)

Present a native save-file dialog filtered to image formats and save buffer to the chosen path via IOManager::save_image().

Blocks until the user confirms or cancels. The encode task is queued asynchronously. Returns false on cancellation, backend error, or if Portal::System is not initialized.

Parameters
bufferSource TextureBuffer to encode.
suggested_nameFilename pre-filled in the dialog name field.

Definition at line 371 of file Depot.cpp.

374{
375 if (!require_portal("save_image"))
376 return false;
377
378 auto iom = get_io_manager();
379 if (!iom) {
380 MF_ERROR(Journal::Component::API, Journal::Context::Runtime,
381 "save_image: IOManager unavailable");
382 return false;
383 }
384
385 return Portal::System::Dialog::save_file<bool>(
386 [&iom, &buffer](const fs::path& p) {
387 return iom->save_image(buffer, p.string(), IO::ImageWriteOptions {});
388 },
389 [](Core::SystemDialogError) { },
390 suggested_name,
391 k_image_save_filters);
392}
#define MF_ERROR(comp, ctx,...)
std::shared_ptr< NetworkGeometryBuffer > buffer
std::shared_ptr< IO::IOManager > get_io_manager()
Retrieves the global IOManager instance for file loading and buffer management.
Definition Depot.cpp:575

References MayaFlux::Journal::API, buffer, get_io_manager(), MF_ERROR, and MayaFlux::Journal::Runtime.

+ Here is the call graph for this function: