stretch_blit(3)
π stretch_blit β the glow-up your bitmaps deserve π
okay so bestie, you know stretch_blit(3) from the Allegro manual? it's the Allegro game programming library's very own β¨scalerβ¨ and honestly? iconic. she takes a rectangular area from one bitmap and makes it fit into another one, any size you want. it's giving "glow-up montage" but for pixels. π
πΈ SYNOPSIS πΈ
#include <allegro.h>
void stretch_blit(BITMAP *source, BITMAP *dest, int source_x, source_y,
source_width, source_height, int dest_x, dest_y, dest_width,
dest_height);
β¨ DESCRIPTION β¨
so basically she's blit()'s cooler older sister π
β same energy, except she can scale images, which means your source rectangle and your destination rectangle do not have to be the same size. glow-up complete. but there's a catch, and it's a real one, so listen up bestie:
- both the source and the destination bitmaps have to be the same color depth. no mixing, no matching, periodt.
- this routine does not do as much safety checking as the regular
blit(). she's a little unhinged like that. π
and because she's not doing the safety checks, the responsibility is 100% on you:
β οΈ do not copy from areas outside the source bitmap. fr fr, just don't. β οΈ you cannot blit between overlapping regions β meaning you have to use different bitmaps for the source and the destination. no self-overlap shenanigans. β οΈ and the source must be a memory bitmap. that's the vibe check she needs you to pass.
here's the moment you've been waiting for, the example:
BITMAP *bmp;
...
/* Stretch bmp to fill the screen. */
stretch_blit(bmp, screen, 0, 0, bmp->w, bmp->h,
0, 0, SCREEN_W, SCREEN_H);
look at her go π¦ whole bitmap, whole screen, zero drama (as long as you followed the rules above, bestie).
π SEE ALSO π
blit(3)masked_stretch_blit(3)stretch_sprite(3)exalpha(3)exconfig(3)exscale(3)extrans(3)extrans2(3)
and that's the whole page, bestie β brought to you by Allegro, version 4.4.3, the same manual that's been feeding us since forever. stay stretched, stay slay. πβ¨
π¦ where this page comes from
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms