Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

silx.gui.plot.PlotWidget: Improved text background rendering for OpenGL backend #4034

Merged
merged 2 commits into from
Jan 8, 2024

Conversation

t20100
Copy link
Member

@t20100 t20100 commented Dec 21, 2023

Alternative implementation of PR #4011

This PR adds padding around text displayed by markers for the display of borders.
Instead of relying on 2 rendering as in PR #4011, it plays with the texture coordinates.

@t20100 t20100 added this to the 2.0.0 milestone Dec 21, 2023
@t20100 t20100 requested a review from vallsv December 21, 2023 14:04
@@ -907,7 +912,7 @@ def _lineStyleToDashOffsetPattern(
pattern = ()
if len(pattern) == 2:
pattern = pattern * 2
return offset, pattern
return float(offset), tuple(float(v) for v in pattern)
Copy link
Member Author

Choose a reason for hiding this comment

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

Not related to this PR but missing from adding int as a accepted type for line style.

Comment on lines +307 to +310
texCoords = numpy.array(
(
(-xoffset, -yoffset),
(1.0 + xoffset, -yoffset),
(-xoffset, 1.0 + yoffset),
(1.0 + xoffset, 1.0 + yoffset),
),
dtype=numpy.float32,
Copy link
Member Author

Choose a reason for hiding this comment

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

Extends texture coordinates, what's <0 or >1 is rendered with bgColor.

@vallsv vallsv merged commit 32bb9b0 into silx-kit:main Jan 8, 2024
6 of 7 checks passed
@t20100 t20100 deleted the gl-text-padding branch January 15, 2024 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants