2009-04-30 17:00:22 +00:00
|
|
|
/*
|
|
|
|
* Cogl
|
|
|
|
*
|
|
|
|
* An object oriented GL/GLES Abstraction/Utility Layer
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007,2008,2009 Intel Corporation.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2010-03-01 12:56:10 +00:00
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*
|
2009-04-30 17:00:22 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
|
|
|
#error "Only <cogl/cogl.h> can be included directly."
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __COGL_BITMAP_H__
|
|
|
|
#define __COGL_BITMAP_H__
|
|
|
|
|
|
|
|
#include <cogl/cogl-types.h>
|
|
|
|
|
2009-05-06 09:35:28 +00:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2010-05-27 23:51:40 +00:00
|
|
|
typedef struct _CoglBitmap CoglBitmap;
|
|
|
|
|
2009-04-30 17:00:22 +00:00
|
|
|
/**
|
|
|
|
* SECTION:cogl-bitmap
|
2009-11-19 13:29:02 +00:00
|
|
|
* @short_description: Fuctions for loading images
|
2009-04-30 17:00:22 +00:00
|
|
|
*
|
|
|
|
* Cogl allows loading image data into memory as CoglBitmaps without
|
|
|
|
* loading them immediately into GPU textures.
|
2009-11-19 13:29:02 +00:00
|
|
|
*
|
|
|
|
* #CoglBitmap is available since Cogl 1.0
|
2009-04-30 17:00:22 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* cogl_bitmap_new_from_file:
|
|
|
|
* @filename: the file to load.
|
|
|
|
* @error: a #GError or %NULL.
|
|
|
|
*
|
2009-06-10 11:50:45 +00:00
|
|
|
* Loads an image file from disk. This function can be safely called from
|
2009-04-30 17:00:22 +00:00
|
|
|
* within a thread.
|
|
|
|
*
|
2010-05-27 23:51:40 +00:00
|
|
|
* Return value: a #CoglBitmap to the new loaded image data, or
|
|
|
|
* %NULL if loading the image failed.
|
2009-04-30 17:00:22 +00:00
|
|
|
*
|
|
|
|
* Since: 1.0
|
|
|
|
*/
|
2010-05-27 23:51:40 +00:00
|
|
|
CoglBitmap *
|
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.
There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.
The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:
return_type
cogl_function_name (CoglType arg0,
CoglType arg1);
Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.
The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.
The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.
The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-10 01:57:32 +00:00
|
|
|
cogl_bitmap_new_from_file (const char *filename,
|
|
|
|
GError **error);
|
2009-04-30 17:00:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* cogl_bitmap_get_size_from_file:
|
|
|
|
* @filename: the file to check
|
2009-11-19 13:29:02 +00:00
|
|
|
* @width: (out): return location for the bitmap width, or %NULL
|
|
|
|
* @height: (out): return location for the bitmap height, or %NULL
|
2009-04-30 17:00:22 +00:00
|
|
|
*
|
|
|
|
* Parses an image file enough to extract the width and height
|
|
|
|
* of the bitmap.
|
|
|
|
*
|
2009-11-19 13:29:02 +00:00
|
|
|
* Return value: %TRUE if the image was successfully parsed
|
2009-06-10 11:50:45 +00:00
|
|
|
*
|
2009-04-30 17:00:22 +00:00
|
|
|
* Since: 1.0
|
|
|
|
*/
|
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.
There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.
The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:
return_type
cogl_function_name (CoglType arg0,
CoglType arg1);
Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.
The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.
The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.
The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-10 01:57:32 +00:00
|
|
|
gboolean
|
|
|
|
cogl_bitmap_get_size_from_file (const char *filename,
|
|
|
|
int *width,
|
|
|
|
int *height);
|
2009-04-30 17:00:22 +00:00
|
|
|
|
2009-11-11 10:32:39 +00:00
|
|
|
/**
|
|
|
|
* cogl_is_bitmap:
|
|
|
|
* @handle: a #CoglHandle for a bitmap
|
|
|
|
*
|
|
|
|
* Checks whether @handle is a #CoglHandle for a bitmap
|
|
|
|
*
|
|
|
|
* Return value: %TRUE if the passed handle represents a bitmap,
|
|
|
|
* and %FALSE otherwise
|
|
|
|
*
|
|
|
|
* Since: 1.0
|
|
|
|
*/
|
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.
There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.
The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:
return_type
cogl_function_name (CoglType arg0,
CoglType arg1);
Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.
The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.
The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.
The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-10 01:57:32 +00:00
|
|
|
gboolean
|
|
|
|
cogl_is_bitmap (CoglHandle handle);
|
2009-11-11 10:32:39 +00:00
|
|
|
|
2010-07-01 20:49:16 +00:00
|
|
|
/**
|
|
|
|
* COGL_BITMAP_ERROR:
|
|
|
|
*
|
|
|
|
* #GError domain for bitmap errors.
|
|
|
|
*
|
|
|
|
* Since: 1.4
|
|
|
|
*/
|
|
|
|
#define COGL_BITMAP_ERROR (cogl_bitmap_error_quark ())
|
|
|
|
|
|
|
|
/**
|
|
|
|
* CoglBitmapError:
|
|
|
|
* @COGL_BITMAP_ERROR_FAILED: Generic failure code, something went
|
|
|
|
* wrong.
|
2010-12-22 09:42:41 +00:00
|
|
|
* @COGL_BITMAP_ERROR_UNKNOWN_TYPE: Unknown image type.
|
|
|
|
* @COGL_BITMAP_ERROR_CORRUPT_IMAGE: An image file was broken somehow.
|
2010-07-01 20:49:16 +00:00
|
|
|
*
|
|
|
|
* Error codes that can be thrown when performing bitmap
|
|
|
|
* operations. Note that gdk_pixbuf_new_from_file() can also throw
|
|
|
|
* errors directly from the underlying image loading library. For
|
|
|
|
* example, if GdkPixbuf is used then errors #GdkPixbufError<!-- -->s
|
|
|
|
* will be used directly.
|
|
|
|
*
|
|
|
|
* Since: 1.4
|
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
COGL_BITMAP_ERROR_FAILED,
|
|
|
|
COGL_BITMAP_ERROR_UNKNOWN_TYPE,
|
|
|
|
COGL_BITMAP_ERROR_CORRUPT_IMAGE
|
|
|
|
} CoglBitmapError;
|
|
|
|
|
|
|
|
GQuark cogl_bitmap_error_quark (void);
|
|
|
|
|
2009-04-30 17:00:22 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __COGL_BITMAP_H__ */
|