Display model reports the wrong background color for text drawn in transparent mode #6467

Closed
mwcampbell opened this Issue Oct 15, 2016 · 5 comments

Comments

Projects
None yet
5 participants
@mwcampbell
Contributor

mwcampbell commented Oct 15, 2016

When text is written with the GDI background mode set to transparent, the display model doesn't necessary report the correct background color for that text. In this case, the GDI hook should look at the actual background color before the text is drawn, rather than using the result of GetBkColor.

@michaelDCurran

This comment has been minimized.

Show comment
Hide comment
@michaelDCurran

michaelDCurran Oct 16, 2016

Contributor

Our displayModel currently only records chunks of text. If a fill or other non-text drawing action occurs, any existing text in its path is simply removed from the model. Thus the only background color info we have currently is from written text. I'm assuming you mean we should actually track other non-text drawing actions, including its background and foreground color, so that if a drawing action such as text has a transparent color we can inherit the background color from the existing chunk?

This would be a large project. What is the impact of this (taking into account GDI becoming less used anyway)?

Contributor

michaelDCurran commented Oct 16, 2016

Our displayModel currently only records chunks of text. If a fill or other non-text drawing action occurs, any existing text in its path is simply removed from the model. Thus the only background color info we have currently is from written text. I'm assuming you mean we should actually track other non-text drawing actions, including its background and foreground color, so that if a drawing action such as text has a transparent color we can inherit the background color from the existing chunk?

This would be a large project. What is the impact of this (taking into account GDI becoming less used anyway)?

@mwcampbell

This comment has been minimized.

Show comment
Hide comment
@mwcampbell

mwcampbell Oct 17, 2016

Contributor

I don't think you need anything that complex. Before you call the original GDI TextOut or ExtTextOut function, you can just use GetPixel to get the color at the specified X/Y coordinates. That would be good enough for my purpose, at least.

This impacts my ability to make Dragon NaturallySpeaking fully accessible as part of the DictationBridge project. Specifically, Dragon has some custom list views where I can't yet track the highlighted item because NVDA thinks the background color of all the text in the list view is white.

Contributor

mwcampbell commented Oct 17, 2016

I don't think you need anything that complex. Before you call the original GDI TextOut or ExtTextOut function, you can just use GetPixel to get the color at the specified X/Y coordinates. That would be good enough for my purpose, at least.

This impacts my ability to make Dragon NaturallySpeaking fully accessible as part of the DictationBridge project. Specifically, Dragon has some custom list views where I can't yet track the highlighted item because NVDA thinks the background color of all the text in the list view is white.

@michaelDCurran

This comment has been minimized.

Show comment
Hide comment
@michaelDCurran

michaelDCurran Oct 17, 2016

Contributor

If the background contained some kind of pattern or image then it may
not be accurate. However, I agree that is better than just transparent.

I will look into it at some point, though if you need it quicker I'll
certainly review a submitted pull request.

Contributor

michaelDCurran commented Oct 17, 2016

If the background contained some kind of pattern or image then it may
not be accurate. However, I agree that is better than just transparent.

I will look into it at some point, though if you need it quicker I'll
certainly review a submitted pull request.

@michaelDCurran michaelDCurran added the p3 label Oct 17, 2016

@nvaccessAuto nvaccessAuto added this to the 2017.2 milestone Mar 14, 2017

jcsteh added a commit that referenced this issue Jun 7, 2017

Revert "Display model: Try to provide the correct background color fo…
…r transparent text drawing (#6844)"

This has been confirmed by several users as causing severe performance regressions in certain apps.
This reverts commit 29efeda.
Fixes #7251. Reverts PR #6844. Reopens issue #6467.

@jcsteh jcsteh removed this from the 2017.2 milestone Jun 7, 2017

@jcsteh

This comment has been minimized.

Show comment
Hide comment
@jcsteh

jcsteh Jun 7, 2017

Contributor

This was reverted in 47337ef due to severe performance regressions; see #7251.

Contributor

jcsteh commented Jun 7, 2017

This was reverted in 47337ef due to severe performance regressions; see #7251.

@jcsteh jcsteh reopened this Jun 7, 2017

@josephsl

This comment has been minimized.

Show comment
Hide comment
@josephsl

josephsl Jul 24, 2017

Collaborator

Hi,

@michaelDCurran, attached is the path that Matt should have sent as an official PR, but looks like it didn't make it through. I'm attaching in in case you'd like to review it and let Jamie or someone commit this. Thanks.
displayModel-attempted-fix.txt

Collaborator

josephsl commented Jul 24, 2017

Hi,

@michaelDCurran, attached is the path that Matt should have sent as an official PR, but looks like it didn't make it through. I'm attaching in in case you'd like to review it and let Jamie or someone commit this. Thanks.
displayModel-attempted-fix.txt

michaelDCurran added a commit that referenced this issue Jul 25, 2017

Display model: Try to provide the correct background color for transp…
…arent text drawing (#6844)

* GDI hooks: In the TextOut and ExtTextOut functions, get the previous color at the provided X, Y coordinates before calling the original function, so we at least have a chance of knowing the correct background color if the text is being drawn in transparent mode. This is necessary to detect highlighted text in some parts of Dragon NaturallySpeaking.

Fixes #6467

@nvaccessAuto nvaccessAuto added this to the 2017.4 milestone Aug 29, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment