The gdImagePolygon, gdImageOpenPolygon and gdImageFilledPolygon actually take a pointer to a flat array of:
typedef struct {
int x, y;
}
The current implementation gets away with this because the array of structs will be layed out in memory as if it were an array of int32 with no word boundary padding on 32 or 64 bit platforms.
It would however be nicer if it were actually expressed as an array of structs if only to make the code clearer as to what is going on. There is some module in the ecosystem that can turn a CArray of pointers to structs into a flat array of the actual structs.
The
gdImagePolygon
,gdImageOpenPolygon
andgdImageFilledPolygon
actually take a pointer to a flat array of:The current implementation gets away with this because the array of structs will be layed out in memory as if it were an array of
int32
with no word boundary padding on 32 or 64 bit platforms.It would however be nicer if it were actually expressed as an array of structs if only to make the code clearer as to what is going on. There is some module in the ecosystem that can turn a
CArray
of pointers to structs into a flat array of the actual structs.