## gegl-buffer-iterator

gegl-buffer-iterator

## Functions

GeglBufferIterator * | gegl_buffer_iterator_empty_new ()
GeglBufferIterator * | gegl_buffer_iterator_new ()
gint | gegl_buffer_iterator_add ()
void | gegl_buffer_iterator_stop ()
gboolean | gegl_buffer_iterator_next ()

## Types and Values

#define | GEGL_BUFFER_READ
#define | GEGL_BUFFER_WRITE
#define | GEGL_BUFFER_READWRITE
| GeglBufferIteratorPriv

## Description

## Functions

### gegl_buffer_iterator_empty_new ()

    GeglBufferIterator *
    gegl_buffer_iterator_empty_new (int max_slots);

#### Returns

a new buffer iterator.

### gegl_buffer_iterator_new ()

    GeglBufferIterator *
    gegl_buffer_iterator_new (GeglBuffer *buffer,
                              const GeglRectangle *roi,
                              gint level,
                              const Babl *format,
                              GeglAccessMode access_mode,
                              GeglAbyssPolicy abyss_policy,
                              gint max_slots);

Create a new buffer iterator, this buffer will be iterated through in linear chunks, some chunks might be full tiles the coordinates, see the documentation of gegl_buffer_iterator_next for how to use it and destroy it.

[skip]

#### Parameters

buffer | a GeglBuffer |
roi | the rectangle to iterate over |
level | the level at which we are iterating, the roi will indicate the extent at 1:1, x,y,width and height are/(2^level) |
format | the format we want to process this buffers data in, pass 0 to use the buffers format. |
access_mode | whether we need reading or writing to this buffer one of GEGL_BUFFER_READ, GEGL_BUFFER_WRITE and GEGL_BUFFER_READWRITE. |
abyss_policy | how request outside the buffer extent are handled. |

#### Returns

a new buffer iterator that can be used to iterate through the buffers pixels.

### gegl_buffer_iterator_add ()

    gint
    gegl_buffer_iterator_add (GeglBufferIterator *iterator,
                              GeglBuffer *buffer,
                              const GeglRectangle *roi,
                              gint level,
                              const Babl *format,
                              GeglAccessMode access_mode,
                              GeglAbyssPolicy abyss_policy);

Adds an additional buffer iterator that will be processed in sync with the original one, if the buffer doesn't align with the other for tile access the corresponding scans and regions will be serialized automatically using gegl_buffer_get.

If the buffer shares its tiles with a previously-added buffer (in particular, if the same buffer is added more than once), and at least one of the buffers is accessed for writing, the corresponding iterated-over areas should either completely overlap, or not overlap at all, in the coordinate- system of the underlying tile storage (that is, after shifting each area by the corresponding buffer's shift-x and shift-y properties). If the areas overlap, at most one of the buffers may be accessed for writing, and the data pointers of the corresponding iterator items may refer to the same data.

[skip]

#### Parameters

iterator | a GeglBufferIterator |
buffer | a GeglBuffer |
roi | the rectangle to iterate over |
level | the level at which we are iterating, the roi will indicate the extent at 1:1, x,y,width and height are/(2^level) |
format | the format we want to process this buffers data in, pass 0 to use the buffers format. |
access_mode | whether we need reading or writing to this buffer. |
abyss_policy | how request outside the buffer extent are handled. |

#### Returns

an integer handle refering to the indice in the iterator structure of the added buffer.

### gegl_buffer_iterator_stop ()

    void
    gegl_buffer_iterator_stop (GeglBufferIterator *iterator);

Cancels the current iteration, freeing up any temporary resources. The iterator handle is no longer valid after invoking this function.

[skip]

#### Parameters

iterator | a GeglBufferIterator |

### gegl_buffer_iterator_next ()

    gboolean
    gegl_buffer_iterator_next (GeglBufferIterator *iterator);

Do an iteration, this causes a new set of iterator->data[] to become available if there is more data to process. Changed data from a previous iteration step will also be saved now. When there is no more data to be processed FALSE will be returned (and the iterator handle is no longer valid).

[skip]

#### Parameters

iterator | a GeglBufferIterator |

#### Returns

TRUE if there is more work FALSE if iteration is complete.

## Types and Values

### GEGL_BUFFER_READ

    #define GEGL_BUFFER_READ      GEGL_ACCESS_READ

### GEGL_BUFFER_WRITE

    #define GEGL_BUFFER_WRITE     GEGL_ACCESS_WRITE

### GEGL_BUFFER_READWRITE

    #define GEGL_BUFFER_READWRITE GEGL_ACCESS_READWRITE

### GeglBufferIteratorPriv

    typedef struct _GeglBufferIteratorPriv GeglBufferIteratorPriv;