Gimp.ExtractVectorFunc
function onExtractVectorFunc(procedure: Gimp.Procedure, run_mode: Gimp.RunMode, file: Gio.File, metadata: Gimp.Metadata, config: Gimp.ProcedureConfig): [ok: Boolean, extracted_data: Gimp.VectorLoadData, data_for_run: void, data_for_run_destroy: GLib.DestroyNotify] {
}
Loading a vector image happens in 2 steps:
1. this function is first run to determine which size should be actually requested. 2. [callback@RunVectorLoadFunc] is called with the suggested @width and @height.
This function is run during the lifetime of the GIMP session, as the first step above. It should extract the maximum of information from the source document to help GIMP take appropriate decisions for default values and also for displaying relevant information in the load dialog (if necessary).
The best case scenario is to be able to extract proper dimensions (@width and @height) with valid units supported by GIMP. If not possible, returning already processed dimensions then setting @exact_width and @exact_height to false in extracted_data is also an option. If all you can get are no-unit dimensions, set them with Gimp.UnitID.pixel and %correct_ratio to true to at least give a valid ratio as a default.
If there is no way to extract any valid default dimensions, not even a ratio, then return false but leave %error as null. [callback@RunVectorLoadFunc] will still be called but default values might be bogus. If the return value is false and %error is set, it means that the file is invalid and cannot even be loaded. Thus [callback@RunVectorLoadFunc] won't be run and %error is passed as the main run error.
Note: when procedure is run, the original arguments will be passed as config. Nevertheless it may happen that this function is called with a null config, in particular when [method@VectorLoadProcedure.extract_dimensions] is called. In such a case, the callback is expected to return whatever can be considered "best judgement" defaults.
Since 3.0
- procedure
the [class@Gimp.Procedure].
- run_mode
the [enum@RunMode].
- file
the [iface@Gio.File] to load from.
- metadata
the [class@Gimp.Metadata] which will be added to the new image.
- config
the procedure's remaining arguments.
- ok
true if any information could be extracted from file.
- extracted_data
dimensions and pixel density extracted from file.
- data_for_run
will be passed as @data_from_extract in [callback@RunVectorLoadFunc].
- data_for_run_destroy
the free function for data_for_run.