4 * An object oriented GL/GLES Abstraction/Utility Layer
6 * Copyright (C) 2008,2009,2010 Intel Corporation.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
24 * Damien Lespiau <damien.lespiau@intel.com>
25 * Robert Bragg <robert@linux.intel.com>
28 #if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
29 #error "Only <cogl/cogl.h> can be included directly."
32 #ifndef __COGL_PIXEL_BUFFER_H__
33 #define __COGL_PIXEL_BUFFER_H__
36 #include <cogl/cogl-types.h>
37 #include <cogl/cogl-context.h>
41 /* All of the cogl-pixel-buffer API is currently experimental so we
42 * suffix the actual symbols with _EXP so if somone is monitoring for
43 * ABI changes it will hopefully be clearer to them what's going on if
44 * any of the symbols dissapear at a later date.
47 #define COGL_PIXEL_BUFFER(buffer) ((CoglPixelBuffer *)(buffer))
49 #define cogl_pixel_buffer_new cogl_pixel_buffer_new_EXP
50 #define cogl_pixel_buffer_new_with_size cogl_pixel_buffer_new_with_size_EXP
51 #define cogl_is_pixel_buffer cogl_is_pixel_buffer_EXP
53 #define cogl_pixel_buffer_set_region cogl_pixel_buffer_set_region_EXP
56 typedef struct _CoglPixelBuffer CoglPixelBuffer;
59 * cogl_pixel_buffer_new:
60 * @context: A #CoglContext
61 * @size: The number of bytes to allocate for the pixel data.
62 * @data: An optional pointer to vertex data to upload immediately
64 * Declares a new #CoglPixelBuffer of @size bytes to contain arrays of
65 * pixels. Once declared, data can be set using cogl_buffer_set_data()
66 * or by mapping it into the application's address space using
69 * If @data isn't %NULL then @size bytes will be read from @data and
70 * immediately copied into the new buffer.
76 cogl_pixel_buffer_new (CoglContext *context,
81 * cogl_is_pixel_buffer:
82 * @object: a #CoglObject to test
84 * Checks whether @handle is a pixel array.
86 * Return value: %TRUE if the @handle is a pixel array, and %FALSE
93 cogl_is_pixel_buffer (void *object);
97 * cogl_pixel_buffer_set_region:
98 * @array: the #CoglHandle of a pixel array
99 * @data: pixel data to upload to @array
100 * @src_width: width in pixels of the region to update
101 * @src_height: height in pixels of the region to update
102 * @src_rowstride: row stride in bytes of the source array
103 * @dst_x: upper left destination horizontal coordinate
104 * @dst_y: upper left destination vertical coordinate
106 * Uploads new data into a pixel array. The source data pointed by @data can
107 * have a different stride than @array in which case the function will do the
108 * right thing for you. For performance reasons, it is recommended for the
109 * source data to have the same stride than @array.
111 * Return value: %TRUE if the upload succeeded, %FALSE otherwise
114 * Stability: Unstable
117 cogl_pixel_buffer_set_region (CoglHandle array,
119 unsigned int src_width,
120 unsigned int src_height,
121 unsigned int src_rowstride,
128 #endif /* __COGL_PIXEL_BUFFER_H__ */