.\" This manpage content is licensed under Creative Commons .\" Attribution 4.0 International (CC BY 4.0) .\" https://creativecommons.org/licenses/by/4.0/ .\" This manpage was generated from SDL_image's wiki page for IMG_LoadTexture_IO: .\" https://wiki.libsdl.org/SDL_image/IMG_LoadTexture_IO .\" Generated with SDL/build-scripts/wikiheaders.pl .\" revision 3~git20240319~18b2816+ds-1 .\" Please report issues in this manpage's content at: .\" https://github.com/libsdl-org/sdlwiki/issues/new .\" Please report issues in the generation of this manpage from the wiki at: .\" https://github.com/libsdl-org/SDL/issues/new?title=Misgenerated%20manpage%20for%20IMG_LoadTexture_IO .\" SDL_image can be found at https://libsdl.org/projects/SDL_image .de URL \$2 \(laURL: \$1 \(ra\$3 .. .if \n[.g] .mso www.tmac .TH IMG_LoadTexture_IO 3 "SDL_image 3.0.0" "SDL_image" "SDL_image3 FUNCTIONS" .SH NAME IMG_LoadTexture_IO \- Load an image from an SDL data source into a GPU texture\[char46] .SH SYNOPSIS .nf .B #include \(dqSDL3_image/SDL_image.h\(dq .PP .BI "SDL_Texture * IMG_LoadTexture_IO(SDL_Renderer *renderer, SDL_IOStream *src, SDL_bool closeio); .fi .SH DESCRIPTION An SDL_Texture represents an image in GPU memory, usable by SDL's 2D Render API\[char46] This can be significantly more efficient than using a CPU-bound SDL_Surface if you don't need to manipulate the image directly after loading it\[char46] If the loaded image has transparency or a colorkey, a texture with an alpha channel will be created\[char46] Otherwise, SDL_image will attempt to create an SDL_Texture in the most format that most reasonably represents the image data (but in many cases, this will just end up being 32-bit RGB or 32-bit RGBA)\[char46] If .BR closeio is SDL_TRUE, .BR src will be closed before returning, whether this function succeeds or not\[char46] SDL_image reads everything it needs from .BR src during this call in any case\[char46] There is a separate function to read files from disk without having to deal with SDL_IOStream: .BR IMG_LoadTexture(renderer, "filename\[char46]jpg") will call this function and manage those details for you, determining the file type from the filename's extension\[char46] There is also .BR IMG_LoadTextureTyped_IO (), which is equivalent to this function except a file extension (like "BMP", "JPG", etc) can be specified, in case SDL_image cannot autodetect the file format\[char46] If you would rather decode an image to an SDL_Surface (a buffer of pixels in CPU memory), call .BR IMG_Load () instead\[char46] When done with the returned texture, the app should dispose of it with a call to SDL_DestroyTexture()\[char46] .SH FUNCTION PARAMETERS .TP .I renderer the SDL_Renderer to use to create the GPU texture\[char46] .TP .I src an SDL_IOStream that data will be read from\[char46] .TP .I closeio SDL_TRUE to close/free the SDL_IOStream before returning, SDL_FALSE to leave it open\[char46] .SH RETURN VALUE Returns a new texture, or NULL on error\[char46] .SH AVAILABILITY This function is available since SDL_image 3\[char46]0\[char46]0\[char46] .SH SEE ALSO .BR IMG_LoadTexture (3), .BR IMG_LoadTextureTyped_IO (3), .BR SDL_DestroyTexture (3)