4 * An object oriented GL/GLES Abstraction/Utility Layer
6 * Copyright (C) 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, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
24 * Neil Roberts <neil@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_SUB_TEXTURE_H
32 #define __COGL_SUB_TEXTURE_H
39 * SECTION:cogl-sub-texture
40 * @short_description: Functions for creating and manipulating
43 * These functions allow high-level textures to be created that
44 * represent a sub-region of another texture. For example these
45 * can be used to implement custom texture atlasing schemes.
49 #define COGL_SUB_TEXTURE(tex) ((CoglSubTexture *) tex)
50 typedef struct _CoglSubTexture CoglSubTexture;
52 #define cogl_sub_texture_new cogl_sub_texture_new_EXP
54 * cogl_sub_texture_new:
55 * @context: A #CoglContext pointer
56 * @parent_texture: The full texture containing a sub-region you want
57 * to make a #CoglSubTexture from.
58 * @sub_x: The top-left x coordinate of the parent region to make
60 * @sub_y: The top-left y coordinate of the parent region to make
62 * @sub_width: The width of the parent region to make a texture from.
63 * @sub_height: The height of the parent region to make a texture
66 * Creates a high-level #CoglSubTexture representing a sub-region of
67 * any other #CoglTexture. The sub-region must strictly lye within the
68 * bounds of the @parent_texture. The returned texture implements the
69 * #CoglMetaTexture interface because it's not a low level texture
70 * that hardware can understand natively.
72 * <note>Remember: Unless you are using high level drawing APIs such
73 * as cogl_rectangle() or other APIs documented to understand the
74 * #CoglMetaTexture interface then you need to use the
75 * #CoglMetaTexture interface to resolve a #CoglSubTexture into a
76 * low-level texture before drawing.</note>
78 * Returns: A newly allocated #CoglSubTexture representing a
79 * sub-region of @parent_texture.
85 cogl_sub_texture_new (CoglContext *ctx,
86 CoglTexture *parent_texture,
93 * cogl_sub_texture_get_parent:
94 * @sub_texture: A pointer to a #CoglSubTexture
96 * Retrieves the parent texture that @sub_texture derives its content
97 * from. This is the texture that was passed to
98 * cogl_sub_texture_new() as the parent_texture argument.
100 * Return value: (transfer none): The parent texture that @sub_texture
101 * derives its content from.
103 * Stability: unstable
106 cogl_sub_texture_get_parent (CoglSubTexture *sub_texture);
108 #define cogl_is_sub_texture cogl_is_sub_texture_EXP
110 * cogl_is_sub_texture:
111 * @object: a #CoglObject
113 * Checks whether @object is a #CoglSubTexture.
115 * Return value: %TRUE if the passed @object represents a
116 * #CoglSubTexture and %FALSE otherwise.
119 * Stability: unstable
122 cogl_is_sub_texture (void *object);
126 #endif /* __COGL_SUB_TEXTURE_H */