b2dSetTransparentIndex

Category: 2D Overlay

Syntax:

b2dSetTransparentIndex:Void(imageHandle:Int, index:Int)


Parameters

Returns

Void



Summary

Makes one palette index draw as transparent.

Takes imageHandle (an indexed image) and index (the palette entry to treat as a hole).

Returns nothing.

The default is no transparent index at all - not index 0. Any value outside 0 to 255 turns it off again. Unless this is called, the only transparency is whatever alpha the PNG's own palette carries.

The hole is positional: the chosen index stays transparent and cycled colours flow through it, rather than the transparency travelling around with the rotation.

View detailed documentation online



Example
b2dSetTransparentIndex(img, 0)     ; index 0 becomes a hole
b2dSetTransparentIndex(img, -1)    ; and back to none

BambooBasic © 2026 Michael Denathorn