GEGL Operation API
An API to extend the functionality of GEGL with new image processing primitive, file loaders, export formats or similar.
Each GEGL operation is defined in a .c
file. Operations that do not
rely on external dependencies are bundled into a loadable shared
objects. Operations that depend on external libraries are compiled as
individual, loadable, shared objects. Take a look at
the brightness contrast operation for a
point operation, well sprinkled with comments, as a starting point. Each
operation is a subclass of one of the provided base classes:
- GeglOperation
-
The base operation class, which all the other base classes are derived from, deriving from this is often quite a bit of work and is encouraged only when your operation doesn’t fit into any of the other categories.
- GeglOperationFilter
-
The filter base class sets up the
GeglBuffer
for input and output pads. - GeglOperationPointFilter
-
The point-filter base class is for filters where an output pixel only depends on the color and alpha values of the corresponding input pixel. This allows you to do the processing on linear buffers, in the future versions of GEGL, operations implemented using the point-filter will get speed increases due to more intelligent processing possible in the point filter class.
- GeglOperationAreaFilter
-
The area-filter base class allows defining operations where the output data depends on a neighbourhood with an input window that extends beyond the output window, the information about needed extra pixels in different directions should be set up in the prepare callback for the operation.
- GeglOperationComposer
-
Composer operations are operations that take two inputs named
input
andaux
and write their output to the output padoutput
. - GeglOperationPointComposer
-
A base class for composer functions where the output pixels' values depends only on the values of the single corresponding
input
andaux
pixels. - GeglOperationSource
-
Operations used as render sources or file loaders, the process method receives a
GeglBuffer
to write its output into. - GeglOperationPointRender
-
The point-render base class is a specialized source operation, where the render is done in small piece to lower the need to do copies. It’s dedicated to operation which may be rendered in pieces, like pattern generation.
- GeglOperationSink
-
An operation that consumes a
GeglBuffer
, used for file-writers, display (for the sdl display node). - GeglOperationTemporal
-
Base class for operations that want access to previous frames in a video sequence, it contains API to configure the amounts of frames to store as well as getting a
GeglBuffer
pointing to any of the previously stored frames. - GeglOperationMeta
-
Used for GEGL operations that are implemented as a sub-graph, at the moment these are defined as C files but should in the future be possible to declare as XML instead.
To create your own operations you should start by looking for one that
does approximately what you already need. Copy it to a new .c
source
file, and replace the occurrences of the filename (operation name) in
the source.