sdlWriteSurfacePixel function surface
Writes a single pixel to a surface.
This function prioritizes correctness over speed: it is suitable for unit tests, but is not intended for use in a game engine.
Like SDL_MapRGBA, this uses the entire 0..255 range when converting color components from pixel formats with less than 8 bits per RGB component.
\param surface the surface to write. \param x the horizontal coordinate, 0 <= x < width. \param y the vertical coordinate, 0 <= y < height. \param r the red channel value, 0-255. \param g the green channel value, 0-255. \param b the blue channel value, 0-255. \param a the alpha channel value, 0-255. \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.
extern SDL_DECLSPEC bool SDLCALL SDL_WriteSurfacePixel(SDL_Surface *surface, int x, int y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Implementation
bool sdlWriteSurfacePixel(
Pointer<SdlSurface> surface,
int x,
int y,
int r,
int g,
int b,
int a,
) {
final sdlWriteSurfacePixelLookupFunction = _libSdl
.lookupFunction<
Uint8 Function(
Pointer<SdlSurface> surface,
Int32 x,
Int32 y,
Uint8 r,
Uint8 g,
Uint8 b,
Uint8 a,
),
int Function(
Pointer<SdlSurface> surface,
int x,
int y,
int r,
int g,
int b,
int a,
)
>('SDL_WriteSurfacePixel');
return sdlWriteSurfacePixelLookupFunction(surface, x, y, r, g, b, a) == 1;
}