4
* An object oriented GL/GLES Abstraction/Utility Layer
6
* Copyright (C) 2008,2009 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
* Robert Bragg <robert@linux.intel.com>
27
#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
28
#error "Only <cogl/cogl.h> can be included directly."
31
#ifndef __COGL_PIXEL_BUFFER_H__
32
#define __COGL_PIXEL_BUFFER_H__
35
#include <cogl/cogl-types.h>
40
* cogl_pixel_buffer_new:
41
* @size: size of the buffer in bytes
43
* Creates a new buffer to store pixel data. You can create a new texture from
44
* this buffer using cogl_texture_new_from_buffer().
46
* Return value: a #CoglHandle representing the newly created buffer or
47
* %COGL_INVALID_HANDLE on failure
53
cogl_pixel_buffer_new (unsigned int size);
56
* cogl_pixel_buffer_new_for_size:
57
* @width: width of the pixel buffer in pixels
58
* @height: height of the pixel buffer in pixels
59
* @format: the format of the pixels the buffer will store
60
* @stride: if not %NULL the function will return the stride of the buffer
63
* Creates a new buffer to store pixel data.
65
* <note>COGL will try its best to provide a hardware buffer you can map,
66
* write into and effectively do a zero copy upload when creating a texture
67
* from it with cogl_texture_new_from_buffer(). For various reasons, such
68
* buffers are likely to have a stride larger than width * bytes_per_pixel. The
69
* user must take the stride into account when writing into it.</note>
71
* Return value: a #CoglHandle representing the newly created buffer or
72
* %COGL_INVALID_HANDLE on failure
78
cogl_pixel_buffer_new_for_size (unsigned int width,
80
CoglPixelFormat format,
81
unsigned int *stride);
84
* cogl_is_pixel_buffer:
85
* @handle: a #CoglHandle to test
87
* Checks whether @handle is a pixel buffer.
89
* Return value: %TRUE if the @handle is a pixel buffer, and %FALSE
96
cogl_is_pixel_buffer (CoglHandle handle);
100
* cogl_pixel_buffer_set_region:
101
* @buffer: the #CoglHandle of a pixel buffer
102
* @data: pixel data to upload to @buffer
103
* @src_width: width in pixels of the region to update
104
* @src_height: height in pixels of the region to update
105
* @src_rowstride: row stride in bytes of the source buffer
106
* @dst_x: upper left destination horizontal coordinate
107
* @dst_y: upper left destination vertical coordinate
109
* Uploads new data into a pixel buffer. The source data pointed by @data can
110
* have a different stride than @buffer in which case the function will do the
111
* right thing for you. For performance reasons, it is recommended for the
112
* source data to have the same stride than @buffer.
114
* Return value: %TRUE if the upload succeeded, %FALSE otherwise
117
* Stability: Unstable
120
cogl_pixel_buffer_set_region (CoglHandle buffer,
122
unsigned int src_width,
123
unsigned int src_height,
124
unsigned int src_rowstride,
129
/* the functions above are experimental, the actual symbols are suffixed by
130
* _EXP so we can ensure ABI compatibility and leave the cogl_buffer namespace
131
* free for future use. A bunch of defines translates the symbols documented
132
* above into the real symbols */
135
cogl_pixel_buffer_new_EXP (unsigned int size);
138
cogl_pixel_buffer_new_for_size_EXP (unsigned int width,
140
CoglPixelFormat format,
141
unsigned int *stride);
143
cogl_is_pixel_buffer_EXP (CoglHandle handle);
147
cogl_pixel_buffer_set_region_EXP (CoglHandle buffer,
149
unsigned int src_width,
150
unsigned int src_height,
151
unsigned int src_rowstride,
156
#define cogl_pixel_buffer_new cogl_pixel_buffer_new_EXP
157
#define cogl_pixel_buffer_new_for_size cogl_pixel_buffer_new_for_size_EXP
158
#define cogl_is_pixel_buffer cogl_is_pixel_buffer_EXP
160
#define cogl_pixel_buffer_set_region cogl_pixel_buffer_set_region_EXP
165
#endif /* __COGL_PIXEL_BUFFER_H__ */