"Initial commit to Gerrit"
[profile/ivi/cogl.git] / cogl / cogl-atlas-texture-private.h
1 /*
2  * Cogl
3  *
4  * An object oriented GL/GLES Abstraction/Utility Layer
5  *
6  * Copyright (C) 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
24 #ifndef __COGL_ATLAS_TEXTURE_H
25 #define __COGL_ATLAS_TEXTURE_H
26
27 #include "cogl-handle.h"
28 #include "cogl-texture-private.h"
29 #include "cogl-rectangle-map.h"
30 #include "cogl-atlas.h"
31
32 #define COGL_ATLAS_TEXTURE(tex) ((CoglAtlasTexture *) tex)
33
34 typedef struct _CoglAtlasTexture CoglAtlasTexture;
35
36 struct _CoglAtlasTexture
37 {
38   CoglTexture           _parent;
39
40   /* The format that the texture is in. This isn't necessarily the
41      same format as the atlas texture because we can store
42      pre-multiplied and non-pre-multiplied textures together */
43   CoglPixelFormat       format;
44
45   /* The rectangle that was used to add this texture to the
46      atlas. This includes the 1-pixel border */
47   CoglRectangleMapEntry rectangle;
48
49   /* The atlas that this texture is in. If the texture is no longer in
50      an atlas then this will be NULL. A reference is taken on the
51      atlas by the texture (but not vice versa so there is no cycle) */
52   CoglAtlas            *atlas;
53
54   /* A CoglSubTexture representing the region for easy rendering */
55   CoglHandle            sub_texture;
56 };
57
58 CoglHandle
59 _cogl_atlas_texture_new_from_bitmap (CoglBitmap      *bmp,
60                                      CoglTextureFlags flags,
61                                      CoglPixelFormat  internal_format);
62
63 CoglHandle
64 _cogl_atlas_texture_new_with_size (unsigned int     width,
65                                    unsigned int     height,
66                                    CoglTextureFlags flags,
67                                    CoglPixelFormat  internal_format);
68
69 void
70 _cogl_atlas_texture_add_reorganize_callback (GHookFunc callback,
71                                              void *user_data);
72
73 void
74 _cogl_atlas_texture_remove_reorganize_callback (GHookFunc callback,
75                                                 void *user_data);
76
77 gboolean
78 _cogl_is_atlas_texture (void *object);
79
80 #endif /* __COGL_ATLAS_TEXTURE_H */