---
name: "bitmap_color_depth"
section: "3alleg"
platform: "linux"
package: "liballegro-doc"
version: "2:4.2.2-2.2"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/bitmap_color_depth"
---

# bitmap\_color\_depth(3alleg)

Returns the color depth of the specified bitmap. Allegro game programming library.

## NAME

bitmap\_color\_depth - Returns the color depth of the specified bitmap. Allegro game programming library.

## SYNOPSIS

**#include \<allegro.h\>**

**int bitmap\_color\_depth(BITMAP \*bmp);**

## DESCRIPTION

Returns the color depth of the specified bitmap (8, 15, 16, 24, or 32). Example:

```
   switch (bitmap_color_depth(screen)) {
      case 8:
         /* Access screen using optimized 8-bit code. */
         break;
      default:
         /* Use generic slow functions. */
         break;
   }
```

## SEE ALSO

[**set\_color\_depth**(3alleg)](/set_color_depth/3alleg.md), [**bitmap\_mask\_color**(3alleg)](/bitmap_mask_color/3alleg.md), [**ex3d**(3alleg)](/ex3d/3alleg.md), [**exlights**(3alleg)](/exlights/3alleg.md), [**exscn3d**(3alleg)](/exscn3d/3alleg.md), [**exswitch**(3alleg)](/exswitch/3alleg.md), [**extrans**(3alleg)](/extrans/3alleg.md), [**exupdate**(3alleg)](/exupdate/3alleg.md), [**exzbuf**(3alleg)](/exzbuf/3alleg.md)
