Gimp.ExtractVectorFunc
Description: Reference for Gimp.ExtractVectorFunc

### Function

# GimpExtractVectorFunc

since: 3.0

#### Declaration

    gboolean
    (* GimpExtractVectorFunc) (
      GimpProcedure* procedure,
      GimpRunMode run_mode,
      GFile* file,
      GimpMetadata* metadata,
      GimpProcedureConfig* config,
      GimpVectorLoadData* extracted_data,
      gpointer* data_for_run,
      GDestroyNotify* data_for_run_destroy,
      gpointer extract_data,
      GError** error
    )

#### Description [src]

Loading a vector image happens in 2 steps:

1. this function is first run to determine which size should be actually requested.
2. `GimpRunVectorLoadFunc` 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_UNIT_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`. `GimpRunVectorLoadFunc` 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 `GimpRunVectorLoadFunc` 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 `gimp_vector_load_procedure_extract_dimensions()` is called. In such a case, the callback is expected to return whatever can be considered “best judgement” defaults.

Available since: 3.0

#### Parameters

`procedure`

  Type: `GimpProcedure`

  The `GimpProcedure`.

  The data is owned by the caller of the function.

`run_mode`

  Type: `GimpRunMode`

  The `GimpRunMode`.

`file`

  Type: `GFile`

  The `GFile` to load from.

  The data is owned by the caller of the function.

`metadata`

  Type: `GimpMetadata`

  The `GimpMetadata` which will be added to the new image.

  The data is owned by the caller of the function.

`config`

  Type: `GimpProcedureConfig`

  The `procedure`‘s remaining arguments.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

`extracted_data`

  Type: `GimpVectorLoadData`

  Dimensions and pixel density extracted from `file`.

  The argument will be set by the function.
  The data is owned by the caller of the function.

`data_for_run`

  Type: `gpointer*`

  Will be passed as `data_from_extract` in `GimpRunVectorLoadFunc`.

  The argument will be set by the function.
  The argument can be set to `NULL` by the function.

`data_for_run_destroy`

  Type: `GDestroyNotify`

  The free function for `data_for_run`.

  The argument will be set by the function.
  The argument can be set to `NULL` by the function.
  The data is owned by the caller of the function.

`extract_data`

  Type: `gpointer`

  The `extract_data` given in `gimp_vector_load_procedure_new()`.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will left initialized to `NULL` by the function if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `gboolean`

`TRUE` if any information could be extracted from `file`.