SDL_ConvertPixels(3)
π SDL_ConvertPixels(3) π
okay so bestie, welcome to the SDL3 FUNCTIONS corner of the manual, and today's main character is SDL_ConvertPixels π
β¨ NAME β¨
SDL_ConvertPixels β copy a block of pixels of one format to another format. literally just glow-up-ing your pixels into a different format, no cap π¦
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_surface.h>
bool SDL_ConvertPixels(int width, int height, SDL_PixelFormat src_format, const void *src, int src_pitch, SDL_PixelFormat dst_format, void *dst, int dst_pitch);
π FUNCTION PARAMETERS π
widthβ the width of the block you're copying, in pixels. yes queen, measured in pixels, not bytes, don't get it twisted πheightβ the height of the block to copy, in pixels. also pixels. we stay consistent πsrc_formatβ anSDL_PixelFormatvalue describing what format thesrcpixels are in. iykyk π§srcβ a pointer to the source pixels. the originals, the before pic πsrc_pitchβ the pitch of the source pixels, in bytes. (pitch = how many bytes per row, bestie, it's giving row stride energy)dst_formatβ anSDL_PixelFormatvalue describing what format thedstpixels should be. the after pic β¨dstβ a pointer to be filled in with new pixel data. this is where the glow-up lands π«Άdst_pitchβ the pitch of the destination pixels, in bytes. again: bytes, not pixels, ok? π
π₯ RETURN VALUE π₯
Returns true on success or false on failure β and if it's giving false, call SDL_GetError() for more information. she will tell you what went wrong, fr fr π
π THREAD SAFETY π
The same destination pixels should not be used from two threads at once.
but listen β it is safe to use the same source pixels from multiple threads. so many readers, exactly one writer. that's the vibe check π
β AVAILABILITY β
This function is available since SDL 3.2.0. iconic behaviour, truly π
π¦ SEE ALSO π¦
SDL_ConvertPixelsAndColorspace(3)β the cousin who also handles colorspace, go say hi π
and that's the whole page bestie, you ate π β¨
this lil gem comes to you from the Simple Directmedia Layer, version SDL 3.4.18, and it's the SDL_ConvertPixels(3) page β mwah, take care of her ππ
π¦ 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