AL_DRAW_FILLED_POLYGON_WITH_HOLES(3)

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

🌸 NAME 🌸

okay so this is al_draw_filled_polygon_with_holes(3) from the Allegro 5 API, hanging out in the Library Functions Manual β€” bestie, we’re about to fill some polygons with holes and it’s giving geometry slay πŸ’…βœ¨

al_draw_filled_polygon_with_holes β€” Allegro 5 API

✨ SYNOPSIS ✨

#include <allegro5/allegro_primitives.h>

void al_draw_filled_polygon_with_holes(const float *vertices,
   const int *vertex_counts, ALLEGRO_COLOR color)

πŸ’– DESCRIPTION πŸ’–

This draws a filled simple polygon with zero or more other simple polygons subtracted from it β€” those are the holes 🫢

🚨 hole rule: the holes cannot touch or intersect with the outline of the filled polygon. no cap.

okay so the arguments are lowkey iconic:

  • vertices β€” the interleaved array of (x, y) vertex coordinates for each of the polygons, including holes πŸ’–
  • vertex_counts β€” how many vertices each polygon has. The filled polygon’s count is vertex_counts[0], and it must be at least three. Subsequent elements indicate the number of vertices in each hole. The array must be terminated with an element with value 0 ✨
  • color β€” the color of the filled polygon 🎨

When the y-axis is facing downwards (the usual), the filled polygon coordinates must be ordered anti-clockwise. All hole vertices must use the opposite order (clockwise with y down). All hole vertices must be inside the main polygon, and no hole may overlap the main polygon 🌸

For example:

float vertices[] = {
      0,   0, // filled polygon, upper left corner
      0, 100, // filled polygon, lower left corner
    100, 100, // filled polygon, lower right corner
    100,   0, // filled polygon, upper right corner
     10,  10, // hole, upper left
     90,  10, // hole, upper right
     90,  90  // hole, lower right
};
int vertex_counts[] = {
   4, // number of vertices for filled polygon
   3, // number of vertices for hole
   0  // terminator
};

There are 7 vertices: four for an outer square from (0, 0) to (100, 100) in anti-clockwise order, and three more for an inner triangle in clockwise order. The outer main polygon uses vertices 0 to 3 (inclusive) and the hole uses vertices 4 to 6 (inclusive) πŸ‘‘

⏳ SINCE ⏳

5.1.0 β€” periodt, that’s when it showed up ✨

πŸ”Ž SEE ALSO πŸ”Ž


byeee bestie, this came from the Allegro reference manual, filed under al_draw_fi..._with_holes(3) β€” no date on this footer, so I’m not inventing one 🫢🌈

πŸ“¦ 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