Skip to content

Fix double application of FillAlpha in shaded plots - #717

Merged
brenocq merged 2 commits into
epezent:masterfrom
martinecker:fix-double-fill-alpha
Oct 25, 2026
Merged

brenocq merged 2 commits into
epezent:masterfrom
martinecker:fix-double-fill-alpha

Conversation

@martinecker

Copy link
Copy Markdown
Contributor

ImPlot already applies FillAlpha to the constant fill color in BeginItem. The shaded render paths applied the same value again through GetterConstColor, making fills too transparent due to the double application.

To fix stop passing FillAlpha a second time for constant-color fills in:

  • shaded PlotLine calls
  • shaded PlotStairs calls
  • PlotShaded calls

ImPlot already applies FillAlpha to the constant fill color in BeginItem. The shaded render paths applied the same value again through
GetterConstColor, making fills too transparent due to the double application.

To fix stop passing FillAlpha a second time for constant-color fills in:
- shaded PlotLine calls
- shaded PlotStairs calls
- PlotShaded calls
@brenocq

brenocq commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

Ooops, I introduced this bug in #672. Sorry!

Now Fixed
image image

@brenocq
brenocq self-requested a review October 25, 2026 08:04
@brenocq brenocq added type:fix Something isn't working prio:high High priority status:review The task is under review labels Oct 25, 2026
BeginItemEx already scales FillColor by FillAlpha, so constant-color fills
must not apply it again. epezent#672 added a second multiplication through
GetterConstColor; the previous commit removes it from the shaded line,
stairs and PlotShaded paths, and this one removes it from PlotBarsVEx and
PlotBarsHEx, which also serve PlotBarGroups and PlotHistogram. A fill with
FillAlpha 0.5 now draws at 0.5 instead of 0.25, matching per-index
FillColors and the behavior before epezent#672.

With no caller passing an alpha any more, GetterConstColor loses its alpha
parameter so the double application cannot come back.
@brenocq

brenocq commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator

The same double application was also in PlotBarsVEx/PlotBarsHEx, which also affects PlotBarGroups and PlotHistogram. I pushed a commit on top of yours that removes it there. Since no call site needs it anymore, the commit also removes the alpha parameter from GetterConstColor, so this can't come back. Now every fill with FillAlpha = 0.5 (shaded, line, stairs, bars, and per-index FillColors) is drawn at 0.5, and the Shaded Plots demo looks like it did before v1.0.

@brenocq
brenocq merged commit 6d1b461 into epezent:master Oct 25, 2026
19 checks passed

@brenocq brenocq left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch, thanks @martinecker!!

@brenocq brenocq added status:done Task completed successfully and removed status:review The task is under review labels Oct 25, 2026
mgradwohl added a commit to mgradwohl/tasksmack that referenced this pull request Oct 28, 2026
…3166) (#3188)

ImPlot v1.1 (819f2006) is 52 commits ahead of our pin and 0 behind, so it
keeps the anti-aliased line texture fix (#2744). Keep the SHA pin; the
comment now reads "# v1.1", so Renovate's implot regex manager tracks
ImPlot again, and the generated THIRD_PARTY_NOTICES.txt names "implot
v1.1" instead of "master after v1.0".

v1.1 applies ImPlotSpec::FillAlpha to a single-colour fill once instead of
twice (epezent/implot#717). TaskSmack's fills carry their alpha in the
fill colour and never set FillAlpha (default 1), and the second
multiplication was skipped for an alpha of 1, so every chart fill draws
exactly as before. tests/UI/test_PlotShadedFill.cpp renders the fills
headless and holds their vertex colours to it: the theme fill's alpha
(0x4D = 77) on both pins, and an explicit FillAlpha of 0.5 at 128 on v1.1
(64 on 7eeb9168).

No API our code uses changed: v1.1's public API changes are additions.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

prio:high High priority status:done Task completed successfully type:fix Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants