sdlxGetSurfaceColorKey function surface

int? sdlxGetSurfaceColorKey(
  1. Pointer<SdlSurface> surface
)

Get the color key (transparent pixel) for a surface.

The color key is a pixel of the format used by the surface, as generated by SDL_MapRGB().

If the surface doesn't have color key enabled this function returns false.

\param surface the SDL_Surface structure to query. \param key a pointer filled in with the transparent pixel. \returns true on success or false on failure; call SDL_GetError() for more information.

\threadsafety It is safe to call this function from any thread.

\since This function is available since SDL 3.2.0.

\sa SDL_SetSurfaceColorKey \sa SDL_SurfaceHasColorKey

extern SDL_DECLSPEC bool SDLCALL SDL_GetSurfaceColorKey(SDL_Surface *surface, Uint32 *key)

Implementation

int? sdlxGetSurfaceColorKey(Pointer<SdlSurface> surface) {
  int? result;
  final keyPointer = ffi.calloc<Uint32>();
  final bl = sdlGetSurfaceColorKey(surface, keyPointer);
  if (bl) {
    result = keyPointer.value;
  }
  keyPointer.callocFree();
  return result;
}