Function SDL_SetWindowIcon

pub unsafe extern "C" fn SDL_SetWindowIcon(
    window: *mut SDL_Window,
    icon: *mut SDL_Surface,
) -> bool
Available on crate feature dep_sdl3 only.
Expand description

Set the icon for a window.

If this function is passed a surface with alternate representations, the surface will be interpreted as the content to be used for 100% display scale, and the alternate representations will be used for high DPI situations. For example, if the original surface is 32x32, then on a 2x macOS display or 200% display scale on Windows, a 64x64 version of the image will be used, if available. If a matching version of the image isn’t available, the closest larger size image will be downscaled to the appropriate size and be used instead, if available. Otherwise, the closest smaller image will be upscaled and be used instead.

§Parameters

  • window: the window to change.
  • icon: an SDL_Surface structure containing the icon for the window.

§Return value

Returns true on success or false on failure; call SDL_GetError() for more information.

§Thread safety

This function should only be called on the main thread.

§Availability

This function is available since SDL 3.2.0.