al_draw_rotated_bitmap(3)

πŸ“¦
version 5.2.11.3 Β· 3 versions
, in arch rolling

πŸ’– al_draw_rotated_bitmap πŸ’–

okay so this little icon is straight out of the Allegro 5 API, living in the Library Functions Manual β€” and bestie, it's giving β€œrotate the bitmap, slay the canvas” energy ✨


🌸 NAME 🌸

al_draw_rotated_bitmap β€” Allegro 5 API πŸŽ€


✨ SYNOPSIS ✨

#include <allegro5/allegro.h>

void al_draw_rotated_bitmap(ALLEGRO_BITMAP *bitmap,
   float cx, float cy, float dx, float dy, float angle, int flags)

πŸ’… DESCRIPTION πŸ’…

So this one draws a rotated version of the given bitmap to the target bitmap. The bitmap is rotated by angle radians clockwise. Periodt. πŸ”₯

The point at cx/cy relative to the upper left corner of the bitmap will be drawn at dx/dy, and the bitmap is rotated around this point. If cx,cy is 0,0, the bitmap will rotate around its upper left corner. No cap, that's the whole rotation vibe check πŸŒ€

  • cx β€” center x (relative to the bitmap) 🎯
  • cy β€” center y (relative to the bitmap) 🎯
  • dx β€” destination x πŸ“
  • dy β€” destination y πŸ“
  • angle β€” angle by which to rotate (radians) πŸ”„
  • flags β€” same as for al_draw_bitmap(3) 🚩

πŸ¦‹ Example πŸ¦‹

float w = al_get_bitmap_width(bitmap);
float h = al_get_bitmap_height(bitmap);
al_draw_rotated_bitmap(bitmap, w / 2, h / 2, x, y, ALLEGRO_PI / 2, 0);

The above code draws the bitmap centered on x/y and rotates it 90Β° clockwise. Iconic behavior honestly πŸ‘‘

Lowkey important: see al_draw_bitmap(3) for a note on restrictions on which bitmaps can be drawn where. Don't skip the fine print, bestie πŸ’€

🌈 SEE ALSO 🌈


shoutout to the Allegro reference manual for the source/version line at the bottom β€” and the footer's date slot is literally blank, so no date to report, bestie πŸ«ΆπŸ’–

πŸ“¦ where this page comes from
  • arch rolling: allegro 5.2.11.3-2 Β· Zlib AND BSD-3-Clause AND OFL-1.1 AND LicenseRef-Custom
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms