"Initial commit to Gerrit"
[profile/ivi/cogl.git] / cogl / cogl-offscreen.h
1 /*
2  * Cogl
3  *
4  * An object oriented GL/GLES Abstraction/Utility Layer
5  *
6  * Copyright (C) 2007,2008,2009,2012 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
24 #if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
25 #error "Only <cogl/cogl.h> can be included directly."
26 #endif
27
28 #ifndef __COGL_OFFSCREEN_H__
29 #define __COGL_OFFSCREEN_H__
30
31 #include <cogl/cogl-types.h>
32 #include <cogl/cogl-texture.h>
33
34 G_BEGIN_DECLS
35
36 /**
37  * SECTION:cogl-offscreen
38  * @short_description: Fuctions for creating and manipulating offscreen
39  *                     framebuffers.
40  *
41  * Cogl allows creating and operating on offscreen framebuffers.
42  */
43
44 typedef struct _CoglOffscreen CoglOffscreen;
45
46 #define COGL_OFFSCREEN(X) ((CoglOffscreen *)X)
47
48 /* Offscreen api */
49
50 /**
51  * cogl_offscreen_new_to_texture:
52  * @texture: A #CoglTexture pointer
53  *
54  * This creates an offscreen buffer object using the given @texture as the
55  * primary color buffer. It doesn't just initialize the contents of the
56  * offscreen buffer with the @texture; they are tightly bound so that
57  * drawing to the offscreen buffer effectivly updates the contents of the
58  * given texture. You don't need to destroy the offscreen buffer before
59  * you can use the @texture again.
60  *
61  * <note>This only works with low-level #CoglTexture types such as
62  * #CoglTexture2D, #CoglTexture3D and #CoglTextureRectangle, and not
63  * with meta-texture types such as #CoglTexture2DSliced.</note>
64  *
65  * Return value: (transfer full): a newly instantiated #CoglOffscreen
66  *   framebuffer or %NULL if it wasn't possible to create the
67  *   buffer.
68  */
69 CoglOffscreen *
70 cogl_offscreen_new_to_texture (CoglTexture *texture);
71
72 /**
73  * cogl_is_offscreen:
74  * @object: A pointer to a #CoglObject
75  *
76  * Determines whether the given #CoglObject references an offscreen
77  * framebuffer object.
78  *
79  * Returns: %TRUE if @object is a #CoglOffscreen framebuffer,
80  *          %FALSE otherwise
81  */
82 gboolean
83 cogl_is_offscreen (void *object);
84
85 #ifndef COGL_DISABLE_DEPRECATED
86
87 /**
88  * cogl_offscreen_ref:
89  * @offscreen: A pointer to a #CoglOffscreen framebuffer
90  *
91  * Increments the reference count on the @offscreen framebuffer.
92  *
93  * Return value: (transfer none): For convenience it returns the
94  *                                given @offscreen
95  *
96  * Deprecated: 1.2: cogl_object_ref() should be used in new code.
97  */
98 void *
99 cogl_offscreen_ref (void *offscreen) G_GNUC_DEPRECATED;
100
101 /**
102  * cogl_offscreen_unref:
103  * @offscreen: A pointer to a #CoglOffscreen framebuffer
104  *
105  * Decreases the reference count for the @offscreen buffer and frees it when
106  * the count reaches 0.
107  *
108  * Deprecated: 1.2: cogl_object_unref() should be used in new code.
109  */
110 void
111 cogl_offscreen_unref (void *offscreen) G_GNUC_DEPRECATED;
112
113 #endif /* COGL_DISABLE_DEPRECATED */
114
115 G_END_DECLS
116
117 #endif /* __COGL_OFFSCREEN_H__ */