do_ellipse(3alleg4)
π do_ellipse β Allegro manual π
okay bestie, pull up a chair, we're gonna talk about one of those quiet little legends of the Allegro 4 library. this one lives in the Allegro game programming library, and it's about to make your ellipse go brrr. π¦
β¨ NAME β¨
do_ellipse β Calculates all the points in an ellipse. Allegro game programming library.
πΈ SYNOPSIS πΈ
#include <allegro.h>
void do_ellipse(BITMAP *bmp, int x, int y, int rx, ry, int d, void
(*proc)(BITMAP *bmp, int x, int y, int d));
π DESCRIPTION π
so basically, do_ellipse crunches every single point that makes up an ellipse, like, all of them, and it does it around the point (x, y) with radius rx and ry. and the way it hands them to you?? it calls the function you supply, once per point. iconic behaviour, honestly. π
for each point it calls that function with a copy of the bmp parameter, the x and y position, and a copy of the d parameter. which means β and this is the part where you go "ohhh" β it's suitable for use with putpixel(). that's the whole point, bestie. you draw the pixels yourself inside your callback.
Example, because we love a demo:
void draw_explosion_ring(BITMAP *bmp, int x, int y, int d)
{
...
}
do_ellipse(screen, SCREEN_W/2, SCREEN_H/2,
SCREEN_H/16, SCREEN_H/32, flame_color,
draw_explosion_ring);
not me using it to make an explosion ring in the dead centre of the screen π the radius is a sixteenth of the screen height and a thirty-second of the screen height, and flame_color just gets yeeted through to your function as d. no cap.
fr fr: your callback needs to match that signature exactly βBITMAP *bmp,int x,int y,int dβ otherwise this whole vibe check fails.
π«Ά SEE ALSO π«Ά
do_circle(3alleg4)β same energy, but round. πdo_arc(3alleg4)β a lil slice of the curve.do_line(3alleg4)β for when you're being straight (unlike us). πellipse(3alleg4)β the draw-it-for-you version.ellipsefill(3alleg4)β the fill-it-in-for-you version. slay.
and that's the whole page, bestie!! this was the Allegro manual, version 4.4.3, and the page is dated do_ellipse(3alleg4) β go forth and draw your little rings of flame. i'm obsessed. periodt. πβ¨
π¦ where this page comes from
- debian bookworm: allegro4-doc 2:4.4.3.1-3 Β· Allegro-gift-ware
- debian trixie: allegro4-doc 2:4.4.3.1-5 Β· Allegro-gift-ware
- ubuntu jammy: allegro4-doc 2:4.4.3.1-2 Β· Allegro-gift-ware
- ubuntu noble: allegro4-doc 2:4.4.3.1-4.1build3 Β· Allegro-gift-ware
- ubuntu questing: allegro4-doc 2:4.4.3.1-6
- ubuntu resolute: allegro4-doc 2:4.4.3.1-7 Β· Allegro-gift-ware
- ubuntu stonking: allegro4-doc 2:4.4.3.1-9 Β· Allegro-gift-ware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms