~oem-solutions-group/unity-2d/clutter-1.0

« back to all changes in this revision

Viewing changes to clutter/cogl/cogl/cogl-pixel-buffer.h

  • Committer: Bazaar Package Importer
  • Author(s): Emilio Pozuelo Monfort
  • Date: 2010-03-21 13:27:56 UTC
  • mto: (2.1.3 experimental)
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20100321132756-nf8yd30yxo3zzwcm
Tags: upstream-1.2.2
ImportĀ upstreamĀ versionĀ 1.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Cogl
 
3
 *
 
4
 * An object oriented GL/GLES Abstraction/Utility Layer
 
5
 *
 
6
 * Copyright (C) 2008,2009 Intel Corporation.
 
7
 *
 
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.
 
12
 *
 
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.
 
17
 *
 
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/>.
 
20
 *
 
21
 *
 
22
 *
 
23
 * Authors:
 
24
 *   Robert Bragg <robert@linux.intel.com>
 
25
 */
 
26
 
 
27
#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
 
28
#error "Only <cogl/cogl.h> can be included directly."
 
29
#endif
 
30
 
 
31
#ifndef __COGL_PIXEL_BUFFER_H__
 
32
#define __COGL_PIXEL_BUFFER_H__
 
33
 
 
34
#include <glib.h>
 
35
#include <cogl/cogl-types.h>
 
36
 
 
37
G_BEGIN_DECLS
 
38
 
 
39
/**
 
40
 * cogl_pixel_buffer_new:
 
41
 * @size: size of the buffer in bytes
 
42
 *
 
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().
 
45
 *
 
46
 * Return value: a #CoglHandle representing the newly created buffer or
 
47
 *               %COGL_INVALID_HANDLE on failure
 
48
 *
 
49
 * Since: 1.2
 
50
 * Stability: Unstable
 
51
 */
 
52
CoglHandle
 
53
cogl_pixel_buffer_new (unsigned int size);
 
54
 
 
55
/**
 
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
 
61
 *          in bytes
 
62
 *
 
63
 * Creates a new buffer to store pixel data.
 
64
 *
 
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>
 
70
 *
 
71
 * Return value: a #CoglHandle representing the newly created buffer or
 
72
 *               %COGL_INVALID_HANDLE on failure
 
73
 *
 
74
 * Since: 1.2
 
75
 * Stability: Unstable
 
76
 */
 
77
CoglHandle
 
78
cogl_pixel_buffer_new_for_size (unsigned int     width,
 
79
                                unsigned int     height,
 
80
                                CoglPixelFormat  format,
 
81
                                unsigned int    *stride);
 
82
 
 
83
/**
 
84
 * cogl_is_pixel_buffer:
 
85
 * @handle: a #CoglHandle to test
 
86
 *
 
87
 * Checks whether @handle is a pixel buffer.
 
88
 *
 
89
 * Return value: %TRUE if the @handle is a pixel buffer, and %FALSE
 
90
 *   otherwise
 
91
 *
 
92
 * Since: 1.2
 
93
 * Stability: Unstable
 
94
 */
 
95
gboolean
 
96
cogl_is_pixel_buffer (CoglHandle handle);
 
97
 
 
98
#if 0
 
99
/*
 
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
 
108
 *
 
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.
 
113
 *
 
114
 * Return value: %TRUE if the upload succeeded, %FALSE otherwise
 
115
 *
 
116
 * Since: 1.2
 
117
 * Stability: Unstable
 
118
 */
 
119
gboolean
 
120
cogl_pixel_buffer_set_region (CoglHandle    buffer,
 
121
                              guint8       *data,
 
122
                              unsigned int  src_width,
 
123
                              unsigned int  src_height,
 
124
                              unsigned int  src_rowstride,
 
125
                              unsigned int  dst_x,
 
126
                              unsigned int  dst_y);
 
127
#endif
 
128
 
 
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 */
 
133
 
 
134
CoglHandle
 
135
cogl_pixel_buffer_new_EXP (unsigned int size);
 
136
 
 
137
CoglHandle
 
138
cogl_pixel_buffer_new_for_size_EXP (unsigned int    width,
 
139
                                    unsigned int    height,
 
140
                                    CoglPixelFormat format,
 
141
                                    unsigned int   *stride);
 
142
gboolean
 
143
cogl_is_pixel_buffer_EXP (CoglHandle handle);
 
144
 
 
145
#if 0
 
146
gboolean
 
147
cogl_pixel_buffer_set_region_EXP (CoglHandle   buffer,
 
148
                                  guint8      *data,
 
149
                                  unsigned int src_width,
 
150
                                  unsigned int src_height,
 
151
                                  unsigned int src_rowstride,
 
152
                                  unsigned int dst_x,
 
153
                                  unsigned int dst_y);
 
154
#endif
 
155
 
 
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
 
159
#if 0
 
160
#define cogl_pixel_buffer_set_region cogl_pixel_buffer_set_region_EXP
 
161
#endif
 
162
 
 
163
G_END_DECLS
 
164
 
 
165
#endif /* __COGL_PIXEL_BUFFER_H__ */