sdlWriteSurfacePixelFloat function surface

bool sdlWriteSurfacePixelFloat(
  1. Pointer<SdlSurface> surface,
  2. int x,
  3. int y,
  4. double r,
  5. double g,
  6. double b,
  7. double a,
)

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.

\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, normally in the range 0-1. \param g the green channel value, normally in the range 0-1. \param b the blue channel value, normally in the range 0-1. \param a the alpha channel value, normally in the range 0-1. \returns true on success or false on failure; call SDL_GetError() for more information.

\threadsafety This function can be called on different threads with different surfaces.

\since This function is available since SDL 3.2.0.

extern SDL_DECLSPEC bool SDLCALL SDL_WriteSurfacePixelFloat(SDL_Surface *surface, int x, int y, float r, float g, float b, float a)

Implementation

bool sdlWriteSurfacePixelFloat(
  Pointer<SdlSurface> surface,
  int x,
  int y,
  double r,
  double g,
  double b,
  double a,
) {
  final sdlWriteSurfacePixelFloatLookupFunction = _libSdl
      .lookupFunction<
        Uint8 Function(
          Pointer<SdlSurface> surface,
          Int32 x,
          Int32 y,
          Float r,
          Float g,
          Float b,
          Float a,
        ),
        int Function(
          Pointer<SdlSurface> surface,
          int x,
          int y,
          double r,
          double g,
          double b,
          double a,
        )
      >('SDL_WriteSurfacePixelFloat');
  return sdlWriteSurfacePixelFloatLookupFunction(surface, x, y, r, g, b, a) ==
      1;
}