UE5.4 获取颜色

来自泡泡学习笔记
BrainBs讨论 | 贡献2024年10月26日 (六) 19:33的版本 (创建页面,内容为“ <pre> #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)…”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳到导航 跳到搜索
#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;
}