How to get the color of a specific pixel from SDL_Surface?
问题 I'm trying to get the RGB/RGBA color of pixels from a SDL_Surface. I've found this code on the internet but it returns strange numbers (67372036 for a pixel that is 0 red, 0 green, 255 blue) Uint32 get_pixel32(SDL_Surface *surface, int x, int y) { Uint32 *pixels = (Uint32 *)surface->pixels; return pixels[(y * surface->w) + x]; } This it the code I've been using: Uint32 data = get_pixel32(gSurface, 0, 0); printf("%i", data); I'm not sure if my pixels have a 32bit format but other pictures didn