sdlSetSurfaceColorspace function

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.

\since This function is available since SDL 3.1.3.

\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 = libSdl3.lookupFunction<
      Uint8 Function(Pointer<SdlSurface> surface, Int32 colorspace),
      int Function(Pointer<SdlSurface> surface,
          int colorspace)>('SDL_SetSurfaceColorspace');
  return sdlSetSurfaceColorspaceLookupFunction(surface, colorspace) == 1;
}