I have UUserWidget with UImage in WidgetTree, UImage brush is pgn with colored shape on transparent, i need to check if cursor is over shape or transparent somehow, to make hover effect work propertly. Any ideas how to make this work?
FColor* data = static_cast<FColor*>((Texture->PlatformData->Mips[0]).BulkData.Lock(LOCK_READ_ONLY));
if (data)
{
if (ImageData[location].A <= 0)
{
GEngine->AddOnScreenDebugMessage(-1, 3.f, FColor::Cyan, TEXT("TRANSPARENT"));
}
else
{
GEngine->AddOnScreenDebugMessage(-1, 3.f, FColor::Cyan, TEXT("NOT TRANSPARENT"));
}
}
Texture->PlatformData->Mips[0].BulkData.Unlock();
If you mean to get the color or transparency of what is on screen, then you could use this function:
static [FLinearColor](https://docs.unrealengine.com/latest/INT/API/Runtime/Core/Math/FLinearColor/index.html) GetScreenPixelColor
(
const struct [FVector2D](https://docs.unrealengine.com/latest/INT/API/Runtime/Core/Math/FVector2D/index.html) & InScreenPos,
float InGamma
)
And try using the mouse location as the InScreenPos. I’ve not tried this but it may work.
Cheers