The Allegro Wiki is migrating to github at https://github.com/liballeg/allegro_wiki/wiki

Al create bitmap

From Allegro Wiki
Jump to: navigation, search

Name

al_create_bitmap - creates a non-display bitmap

C Specification

AL_BITMAP *al_create_bitmap(int flags, AL_DISPLAY *inherit_from, int width, int height)

Parameters

flags Style of bitmap to create (see below)
inherit_from A display from which to take information concerning color depth, color component ordering and color space.
width The width, in pixels, of the new bitmap
height The height, in pixels, of the new bitmap

Flags

Flags can be only one of:

  • AL_BITMAP_TYPE_MEMORY == 0
  • AL_BITMAP_TYPE_VIDEO
  • AL_BITMAP_TYPE_SYSTEM

This specifies the bitmap type to create.

Additionally, you can OR the flags parameter with:

  • AL_KEEP_MEMORY_COPY - For video bitmaps onle, specifies that a memory copy should be kept for high-speed reading. This switch also allows the bitmap to be automatically restored after destructive context switches under Windows. Note that writes to that bitmap are performed at half speed, since two bitmaps need to be updated.

Description

Creates a bitmap of size width by height, and returns a pointer to it. The bitmap will have clipping turned on, and the clipping rectangle set to the full size of the new bitmap. The image memory will not be cleared, so it will probably contain garbage: you should initialize the bitmap data before using it.

Note that system and video bitmaps must always inherit from a display bitmap. Video and system bitmaps can only be blitted to memory bitmaps or video, system or display bitmaps (and sub-bitmaps thereof) that inherit from the same parent display bitmap. That is, you cannot blit blit from a video bitmap in display_1 to display_2.

Notes

See al_create_bitmap_2 for the creation of arbitrary color space and depth bitmaps without matching AL_DISPLAYs.

Errors

If Allegro is unable to create the desired bitmap then NULL is returned.

See Also