Commit 86fd1396 authored by Øyvind Kolås's avatar Øyvind Kolås

Made the linear buffer access API of GeglBuffer public.

* gegl/buffer/gegl-buffer-linear.h: removed.
* gegl/buffer/Makefile.am: updated.
* gegl/buffer/gegl-buffer-private.h: removed include of
gegl-buffer-linear.h
* gegl/buffer/gegl-buffer.h: moved definitions of linear buffer API
here.
* tests/buffer/buffer-test.c: do not directly include the
gegl-buffer-linear.h header from the GEGL sourcetree anymore.

svn path=/trunk/; revision=2517
parent 04a1e003
2008-07-01 Øyvind Kolås <pippin@gimp.org>
Made the linear buffer access API of GeglBuffer public.
* gegl/buffer/gegl-buffer-linear.h: removed.
* gegl/buffer/Makefile.am: updated.
* gegl/buffer/gegl-buffer-private.h: removed include of
gegl-buffer-linear.h
* gegl/buffer/gegl-buffer.h: moved definitions of linear buffer API
here.
* tests/buffer/buffer-test.c: do not directly include the
gegl-buffer-linear.h header from the GEGL sourcetree anymore.
2008-06-23 Øyvind Kolås <pippin@gimp.org>
Documentation improvements (mostly orthographic) from Peter
......
......@@ -41,7 +41,6 @@ BUFFER_headers = \
gegl-buffer.h \
gegl-buffer-private.h \
gegl-buffer-iterator.h \
gegl-buffer-linear.h \
gegl-buffer-load.h \
gegl-buffer-save.h \
gegl-buffer-types.h \
......
#ifndef __GEGL_BUFFER_LINEAR_H
#define __GEGL_BUFFER_LINEAR_H
/**
* gegl_buffer_linear_new:
* @extent: dimensions of buffer.
* @format: desired pixel format.
*
* Creates a GeglBuffer backed by a linear memory buffer, of the given
* @extent in the specified @format. babl_format ("R'G'B'A u8") for instance
* to make a normal 8bit buffer.
*
* Returns: a GeglBuffer that can be used as any other GeglBuffer.
*/
GeglBuffer *gegl_buffer_linear_new (const GeglRectangle *extent,
const Babl *format);
/**
* gegl_buffer_linear_new_from_data:
* @data: a pointer to a linear buffer in memory.
* @format: the format of the data in memory
* @width: the width of the buffer
* @height: the height of the buffer
* @rowstride: the number of bytes between rowstarts in memory (or 0 to
* autodetect)
* @destory_fn: function to call to free data or NULL if memory should not be
* freed.
* @destroy_fn_data: extra argument to be passed to void destroy(ptr, data) type
* function.
*
* Creates a GeglBuffer backed by a linear memory buffer that already exists,
* of the given @extent in the specified @format. babl_format ("R'G'B'A u8")
* for instance to make a normal 8bit buffer.
*
* Returns: a GeglBuffer that can be used as any other GeglBuffer.
*/
GeglBuffer * gegl_buffer_linear_new_from_data (const gpointer data,
const Babl *format,
const GeglRectangle *extent,
gint rowstride,
GCallback destroy_fn,
gpointer destroy_fn_data);
/**
* gegl_buffer_linear_open:
* @buffer: a #GeglBuffer.
* @roi: region to open, pass NULL for entire buffer.
* @rowstride: return location for rowstride.
* @format: desired format or NULL to use buffers format.
*
* Raw direct random access to the full data of a buffer in linear memory.
*
* Returns: a pointer to a linear memory region describing the buffer, if the
* request is compatible with the underlying data storage direct access
* to the underlying data is provided.
*/
gpointer *gegl_buffer_linear_open (GeglBuffer *buffer,
const GeglRectangle *extent,
gint *rowstride,
const Babl *format);
/**
* gegl_buffer_linear_close:
* @buffer: a #GeglBuffer.
* @linear: a previously returned buffer.
*
* This function makes sure GeglBuffer and underlying code is aware of changes
* being made to the linear buffer. If the request was not a compatible one
* it is written back to the buffer. Multiple concurrent users can be handed
* the same buffer (both raw access and converted).
*/
void gegl_buffer_linear_close (GeglBuffer *buffer,
gpointer linear);
#endif
......@@ -24,7 +24,6 @@
#include "gegl-sampler.h"
#include "gegl-tile-handler.h"
#include "gegl-buffer-iterator.h"
#include "gegl-buffer-linear.h"
#define GEGL_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEGL_TYPE_BUFFER, GeglBufferClass))
#define GEGL_IS_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_BUFFER))
......
......@@ -237,6 +237,15 @@ void gegl_buffer_set (GeglBuffer *buffer,
gint rowstride);
/**
* gegl_buffer_get_format:
* @buffer: a #GeglBuffer
*
* Get the native babl format of the buffer.
*
* Returns: the babl format used for storing pixels in the buffer.
*
*/
const Babl *gegl_buffer_get_format (GeglBuffer *buffer);
/**
......@@ -299,13 +308,12 @@ typedef enum {
* @interpolation: the interpolation behavior to use, currently only nearest
* neighbour is implemented for this API, bilinear, bicubic and lanczos needs
* to be ported from working code. Valid values: GEGL_INTERPOLATION_NEAREST and
* GEGL_INTERPOLATION_LINEAR, CUBIC and LANCZOS will become available for now they
* fall back to linear.
* GEGL_INTERPOLATION_LINEAR, GEGL_INTERPOLATON_CUBIC and
* GEGL_INTERPOLATION_LANCZOS.
*
* Resample the buffer at some given coordinates using a specified format. For
* some operations this might be sufficient, but it might be considered
* prototyping convenience that needs to be optimized away from algorithms
* using it later.
* Query interpolate pixel values at a given coordinate using a specified form
* of interpolation. The samplers used cache for a small neighbourhood of the
* buffer for more efficient access.
*/
void gegl_buffer_sample (GeglBuffer *buffer,
gdouble x,
......@@ -337,6 +345,78 @@ void gegl_buffer_sample_cleanup (GeglBuffer *buffer);
GeglInterpolation gegl_buffer_interpolation_from_string (const gchar *string);
/**
* gegl_buffer_linear_new:
* @extent: dimensions of buffer.
* @format: desired pixel format.
*
* Creates a GeglBuffer backed by a linear memory buffer, of the given
* @extent in the specified @format. babl_format ("R'G'B'A u8") for instance
* to make a normal 8bit buffer.
*
* Returns: a GeglBuffer that can be used as any other GeglBuffer.
*/
GeglBuffer *gegl_buffer_linear_new (const GeglRectangle *extent,
const Babl *format);
/**
* gegl_buffer_linear_new_from_data:
* @data: a pointer to a linear buffer in memory.
* @format: the format of the data in memory
* @extent: the dimensions (and upper left coordinates) of linear buffer.
* @rowstride: the number of bytes between rowstarts in memory (or 0 to
* autodetect)
* @destory_fn: function to call to free data or NULL if memory should not be
* freed.
* @destroy_fn_data: extra argument to be passed to void destroy(ptr, data) type
* function.
*
* Creates a GeglBuffer backed by a linear memory buffer that already exists,
* of the given @extent in the specified @format. babl_format ("R'G'B'A u8")
* for instance to make a normal 8bit buffer.
*
* Returns: a GeglBuffer that can be used as any other GeglBuffer.
*/
GeglBuffer * gegl_buffer_linear_new_from_data (const gpointer data,
const Babl *format,
const GeglRectangle *extent,
gint rowstride,
GCallback destroy_fn,
gpointer destroy_fn_data);
/**
* gegl_buffer_linear_open:
* @buffer: a #GeglBuffer.
* @extent: region to open, pass NULL for entire buffer.
* @rowstride: return location for rowstride.
* @format: desired format or NULL to use buffers format.
*
* Raw direct random access to the full data of a buffer in linear memory.
*
* Returns: a pointer to a linear memory region describing the buffer, if the
* request is compatible with the underlying data storage direct access
* to the underlying data is provided.
*/
gpointer *gegl_buffer_linear_open (GeglBuffer *buffer,
const GeglRectangle *extent,
gint *rowstride,
const Babl *format);
/**
* gegl_buffer_linear_close:
* @buffer: a #GeglBuffer.
* @linear: a previously returned buffer.
*
* This function makes sure GeglBuffer and underlying code is aware of changes
* being made to the linear buffer. If the request was not a compatible one
* it is written back to the buffer. Multiple concurrent users can be handed
* the same buffer (both raw access and converted).
*/
void gegl_buffer_linear_close (GeglBuffer *buffer,
gpointer linear);
/**
*/
#endif
......@@ -13,7 +13,6 @@
*/
#include "../../gegl/buffer/gegl-buffer-iterator.h"
#include "../../gegl/buffer/gegl-buffer-linear.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment