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 is 0 <= x < width.
  • y β€” the vertical coordinate, same deal: 0 <= y < height.
  • r β€” the red channel value, normally in the range 0-1. πŸ”₯
  • g β€” the green channel value, normally in the range 0-1. 🌈
  • b β€” the blue channel value, normally in the range 0-1. πŸ’™
  • a β€” the alpha channel value, normally in the range 0-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