b2dLoadIndexedImage

Loads a paletted (indexed-colour) PNG so its palette can be cycled/recoloured. Returns an image handle (0 on failure).

2D Overlay

Parameters & Returns

Parameters

filePath String

Returns

Int

Quick Summary

Loads a paletted (indexed-colour) PNG so its palette can be cycled/recoloured. Returns an image handle (0 on failure).

Technical Exegesis...

Loads an 8-bit indexed PNG and keeps its colour palette editable at runtime, which is what makes palette cycling and per-image recolouring possible - the pixels store palette indices, and changing the palette instantly recolours every pixel that uses those entries. Draw it with b2dDrawImage like any image. Unlike b2dLoadImage (which loads true-colour), this preserves the index->colour palette. Each loaded copy owns its palette independently.

Example

Example.bam
img = b2dLoadIndexedImage("Media/waterfall.png")
b2dSetTransparentIndex(img, 0)
b2dCyclePalette(img, 16, 31, 18.0)