sdlSetSurfaceColorspace function surface

bool sdlSetSurfaceColorspace(
  1. Pointer<SdlSurface> surface,
  2. int colorspace
)

Set the colorspace used by a surface.

Setting the colorspace doesn't change the pixels, only how they are interpreted in color operations.

\param surface the SDL_Surface structure to update. \param colorspace an SDL_Colorspace value describing the surface colorspace. \returns true on success or false on failure; call SDL_GetError() for more information.

\threadsafety This function is not thread safe.

\since This function is available since SDL 3.2.0.

\sa SDL_GetSurfaceColorspace

extern SDL_DECLSPEC bool SDLCALL SDL_SetSurfaceColorspace(SDL_Surface *surface, SDL_Colorspace colorspace)

Implementation

bool sdlSetSurfaceColorspace(Pointer<SdlSurface> surface, int colorspace) {
  final sdlSetSurfaceColorspaceLookupFunction = _libSdl
      .lookupFunction<
        Uint8 Function(Pointer<SdlSurface> surface, Int32 colorspace),
        int Function(Pointer<SdlSurface> surface, int colorspace)
      >('SDL_SetSurfaceColorspace');
  return sdlSetSurfaceColorspaceLookupFunction(surface, colorspace) == 1;
}