MayaFlux 0.4.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 207 of file Depot.cpp.

210{
211 if (!require_portal("save_image"))
212 return false;
213
214 auto iom = get_io_manager();
215 if (!iom) {
216 MF_ERROR(Journal::Component::API, Journal::Context::Runtime,
217 "save_image: IOManager unavailable");
218 return false;
219 }
220
221 return Portal::System::Dialog::save_file<bool>(
222 [&iom, &buffer](const fs::path& p) {
223 return iom->save_image(buffer, p.string(), IO::ImageWriteOptions {});
224 },
225 [](Core::SystemDialogError) { },
226 suggested_name,
227 k_image_save_filters);
228}
#define MF_ERROR(comp, ctx,...)
std::shared_ptr< IO::IOManager > get_io_manager()
Retrieves the global IOManager instance for file loading and buffer management.
Definition Depot.cpp:256

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

+ Here is the call graph for this function: