[virtualx/pad] fix pad opacity, support fill styles 4000..4100 on all platforms#21924
Open
linev wants to merge 23 commits intoroot-project:masterfrom
Open
[virtualx/pad] fix pad opacity, support fill styles 4000..4100 on all platforms#21924linev wants to merge 23 commits intoroot-project:masterfrom
linev wants to merge 23 commits intoroot-project:masterfrom
Conversation
Test Results 22 files 22 suites 3d 6h 34m 36s ⏱️ For more details on these failures, see this check. Results for commit 4035843. ♻️ This comment has been updated with latest results. |
CopyPixmap and SetOpacity methods
couet
approved these changes
Apr 17, 2026
Global gCws context was used Provide short docu for new methods
Let use window context when calling these methods. These are central methods to emulate pad opacity without real support of alpha channel in X11
There are several pad fill attributes which only relevant for pad. It is fill style 4000..4100 or fillcolor 10 for fillstyle 3000..3100 Move all these special attribute only to TPad::PaintBorder to exclude misuse of these attributes in different classes
On these platforms transparency can be used as is so just transform to painting with transparent colors Special handling of 4000 - do nothing.
It will be used internally in derived classes to transform fill attributes in convenient format with color opacity
Handle them as transparent colors
So any object with such styles can use it
In case of Cocoa use normal color opacity
Before only fill style 4000..4100 was supported by TPad Now make special handling for plain X11, for all other platforms and all other classes like TBox support 4000..4100 fill styles as color transparency
No need for special handling of TPadPainterPS - all pad painters handle fill style for the box in same way
Now these are valid styles for all kind of objects
Shows styles 4000..4100 which now works similar on all platforms On X11 only emulation mode is working - any solid painting inside pad will ignore pad opacity
Now sequence of operation vary a bit therefore produced by web canvas code is slightly different
In previos implementation just white color with provided opacity was add - making effect absolutely "invisible" Now pad fill color is used. And - original colors reduced by transparency. As a result If opacity 90% original image will remain by 10%. This was fully ignored by original algorithms and therefore opacity did not really work
Before just white color was used.
One can use std::vector for same functionality
Use std::vector<ULong_t> to keep new colors which are created for opacity emulation. Move MakeOpaqueColors directly to SetOpacityW method. Significantly simplify code
Same as in TGX11, mix existing and pad fill color with "100-pecent" and "percent" proportion. Use everywhere std::vector to manage colors. Remove several no longer used methods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First extend
TVirtualXinterface to use window context forCopyPixmapandSetOpacitymethods.These two methods used to emulate transparency of the sub-pads on X11.
Therefore provide
SetOpacityWandCopyPixmapWmethods for all platforms.And use these methods from
TPadPainterclass.FIX ancient ROOT code for pad opacity. Colors arithmetic was wrong! Old code was:
New code is:
After such fix created image looks very similar to GL-based rendering:
TGLPadPainteruse absolutely different approach and not invoke these methods directlyMove X11 pads transparency handling with fill styles 4000..4100 in
TPad::PaintBorder()method.And remove all pad-related handling from
TPad::PaintBox()- now it will be normal box painting for all other primitives. Clear logic there.Provide generic support of 4000..4100 fill styles for all platforms - GL/SVG/PDF/PS/Web/X11.
If true colors transparency supported - used it (like in SVG or GL). If not supported - ignore it (like in X11).
Any object like
TBoxcan now be configured with fill style 4050 and become semi-transparent everywhere where it possible.Adjust
transparentpad.Cdemo to show exactly this new features withTPadandTPaveStats.