mirror of
https://github.com/raysan5/raylib.git
synced 2026-08-26 17:11:33 +00:00
[rcore][win32] Implement GetClipboardImage() (#6091)
This commit is contained in:
@@ -1129,12 +1129,37 @@ const char *GetClipboardText(void)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if SUPPORT_CLIPBOARD_IMAGE && SUPPORT_MODULE_RTEXTURES
|
||||
#define WIN32_CLIPBOARD_IMPLEMENTATION
|
||||
#define WINUSER_ALREADY_INCLUDED
|
||||
#define WINBASE_ALREADY_INCLUDED
|
||||
#define WINGDI_ALREADY_INCLUDED
|
||||
#include "../external/win32_clipboard.h"
|
||||
#endif
|
||||
|
||||
// Get clipboard image
|
||||
Image GetClipboardImage(void)
|
||||
{
|
||||
Image image = { 0 };
|
||||
|
||||
TRACELOG(LOG_WARNING, "GetClipboardText not implemented");
|
||||
#if SUPPORT_CLIPBOARD_IMAGE && SUPPORT_MODULE_RTEXTURES
|
||||
unsigned int dataSize = 0;
|
||||
void *fileData = NULL;
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
|
||||
fileData = (void *)Win32GetClipboardImageData(&width, &height, &dataSize);
|
||||
|
||||
if (fileData == NULL) TRACELOG(LOG_WARNING, "Clipboard image: Couldn't get clipboard data.");
|
||||
else
|
||||
{
|
||||
image = LoadImageFromMemory(".bmp", (const unsigned char*)fileData, (int)dataSize);
|
||||
|
||||
RL_FREE(fileData);
|
||||
}
|
||||
#else
|
||||
TRACELOG(LOG_WARNING, "Clipboard image: SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_MODULE_RTEXTURES to work properly");
|
||||
#endif // SUPPORT_CLIPBOARD_IMAGE
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user