ttfxGetTextColorFloat function ttf

SdlxFColor? ttfxGetTextColorFloat(
  1. Pointer<TtfText> text
)

Get the color of a text object.

\param text the TTF_Text to query. \param r a pointer filled in with the red color value, normally in the range of 0-1, may be NULL. \param g a pointer filled in with the green color value, normally in the range of 0-1, may be NULL. \param b a pointer filled in with the blue color value, normally in the range of 0-1, may be NULL. \param a a pointer filled in with the alpha value in the range of 0-1, may be NULL. \returns true on success or false on failure; call SDL_GetError() for more information.

\threadsafety This function should be called on the thread that created the text.

\since This function is available since SDL_ttf 3.0.0.

\sa TTF_GetTextColor \sa TTF_SetTextColorFloat

extern SDL_DECLSPEC bool SDLCALL TTF_GetTextColorFloat(TTF_Text *text, float *r, float *g, float *b, float *a)

Implementation

SdlxFColor? ttfxGetTextColorFloat(Pointer<TtfText> text) {
  SdlxFColor? result;
  final rPointer = ffi.calloc<Float>();
  final gPointer = ffi.calloc<Float>();
  final bPointer = ffi.calloc<Float>();
  final aPointer = ffi.calloc<Float>();
  final bl = ttfGetTextColorFloat(text, rPointer, gPointer, bPointer, aPointer);
  if (bl) {
    result = SdlxFColor(
      rPointer.value,
      gPointer.value,
      bPointer.value,
      aPointer.value,
    );
  }
  rPointer.callocFree();
  gPointer.callocFree();
  bPointer.callocFree();
  aPointer.callocFree();
  return result;
}