Skip to content

psxy, psxyz: Keep -Sl text fill transparency local - #9235

Merged
Esteban82 merged 2 commits into
masterfrom
fix-9234
Oct 1, 2026
Merged

Esteban82 merged 2 commits into
masterfrom
fix-9234

Conversation

@Esteban82

Copy link
Copy Markdown
Member

Claude's:

With a transparent fill, -Sl text was painted via PSL_setcolor, which sets a global PSL_transp that is never undone, so -Gred@50 leaked into all later layers and subplot panels. Such text is now painted via fs (PSL_plottext mode 2), like other filled symbols, so the transparency stays local. This also fixes transparent text fills from segment headers being drawn black. Adds test/psxy/text_symbol_transparency.sh (no baseline).

Fixes #9234

Now I got this figure:
bug_transperency_style_l

Written with Claude Opus 5.5.

@Esteban82 Esteban82 added the add-changelog Add PR to the changelog label Sep 29, 2026
@Esteban82
Esteban82 requested review from a team, joa-quim and yvonnefroehlich September 29, 2026 18:04
@joa-quim

joa-quim commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

The things I don't like in these fixes is that we risk to be changing things that did not need to be changed before if this issue was introduced by recent changes in modern mode (as I snif). That is why I said in the issue page that it would be good to check is this is not a newly created bug.

A good indication of it is to see if a classic mode script shows/or not the bug

@Esteban82

Copy link
Copy Markdown
Member Author

The things I don't like in these fixes is that we risk to be changing things that did not need to be changed before if this issue was introduced by recent changes in modern mode (as I snif). That is why I said in the issue page that it would be good to check is this is not a newly created bug.

Claude says it's an old issue:

I traced it back: this is not a consequence of the recent modern-mode or transparency fixes (#8882, #9126). GMT 6.6.0 shows the same leak, in both modern and classic (-K -O) mode. The cause is older: with a transparent -G, psxy/psxyz paint the -Sl text via PSL_setcolor(..., PSL_IS_FILL), which emits a global PSL_transp that nothing undoes (PSL_endplot only resets it for a transparent stroke). Other filled symbols use the fs procedure, which keeps the transparency inside gsave/grestore. The fix paints transparent text the same way.

@joa-quim joa-quim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

OK, I checked that Claude was right about the versions.

With a transparent fill, the -Sl text was painted via PSL_setcolor, which sets
a global PSL_transp that is never undone, so -Gred@50 leaked into all later
layers and subplot panels. Paint such text via fs instead (PSL_plottext mode 2),
like other filled symbols, so the transparency stays inside V...U. This also
fixes transparent text fills from segment headers being drawn black.

Fixes #9234

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Esteban82

Copy link
Copy Markdown
Member Author

I made a commit to solve the confict.

The last command of the loop was a grep that exits 1 when the check passes,
so gmtest's ERR trap flagged the test as failed even with an empty fail file.
Use an if instead. Also match a global PSL_transp anywhere on the line and
for any blend mode, since older PSL emitted it after the color (e.g.,
"1 0 0 C 0.5 0.5 /Normal PSL_transp").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Esteban82

Copy link
Copy Markdown
Member Author

Now that the test/psxy/text_symbol_transparency.sh passed I will merge it.

@Esteban82
Esteban82 merged commit 94edf8b into master Oct 1, 2026
16 of 19 checks passed
@Esteban82
Esteban82 deleted the fix-9234 branch October 1, 2026 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

add-changelog Add PR to the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Semi-transparency in case of plot -Sl affects all following plotting elements

2 participants