Function SDL_BYTESPERPIXEL

pub const fn SDL_BYTESPERPIXEL(format: SDL_PixelFormat) -> u8
Available on crate feature dep_sdl3 only.
Expand description

A macro to determine an SDL_PixelFormat’s bytes per pixel.

Note that this macro double-evaluates its parameter, so do not use expressions with side-effects here.

FourCC formats do their best here, but many of them don’t have a meaningful measurement of bytes per pixel.

§Parameters

§Return value

Returns the bytes-per-pixel of format.

§Thread safety

It is safe to call this macro from any thread.

§Availability

This macro is available since SDL 3.2.0.

§See also