Skip to content

Redesign TASImage::Paint() - #23246

Merged
linev merged 13 commits into
root-project:masterfrom
linev:pp_image_paint
Sep 4, 2026
Merged

Redesign TASImage::Paint()#23246
linev merged 13 commits into
root-project:masterfrom
linev:pp_image_paint

Conversation

@linev

@linev linev commented Sep 3, 2026

Copy link
Copy Markdown
Member

Radical paradigm change.

Now image painting delegated to pad painter instance, which knows better
details of the platform. Thus lot of magic around gVirtualX, gVirtualPS, gPad->GetGLDevice()
completely vanishes and move to correspondent back-end. Extra palette painting made very simple.

Special implementation provided for:

  • gVirtualX and TGX11 in TPadPainter
  • GL support in TGLPadPainter
  • SVG, PS, PDF, ImageDump via TPadPainterPS

Simplify TASImage::PaintImage method which used for painting only on regular gVirtualX devices.
Remove GL support there.

New approach opens possibility to provide image painting for
any external platforms like Qt6 or Gtk4 or any other

Later one can remove old ugly API from TVirtualPS:

   virtual void  CellArrayBegin(Int_t W, Int_t H, Double_t x1, Double_t x2, Double_t y1, Double_t y2) = 0;
   virtual void  CellArrayFill(Int_t r, Int_t g, Int_t b) = 0;
   virtual void  CellArrayPng(char * /* buffer */, int /* size */) {}
   virtual void  CellArrayEnd() = 0;

and from TVirtualPadPainter:

   virtual void     DrawPixels(const unsigned char *pixelData, UInt_t width, UInt_t height,
                               Int_t dstX, Int_t dstY, Bool_t enableAlphaBlending) = 0;

This was last hard place with complex dependency from gVirtualX ,

These classes should handle image drawing directly without complex
logic in TASImage::Paint method.
Now it is just entry points
Just call Merge for target image
Instead calling 4 different methods,
just create PNG buffer and embed it into SVG file. Make implementation straight-forward
@linev linev self-assigned this Sep 3, 2026
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

Test Results

    22 files      22 suites   3d 8h 59m 43s ⏱️
 3 869 tests  3 868 ✅ 0 💤 1 ❌
75 048 runs  75 041 ✅ 6 💤 1 ❌

For more details on these failures, see this check.

Results for commit d8ab7ae.

♻️ This comment has been updated with latest results.

linev added 10 commits September 4, 2026 06:59
Simplify logic how image placed in the PDF file
Old API was not clear enough for that
Use correct coordinates calculations to properly
scale image from pixel to PS coordinates

Partially use old API - until old will be deprecated
Redirect to fPS instance, recalculate to global coordinates
while all image formats operate with global coordinates
Simple redirection to existing DrawPixels method,
can be eliminated in the future while only used from ASImage
Use gVirtualX-based code like in original Image2Drawable method
of TASImage. There are now several shortcuts,
therefore methods looks much simpler. Also GL handling will be implemented
in correspondent painter
Radical paradigm change.

Now image painting delegated to pad painter instance, which knows better
details of platform. Thus lot of magic around virtualX, virtualPS, GL
completely vanishes.

Extra palette painting made very simple and works exactly the same as
image painting itself plut TGaxis.

Special implementation provided for:
   - gVirtualX and TGX11 in TPadPainter
   - GL support in TGLPadPainter
   - SVG, PS, PDF, ImageDump via TPadPainterPS

New approach opens possibility to provide image painting for
any external platforms like Qt6 or Gtk4 or any other
Remove support of the GL - while it now handles in TGLPadPainter
Simplify several places
After change in TASImage::Paint there are minimal
changes in scaling/offset because of different rounding

Therefore in SVG file image offset changed sometime by one pixel
or scaling factor by 0.1%.
After change code to TTFhandle wrong align was applied. One should use 13 instead 11
When image object drawn on the pad - just use
pp->DrawImage(). It is natural way now.
@linev
linev merged commit 2852d05 into root-project:master Sep 4, 2026
30 of 34 checks passed
@linev
linev deleted the pp_image_paint branch September 4, 2026 09:31
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