Skip to content

[colors] remove dependency from gVirtualX - #24279

Open
linev wants to merge 15 commits into
root-project:masterfrom
linev:move_colors
Open

linev wants to merge 15 commits into
root-project:masterfrom
linev:move_colors

Conversation

@linev

@linev linev commented Nov 20, 2026

Copy link
Copy Markdown
Member

TColor class has many methods which directly invokes gVirtualX methods.
Most of these methods about pixel->RGB and RGB->pixel conversion.
All such static methods moved now to TVirtualX class and used from ROOT classes.
These are:

   static ULong_t RGB2Pixel(Int_t r, Int_t g, Int_t b);
   static ULong_t RGB2Pixel(Float_t r, Float_t g, Float_t b);
   static void    Pixel2RGB(ULong_t pixel, Int_t &r, Int_t &g, Int_t &b);
   static void    Pixel2RGB(ULong_t pixel, Float_t &r, Float_t &g, Float_t &b);
   static TString PixelAsHexString(ULong_t pixel);
   static ULong_t Number2Pixel(Int_t ci);
   static Int_t   Pixel2Number(ULong_t pixel);

Correspondent methods in TColor now marked as deprecated and will be removed in ROOT7.

In GUI and GL classes replace all ocasions by new TVirtualX calls.

There is one workaround for keep support of TVirtualX functionality.
TVirtualX need to assign update handler which is called when color instance is changed
This handler assigned immediately after display is initialized.
Functionality is private and only can be accessed by TVirtualX class (declatred as friend).
In ROOT7 one can decide to remove this - while live change of colors only was
crucial for displays with low color resolution.

linev added 15 commits November 20, 2026 18:04
These methods using gVirtualX for pixel -> rgb and rgb -> pixel conversion

In ROOT7 all gVirtualX - related methods need to be removed from Core libraries
Methods from TColor will be deprecated and removed in ROOT7
Pixels are only relevant for the TVirtualX instances - therefore
change makes it clear where TVirtualX is used
It converts pixel to color number and should replace
TColor::GetColor(pixel) method.

As in previous methods, TColor method will be deprecated in ROOT7
Replace TColor::GetColor(pixel) calls
To be checked why used in REVE
Replace TColor::GetColor(pixel) calls
To be checked why used in REVE
While this methods uses gVirtualX - it was moved to TVirtualX
and replaced in all places
TColor::GetPixel() forces graphics initialization which is
really big overhead and will be removed in ROOT7
It includes application and colors initialisation inside Number2Pixel method
It redirects to gVirtualX method and better should be used directly via gVirtaulX instance. All usage in ROOT already was removed
It configures actual number of color planes and assign callback function
which is invoked when color will be updated.

Make private and only available for TVirtualX class - just to decouple
last dependency between gVirtualX and TColor
Simple callback to update color instance
In all TVirtualX implementations configure colors handler
immediately after display is intitialized.
Allows "on-the-fly" update colors
TVirtualX has to initialize handler and planes number when calling OpenDisplay
This handler invoked when color is changes - in private Allocate() method

In ROOT7 one can fully remove TVirtualX usage then
@github-actions

Copy link
Copy Markdown

Test Results

    22 files      22 suites   3d 12h 51m 16s ⏱️
 3 944 tests  3 944 ✅ 0 💤 0 ❌
77 292 runs  77 292 ✅ 0 💤 0 ❌

Results for commit 6cbe155.

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.

1 participant