GnomeScanPlugin

## GnomeScanPlugin GnomeScanPlugin — Scan operation plugin |

## Synopsis

    #include <gnome-scan.h>

                        GnomeScanPlugin;
    void                gnome_scan_plugin_params_add        (GnomeScanPlugin *plugin,
                                                             GParamSpec *param);
    void                gnome_scan_plugin_params_remove     (GnomeScanPlugin *plugin,
                                                             GParamSpec *param);
    void                gnome_scan_plugin_params_clear      (GnomeScanPlugin *plugin);
    void                gnome_scan_plugin_params_changed    (GnomeScanPlugin *plugin,
                                                             GParamSpec *spec);
    void                gnome_scan_plugin_configure         (GnomeScanPlugin *plugin,
                                                             GnomeScanSettings *settings);
    void                gnome_scan_plugin_configure_frame   (GnomeScanPlugin *plugin);
    gboolean            gnome_scan_plugin_start_frame       (GnomeScanPlugin *plugin);
    gboolean            gnome_scan_plugin_work              (GnomeScanPlugin *plugin,
                                                             gdouble *progress);
    void                gnome_scan_plugin_end_frame         (GnomeScanPlugin *plugin);
    void                gnome_scan_plugin_end_scan          (GnomeScanPlugin *plugin);
    GList*              gnome_scan_plugin_get_child_nodes   (GnomeScanPlugin *plugin,
                                                             GeglNode *root);

## Object Hierarchy

      GObject
       +----GnomeScanPlugin
             +----GnomeScanner
             +----GnomeScanSink
             +----GnomeScanProcessorCommon

## Properties

      "blurb"                    gchararray            : Read / Write / Construct Only
      "name"                     gchararray            : Read / Write / Construct Only
      "params"                   gpointer              : Read

## Signals

      "params-changed"                                 : Run First

## Description

A GnomeScanPlugin extends the processing pipeline. Only processing plugin derive directly GnomeScanPlugin. Source and Sink must derive from GnomeScanner and GnomeScanSink. Basically, a plugin handle common properties such as `name`, `blurb` and `params`. Each plugins as a per instance list of params. Those params are exposed to the UI and save in GnomeScanSettings.

## Details

### GnomeScanPlugin

    typedef struct {
      GParamSpecPool	*params;
    } GnomeScanPlugin;

GnomeScanPlugin is the base class for GnomeScanner and GnomeScanSink. The `buffer` property is considered as the output of a GnomeScanner, and the input of a GnomeScanSink.

GParamSpecPool *`params`; | the pool of params

### gnome_scan_plugin_params_add ()

    void                gnome_scan_plugin_params_add        (GnomeScanPlugin *plugin,
                                                             GParamSpec *param);

See: `gnome`-scan-param-specs

`plugin` : | a GnomeScanPlugin
`param` : | a GSParamSpec

### gnome_scan_plugin_params_remove ()

    void                gnome_scan_plugin_params_remove     (GnomeScanPlugin *plugin,
                                                             GParamSpec *param);

Remove a param spec from the param list.

`plugin` : | a GnomeScanPlugin
`param` : | a GSParamSpec

### gnome_scan_plugin_params_clear ()

    void                gnome_scan_plugin_params_clear      (GnomeScanPlugin *plugin);

Remove all instance parameters from a plugin.

`plugin` : | a GnomeScanPlugin

### gnome_scan_plugin_params_changed ()

    void                gnome_scan_plugin_params_changed    (GnomeScanPlugin *plugin,
                                                             GParamSpec *spec);

Emit GnomeScanPlugin::changed for `spec` param. For use in derived class.

`plugin` : | a GnomeScanPlugin
`spec` : | a GParamSpec from `plugin`

### gnome_scan_plugin_configure ()

    void                gnome_scan_plugin_configure         (GnomeScanPlugin *plugin,
                                                             GnomeScanSettings *settings);

Note: Implemented by derived class, called by GnomeScanJob.

Search in `settings` value for its instance parameters.

`plugin` : | a GnomeScanPlugin
`settings` : | a GnomeScanPlugin

### gnome_scan_plugin_configure_frame ()

    void                gnome_scan_plugin_configure_frame   (GnomeScanPlugin *plugin);

Note: Implemented by derived class, called by GnomeScanJob.

This is used especially for per frame GEGL pipeline configuration.

`plugin` : | a GnomeScanPlugin

### gnome_scan_plugin_start_frame ()

    gboolean            gnome_scan_plugin_start_frame       (GnomeScanPlugin *plugin);

Note: Implemented by derived class, called by GnomeScanJob.

`plugin` : | a GnomeScanPlugin
Returns : | wether the frame is to be processed or aborted.

### gnome_scan_plugin_work ()

    gboolean            gnome_scan_plugin_work              (GnomeScanPlugin *plugin,
                                                             gdouble *progress);

Note: Implemented by derived class, called by GnomeScanJob.

Do an iteration of plugin work. Store the amount of work done in progress as a fraction, from 0 to 1. progress set to 1 means work completed.

`plugin` : | a GnomeScanPlugin
`progress` : | a pointer to a place where to store progress
Returns : | Wether more work iteration needs to be done.

### gnome_scan_plugin_end_frame ()

    void                gnome_scan_plugin_end_frame         (GnomeScanPlugin *plugin);

Note: Implemented by derived class, called by GnomeScanJob.

`plugin` : | a GnomeScanPlugin

### gnome_scan_plugin_end_scan ()

    void                gnome_scan_plugin_end_scan          (GnomeScanPlugin *plugin);

Note: Implemented by derived class, called by GnomeScanJob.

`plugin` : | a GnomeScanPlugin

### gnome_scan_plugin_get_child_nodes ()

    GList*              gnome_scan_plugin_get_child_nodes   (GnomeScanPlugin *plugin,
                                                             GeglNode *root);

Note: Implemented by derived class, called by GnomeScanJob.

Return the list of GeglNode to append to the pipeline. GnomeScanJob link "input" and "output" pads of sibling nodes, not auxiliary pad.

`plugin` : | a GnomeScanPlugin:
`root` : | a root GeglNode
Returns : | a GList of GeglNode

## Property Details

### The "`blurb`" property

      "blurb"                    gchararray            : Read / Write / Construct Only

The plugin public blurb.

Default value: NULL

### The "`name`" property

      "name"                     gchararray            : Read / Write / Construct Only

The plugin public name.

Default value: NULL

### The "`params`" property

      "params"                   gpointer              : Read

The list of per instance GSParamSpec.

## Signal Details

### The "params-changed" signal

    void                user_function                      (GnomeScanPlugin *plugin,
                                                            gpointer         spec,
                                                            gpointer         user_data)      : Run First

Triggered when one param of plugin has been added, changed, removed. Needs to be renamed to param-changed.

`plugin` : | the emitting GnomeScanPlugin
`spec` : | the spec of the changed parameter
`user_data` : | user data set when the signal handler was connected.