## Bitmaps Bitmaps — Functions for loading images |

## Synopsis

                        CoglBitmap;
    CoglBitmap *        cogl_bitmap_new_from_file           (const char *filename,
                                                             CoglError **error);
    CoglBool            cogl_bitmap_get_size_from_file      (const char *filename,
                                                             int *width,
                                                             int *height);
    CoglBool            cogl_is_bitmap                      (void *object);
    enum                CoglBitmapError;
    #define             COGL_BITMAP_ERROR

## Description

Cogl allows loading image data into memory as CoglBitmaps without loading them immediately into GPU textures.

CoglBitmap is available since Cogl 1.0

## Details

### CoglBitmap

    typedef struct _CoglBitmap CoglBitmap;

### cogl_bitmap_new_from_file ()

    CoglBitmap *        cogl_bitmap_new_from_file           (const char *filename,
                                                             CoglError **error);

Loads an image file from disk. This function can be safely called from within a thread.

`filename` : | the file to load.
`error` : | a CoglError or `NULL`.
Returns : | a CoglBitmap to the new loaded image data, or `NULL` if loading the image failed.

Since 1.0

### cogl_bitmap_get_size_from_file ()

    CoglBool            cogl_bitmap_get_size_from_file      (const char *filename,
                                                             int *width,
                                                             int *height);

Parses an image file enough to extract the width and height of the bitmap.

`filename` : | the file to check
`width` : | return location for the bitmap width, or `NULL`. [out]
`height` : | return location for the bitmap height, or `NULL`. [out]
Returns : | `TRUE` if the image was successfully parsed

Since 1.0

### cogl_is_bitmap ()

    CoglBool            cogl_is_bitmap                      (void *object);

Checks whether `object` is a CoglBitmap

`object` : | a CoglObject pointer
Returns : | `TRUE` if the passed `object` represents a bitmap, and `FALSE` otherwise

Since 1.0

### enum CoglBitmapError

    typedef enum {
      COGL_BITMAP_ERROR_FAILED,
      COGL_BITMAP_ERROR_UNKNOWN_TYPE,
      COGL_BITMAP_ERROR_CORRUPT_IMAGE
    } CoglBitmapError;

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 GdkPixbufErrors will be used directly.

`COGL_BITMAP_ERROR_FAILED` | Generic failure code, something went wrong.
`COGL_BITMAP_ERROR_UNKNOWN_TYPE` | Unknown image type.
`COGL_BITMAP_ERROR_CORRUPT_IMAGE` | An image file was broken somehow.

Since 1.4

### COGL_BITMAP_ERROR

    #define COGL_BITMAP_ERROR (cogl_bitmap_error_quark ())

CoglError domain for bitmap errors.

Since 1.4