From 8935311b0384d272eb176ed619d94c2fbde52906 Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Sun, 14 Apr 2019 20:52:51 +0100 Subject: [PATCH] GetImageRGBA --- Facepunch.Steamworks/Redux/Utils.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Facepunch.Steamworks/Redux/Utils.cs b/Facepunch.Steamworks/Redux/Utils.cs index 563c758..f1f94ec 100644 --- a/Facepunch.Steamworks/Redux/Utils.cs +++ b/Facepunch.Steamworks/Redux/Utils.cs @@ -55,6 +55,23 @@ namespace Steamworks return _steamutils.GetImageSize( image, ref width, ref height ); } + /// + /// returns the image in RGBA format + /// + public static byte[] GetImageRGBA( int image ) + { + if ( !GetImageSize( image, out var w, out var h ) ) + return null; + + var size = w * h * 4 * sizeof( char ); + var data = new byte[size]; + + if ( !_steamutils.GetImageRGBA( image, data, data.Length ) ) + return null; + + return data; + } + internal static bool IsCallComplete( SteamAPICall_t call, out bool failed ) { failed = false;