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

Al create sub bitmap

From Allegro Wiki
Jump to: navigation, search

Name

al_create_sub_bitmap - creates a sub-bitmap from a parent

C Specification

AL_BITMAP *al_create_sub_bitmap(AL_BITMAP *parent, int x, int y, int w, int h)

Parameters

parent The parent bitmap
x, y The top left position of the sub-bitmap within the parent bitmap
w, h The width and height of the sub-bitmap

Description

Creates a sub-bitmap of the parent, at the specified coordinates and of the specified size. A sub-bitmap is a bitmap that shares drawing memory with a pre-existing (parent) bitmap, but possibly with a different size and clipping settings.

When creating a sub-bitmap of a mode-X display bitmap, the x position must be a multiple of four.

If the sub-bitmap does not lie completely inside the parent bitmap, then it is automatically clipped so that it does.

The parent bitmap's clipping rectangles are ignored.

Notes

Destroying parents of sub-bitmaps will not destroy the sub-bitmaps; instead the sub-bitmaps become invalid and should no longer be used.

Errors

If a sub-bitmap was not or cannot be created then NULL is returned.

API Branch

Graphics

See Also