Gimp.ExtractVectorFunc

@accepts(Gimp.Procedure, Gimp.RunMode, Gio.File, Gimp.Metadata, Gimp.ProcedureConfig, Gimp.VectorLoadData, gpointer, GLib.DestroyNotify, gpointer)
@returns(bool)
def on_ExtractVectorFunc(procedure, run_mode, file, metadata, config, extracted_data, data_for_run, data_for_run_destroy, extract_data):
  

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 None. [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 None 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.

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.

extract_data

the extract_data given in [ctor@VectorLoadProcedure.new].

Returns

True if any information could be extracted from file.