Skip to content

[image] refactor FromWindow(), GetPixmap(), GetMask() methods - #23717

Open
linev wants to merge 12 commits into
root-project:masterfrom
linev:image_fromwindow
Open

linev wants to merge 12 commits into
root-project:masterfrom
linev:image_fromwindow

Conversation

@linev

@linev linev commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

These are very special methods for use with TVirtualX-based windows.
While we want to make TASImage fully free of gVirtualX - one need to move such special code outside.
At the same time libASImage has special X11 support which need to be used.

Therefore.

  1. Introduce special TASImage::GetX11Pixmap() method which only can be used on platforms with X11 support.
  2. Introduce TGWindow::GetImagePixmap() and TGWindow::GetImageMask() which take gVirtualX-specific logic
  3. Provide several new methods for TImage to make it possible. These new methods are:
    • TImage::GetMaskBits() - extract alpha channel from image
    • TImage::GetScaledWidth() - just make virtual, was existing already in TASImage class
    • TImage::GetScaledHeight() - just make virtual, was existing already in TASImage class
    • TImage::GetX11Pixmap() - only usable on X11
  4. Provide TGWindow::CreateImageFromWindow() method - replacing TImage::FromWindow() functionality
  5. In all places replace usage of old image methods by new TGWindow methods
  6. Declare old methods deprecated then

linev added 2 commits October 14, 2026 14:06
Method create TImage instance with screenshot of the window.
It should replace TASImage::FromWindow functionality to avoid
direct usage of gVirtualX methods in TASImage
It extract alpha channel from the image and prepares data for
TVirtualX::CreateBitmap(). Idea to use such bitmap later
in the GUI classes where it really required
@linev linev self-assigned this Oct 14, 2026
@linev
linev marked this pull request as draft October 14, 2026 13:12
linev added 10 commits October 14, 2026 16:37
It is direct method for X11-based platforms to create
pixmap object from the image. Idea to use it outside
of TASImage and avoid gVirtualX interfaces.

Add deprecated mark to docu for TASImage::GetPixmap()
because it will disappear in the ROOT7
Methods already exists in TASImage, but now also define them
as virtual in TImage class.

One gets access to dimension of array returned with GetArgbArray() method,
was not possible before
This should be replacement for correspondent TImage methods,
but use of gVirtualX will be moved to GUI classes.
exec_macro.C is utility to create image file for the different gui tests.
So it is very good test if method works in many different situations.

Also use it directly in stressGUI.cxx
Instead of img->FromWindow().
In one place pixmap was created twice
Anyway, deprecated code...
GetPixmap(), GetMask() and FromWindow() are now moved to TGWindow class
and can be used from there if necessary.

Methods will be removed in ROOT 7
@linev
linev marked this pull request as ready for review October 14, 2026 14:48
@bellenot

Copy link
Copy Markdown
Member

OK, I want to try it on Windows locally first.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Test Results

    24 files      24 suites   4d 7h 34m 44s ⏱️
 3 889 tests  3 857 ✅ 0 💤 32 ❌
83 209 runs  83 149 ✅ 0 💤 60 ❌

For more details on these failures, see this check.

Results for commit 953b13e.

♻️ This comment has been updated with latest results.

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants