On my player HUD, I’ve tried to draw a simple line.
if (ThePawn)
{
if (ThePawn->GetLeftHandWeapon() || ThePawn->GetRightHandWeapon())
{
float CenterX = Canvas->ClipX / 2;
float CenterY = Canvas->ClipY / 2;
float X10 = Canvas->ClipX * 0.1f;
float Y10 = Canvas->ClipY * 0.1f;
// Draw the left horizontal line
Canvas->K2_DrawLine(FVector2D(CenterX - X10, CenterY - Y10), FVector2D(0 + (2 * X10), CenterY - Y10), 2.0f, VisorColor);
}
}
The VisorColor has an Alpha of 0.5.
- RenderColor {R=0.234335005 G=0.894999981 B=0.296303988 …} FLinearColor
-
R 0.234335005 float G 0.894999981 float B 0.296303988 float A 0.500000000 float
However, the line is still drawn with 100% opacity.
When I debug, the function uses the right linear color.
void UCanvas::K2_DrawLine(FVector2D ScreenPositionA, FVector2D ScreenPositionB, float Thickness, FLinearColor RenderColor)
{
if (FMath::Square(ScreenPositionB.X - ScreenPositionA.X) + FMath::Square(ScreenPositionB.Y - ScreenPositionA.Y))
{
FCanvasLineItem LineItem(ScreenPositionA, ScreenPositionB);
LineItem.LineThickness = Thickness;
LineItem.SetColor(RenderColor);
DrawItem(LineItem);
}
}
Is ther a limitation on FCanvasLineItem with the FLinearColor ? or is it a bug ?
Txs,
Dominique