Developer Notes

This issue has been closed as 'Won't Fix' due to an extended period of time without updates. If this issue is important to you please let us know by posting on the AnswerHub or UDN, and Epic will re-open the ticket for further review.

Description

If an Alpha value is set in a FLinearColor that is used to draw a line on a Canvas HUD, the Alpha value is ignored when the line is drawn.

A comment in BatchedElements.cpp indicates that some legacy code relies on the Alpha value being ignored, but this information is not communicated to the user.

Steps to Reproduce
  1. Create a new code project using the first person template, no starter content.
  2. Edit the default HUD .h file that is created for the project to add the following line: FLinearColor VisorColor;
  3. Edit the constructor of the default HUD .cpp file to set VisorColor: VisorColor = FLinearColor(0.234335005f, 0.894999981f, 0.296303988f, 0.5f);
    • Note the Alpha has been set to 0.5.
  4. Add the following lines of code to the DrawHUD() function:
    float CenterX = Canvas->ClipX / 2;
    float CenterY = Canvas->ClipY / 2;
    float X10 = Canvas->ClipX * 0.1f;
    float Y10 = Canvas->ClipY * 0.1f;
    Canvas->K2_DrawLine(FVector2D(CenterX - X10, CenterY - Y10), FVector2D(0 + (2 * X10), CenterY - Y10), 10.0f, VisorColor);
    
  5. Build the project in Visual Studio.
  6. Open the project in the Editor.
  7. Click Play to start PIE mode.

RESULT:
A horizontal green line is drawn on the HUD, but it is fully opaque. The Alpha set in VisorColor is not applied.

EXPECTED:
The Alpha set in VisorColor is used.

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

3
Login to Vote

Won't Fix
ComponentUE - Graphics Features
Affects Versions4.7.64.8
CreatedApr 21, 2015
ResolvedJan 17, 2017
UpdatedApr 27, 2018