Skip to content

Commit 1c27890

Browse files
Implement SDL_GetWindowICCProfile
1 parent 8700fdf commit 1c27890

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/sdl2/video.rs

+18
Original file line numberDiff line numberDiff line change
@@ -1429,6 +1429,24 @@ impl Window {
14291429
}
14301430
}
14311431

1432+
#[doc(alias = "SDL_GetWindowICCProfile")]
1433+
pub fn icc_profile(&self) -> Result<Vec<u8>, String> {
1434+
unsafe {
1435+
let mut size: sys::size_t = 0;
1436+
let data = sys::SDL_GetWindowICCProfile(
1437+
self.context.raw,
1438+
&mut size as *const sys::size_t as *mut _,
1439+
);
1440+
if data.is_null() {
1441+
return Err(get_error());
1442+
}
1443+
let mut result = vec![0; size as usize];
1444+
result.copy_from_slice(std::slice::from_raw_parts(data as *const u8, size as usize));
1445+
sys::SDL_free(data);
1446+
Ok(result)
1447+
}
1448+
}
1449+
14321450
#[doc(alias = "SDL_GetWindowPixelFormat")]
14331451
pub fn window_pixel_format(&self) -> PixelFormatEnum {
14341452
unsafe {

0 commit comments

Comments
 (0)