sdlSetTextureAlphaMod function

bool sdlSetTextureAlphaMod(
  1. Pointer<SdlTexture> texture,
  2. int alpha
)

Set an additional alpha value multiplied into render copy operations.

When this texture is rendered, during the copy operation the source alpha value is modulated by this alpha value according to the following formula:

srcA = srcA * (alpha / 255)

Alpha modulation is not always supported by the renderer; it will return false if alpha modulation is not supported.

\param texture the texture to update. \param alpha the source alpha value multiplied into copy operations. \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.1.3.

\sa SDL_GetTextureAlphaMod \sa SDL_SetTextureAlphaModFloat \sa SDL_SetTextureColorMod

extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureAlphaMod(SDL_Texture *texture, Uint8 alpha)

Implementation

bool sdlSetTextureAlphaMod(Pointer<SdlTexture> texture, int alpha) {
  final sdlSetTextureAlphaModLookupFunction = libSdl3.lookupFunction<
      Uint8 Function(Pointer<SdlTexture> texture, Uint8 alpha),
      int Function(
          Pointer<SdlTexture> texture, int alpha)>('SDL_SetTextureAlphaMod');
  return sdlSetTextureAlphaModLookupFunction(texture, alpha) == 1;
}