UE5.4 获取颜色

来自泡泡学习笔记
跳到导航 跳到搜索
#include "Windows/AllowWindowsPlatformTypes.h"
#include <windows.h>
#include "Windows/HideWindowsPlatformTypes.h"

#include "Math/Color.h"

...

public:


	UFUNCTION(BlueprintCallable, Category = "LPFunction")
		static FColor GetMouseColor(double x, double y);

...

FColor ULPFunctionLibrary::GetMouseColor(double x, double y)
{
	HDC hdc = GetDC(NULL);
	COLORREF curColor = GetPixel(hdc, x, y);
	ReleaseDC(NULL, hdc);

	FColor mouseColor(GetRValue(curColor), GetGValue(curColor), GetBValue(curColor));

	return mouseColor;
}