SDL_WriteSurfacePixelFloat(3)
π SDL_WriteSurfacePixelFloat π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we're talking about SDL_WriteSurfacePixelFloat β the lil' function that writes one single pixel to a surface. one. single. pixel. and honestly? she's giving precision. β¨
π NAME π
SDL_WriteSurfacePixelFloat β writes a single pixel to a surface. that's it, that's the whole job, and she does it flawlessly. π
π¦ SYNOPSIS π¦
#include <SDL3/SDL_surface.h>
bool SDL_WriteSurfacePixelFloat(SDL_Surface *surface, int x, int y, float r, float g, float b, float a);
like yes, seven arguments, she's high maintenance, but look at her. look. at. her. π
πΈ DESCRIPTION πΈ
okay so here's the tea, bestie: this function prioritizes correctness over speed. she is not here to be fast, she is here to be right.
so like β it's suitable for unit tests, but it is not intended for use in a game engine. no cap. if you're trying to render a whole frame with this, you are going to have a bad time, and I say that with love. π«Ά
β¨ FUNCTION PARAMETERS β¨
surfaceβ the surface you're writing to. the canvas. the moment. π¨xβ the horizontal coordinate, and the vibe check here is0 <= x < width.yβ the vertical coordinate, same deal:0 <= y < height.rβ the red channel value, normally in the range0-1. π₯gβ the green channel value, normally in the range0-1. πbβ the blue channel value, normally in the range0-1. πaβ the alpha channel value, normally in the range0-1. translucent queen. π§
π RETURN VALUE π
Returns true on success or false on failure β and if it fails, do not just sit there guessing, bestie. call SDL_GetError() for more information. she will tell you what went wrong, fr fr. π
π₯ THREAD SAFETY π₯
good news!! this function can be called on different threads with different surfaces. so you and your mutuals can each do your own thing at the same time, no drama, no fighting. main character energy for everyone. π
β AVAILABILITY β
this function is available since SDL 3.2.0. so if you're on something older... babe. it's giving outdated. π
π« sign-off π«
and that's the whole page!! brought to you by Simple Directmedia Layer, version SDL 3.4.18, manual page SDL_WriteSurfacePixelFloat(3). go forth and write exactly one pixel, you absolute icon. ππ¦π
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms