ALLEGRO_LOCKED_REGION
typedef struct ALLEGRO_LOCKED_REGION ALLEGRO_LOCKED_REGION;
Introduced in 5.0.0
Users who wish to manually edit or read from a bitmap are required to lock it first. The ALLEGRO_LOCKED_REGION structure represents the locked region of the bitmap. This call will work with any bitmap, including memory bitmaps.
typedef struct ALLEGRO_LOCKED_REGION {
void *data;
int format;
int pitch;
int pixel_size;
} ALLEGRO_LOCKED_REGION;
data points to the leftmost pixel of the first row (row 0) of the locked region.
format indicates the pixel format of the data.
pitch gives the size in bytes of a single row (also known as the stride). The pitch may be greater than
width * pixel_size
due to padding; this is not uncommon. It is also not uncommon for the pitch to be negative (the bitmap may be upside down).pixel_size is the number of bytes used to represent a single pixel.
See also: al_lock_bitmap, al_lock_bitmap_region, al_unlock_bitmap, ALLEGRO_PIXEL_FORMAT
Examples: ex_blend, ex_blit, ex_clip, ex_draw, ex_drawpixels, ex_filter, ex_lockbitmap, ex_logo, ex_premulalpha, ex_threads2
Most helpful discussions:
- ALLEGRO_THREAD (1)
- Convert *bitmap to char buffer
- using a photo to floofill a bitmap
- making good graphics
- Problems porting to linux. Video crashes
- ALLEGRO_LOCKED_REGION confusion
- Steam Client interference / OpenGL
- Using ESCAPI with Allegro
- Suggestions for optimization
- Direct access to a pointer to bitmap
Other recent discussions:
- Use Allegro with Tilengine
- Performance issue regarding al_put_pixel and raycasting
- Shader Problems - GLSL sampler3d() - 5.1.9
- Get binary stream of bitmap - al_save_bitmap_f() or something like this
- Blit to Android display
- open GL + al_draw_indexed_prim
- Blit bitmap to display
- Allegro 5 - Bitmap Deferred Corruption(?)
- speeding up mandelbrot fractal creation
- "al_put_pixel" not working