sdlxGetTextureColorModFloat function render

bool sdlxGetTextureColorModFloat(
  1. Pointer<SdlTexture> texture,
  2. SdlxFColor color
)

Get the additional color value multiplied into render copy operations.

\param texture the texture to query. \param r a pointer filled in with the current red color value. \param g a pointer filled in with the current green color value. \param b a pointer filled in with the current blue color value. \returns true on success or false on failure; call SDL_GetError() for more information.

\threadsafety This function should only be called on the main thread.

\since This function is available since SDL 3.2.0.

\sa SDL_GetTextureAlphaModFloat \sa SDL_GetTextureColorMod \sa SDL_SetTextureColorModFloat

extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureColorModFloat(SDL_Texture *texture, float *r, float *g, float *b)

Implementation

bool sdlxGetTextureColorModFloat(
  Pointer<SdlTexture> texture,
  SdlxFColor color,
) {
  final rPointer = ffi.calloc<Float>();
  final gPointer = ffi.calloc<Float>();
  final bPointer = ffi.calloc<Float>();
  final aPointer = ffi.calloc<Float>();
  var result = sdlGetTextureColorModFloat(
    texture,
    rPointer,
    gPointer,
    bPointer,
  );
  if (result) {
    color
      ..r = rPointer.value
      ..g = gPointer.value
      ..b = bPointer.value;
    result = sdlGetTextureAlphaModFloat(texture, aPointer);
    if (result) {
      color.a = aPointer.value;
    }
  }
  rPointer.callocFree();
  gPointer.callocFree();
  bPointer.callocFree();
  aPointer.callocFree();
  return result;
}