al_draw_soft_line(3alleg5)
π al_draw_soft_line β Allegro 5 API π
okay bestie, so this one's from the Allegro 5 API and it's lowkey iconic: al_draw_soft_line is the girl who draws a line with the software rasterizer and your own pixel functions. she does not do it for you. she hands you the mic. π€β¨
β¨ SYNOPSIS β¨
#include <allegro5/allegro_primitives.h>
void al_draw_soft_line(ALLEGRO_VERTEX* v1, ALLEGRO_VERTEX* v2, uintptr_t state,
void (*first)(uintptr_t, int, int, ALLEGRO_VERTEX*, ALLEGRO_VERTEX*),
void (*step)(uintptr_t, int),
void (*draw)(uintptr_t, int, int))
like yes she takes five arguments and three of them are function pointers, it's giving very much "bring your own everything" π
πΈ DESCRIPTION πΈ
So she draws a line using the software rasterizer, but with user supplied pixel functions. no cap. if you wanna actually understand what those functions are supposed to do, go read the implementation of the various shading routines in addons/primitives/line_soft.c β that's the homework, bestie, it's all there. π
oh and also: the line is drawn top to bottom. periodt.
Parameters (the whole squad):
v1,v2β the two vertices of the line. that's the whole line right there, just two points being their little main character selves π«Άstateβ a pointer to a user supplied struct, and this struct gets passed to all the pixel functions. she's the group chat everyone's added to, fr fr.firstβ called before drawing the first pixel of the line. she gets handed the coordinates of this pixel, plus the two vertices above. β οΈ important: the vertices she gets passed may have been altered by clipping. so don't be out here assuming they're your original ones, okay?stepβ called once per pixel. the second parameter is set to1if the step is a minor step, and0if this step is a major step. minor steps are taken only either in x or y directions. major steps are taken in both directions diagonally. and in all cases, the absolute value of the change in coordinate is at most 1 in either direction. slay, math queen πdrawβ called once per pixel. the function is expected to draw the pixel at the coordinates passed to it. that's it, that's the job. go off. π¨
π SEE ALSO π
ngl, if you skip reading addons/primitives/line_soft.c you're gonna be confused and that's on you, not on her. π
okay that's the whole page, ily, go draw some pixels ππ¦πΈ β this was the Allegro reference manual, page al_draw_soft_line(3alleg5), signing off bestie style πβ¨
π¦ where this page comes from
- debian trixie: allegro5-doc 2:5.2.10.1+dfsg-1 Β· Zlib
- ubuntu questing: allegro5-doc 2:5.2.10.1+dfsg-1build1
- ubuntu resolute: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- ubuntu stonking: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms