Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/base/inc/TVirtualPadPainter.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ class TVirtualPadPainter {


//TASImage support.
virtual void DrawPixels(const unsigned char *pixelData, UInt_t width, UInt_t height,
Int_t dstX, Int_t dstY, Bool_t enableAlphaBlending) = 0;
virtual void R__DEPRECATED(7,00, "Use DrawImage instead") DrawPixels(const unsigned char * /* pixelData */, UInt_t /* width */, UInt_t /* height */,
Int_t /* dstX */, Int_t /* dstY */, Bool_t /* enableAlphaBlending */) {}
//
//These functions are not required by X11/GDI.
virtual void InitPainter();
Expand Down
5 changes: 5 additions & 0 deletions etc/plugins/TVirtualPadPainter/P020_TPadPainter.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
void P020_TPadPainter()
{
gPluginMgr->AddHandler("TVirtualPadPainter", "native", "TPadPainter",
"ROOTPadPainter", "TPadPainter()");
}
1 change: 1 addition & 0 deletions graf2d/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ endif()
if(asimage)
add_subdirectory(asimage) # special CMakeLists.txt
endif()
add_subdirectory(padpainter)
if(gviz)
add_subdirectory(gviz)
endif()
Expand Down
17 changes: 17 additions & 0 deletions graf2d/asimage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,23 @@ if (x11)
target_link_libraries(ASImage PRIVATE X11::X11)
endif()

ROOT_STANDARD_LIBRARY_PACKAGE(ASImageUtils
NO_INSTALL_HEADERS
HEADERS
TASUtils.h
SOURCES
TASUtils.cxx
LINKDEF
LinkDefUtils.h
DICTIONARY_OPTIONS
-writeEmptyRootPCM
LIBRARIES
libAfterImage
DEPENDENCIES
ASImage
Gpad
)

ROOT_STANDARD_LIBRARY_PACKAGE(ASImageGui
NO_INSTALL_HEADERS
HEADERS
Expand Down
19 changes: 19 additions & 0 deletions graf2d/asimage/inc/LinkDefUtils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* @(#)root/asimage:$Id$ */

/*************************************************************************
* Copyright (C) 1995-2026, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms seeg $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/

#ifdef __CLING__

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ class TASUtils;

#endif
12 changes: 9 additions & 3 deletions graf2d/asimage/inc/TASImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@ struct ASVisual;
class TBrowser;
class THashTable;
class TTFhandle;
class TASPaletteEditor;
class TASUtils;

class TASImage : public TImage {

friend class TASPaletteEditor; // to access FromGradient method
friend class TASUtils; // to implement gVirtualX-specific methods

private:
enum { kNoZoom = 0, kZoom = 1, kZoomOps = -1 };
enum { kReadWritePNG, kReadWriteVector };
Expand Down Expand Up @@ -72,16 +77,19 @@ class TASImage : public TImage {
static THashTable *fgPlugList; ///<! hash table containing loaded plugins

static ASVisual *fgVisual; ///< pointer to visual structure
static ASVisual *fgBatchVisual; ///< pointer to "batch" visual structure
static Bool_t fgInit; ///< global flag to init afterimage only once
static Bool_t fgBatch; ///< global flag to signal if batch mode is active ie fgVisual->dpy was set to nullptr

EImageFileTypes GetFileType(const char *ext);
void MapFileTypes(EImageFileTypes &type, UInt_t &astype, Bool_t toas = kTRUE);
void MapQuality(EImageQuality &quality, UInt_t &asquality, Bool_t toas = kTRUE);

static Bool_t InitVisual();
static ASVisual *InitVisual(Bool_t plain = kFALSE);
Bool_t InitImage(const char *caller);

void FromGradient(struct ASGradient *as_gradient, UInt_t width, UInt_t height);

public:
TASImage();
TASImage(UInt_t w, UInt_t h);
Expand All @@ -104,7 +112,6 @@ class TASImage : public TImage {

void FromBitmap(const UChar_t *buf, UInt_t width, UInt_t height) override;
void FromPad(TVirtualPad *pad, Int_t x = 0, Int_t y = 0, UInt_t w = 0, UInt_t h = 0) override;
void FromX11Window(Window_t win , Int_t x, Int_t y, Int_t width, Int_t height) override;
void FromWindow(Drawable_t wid, Int_t x = 0, Int_t y = 0, UInt_t w = 0, UInt_t h = 0) override;
void FromGLBuffer(UChar_t *buf, UInt_t width, UInt_t height) override;

Expand Down Expand Up @@ -193,7 +200,6 @@ class TASImage : public TImage {
ASImage *GetImage() const { return fImage; }
void SetImage(ASImage *image) { DestroyImage(); fImage = image; }
TImage *GetScaledImage() const override { return fScaledImage; }
Pixmap_t GetX11Pixmap(Window_t root_window) override;
Pixmap_t GetPixmap() override;
Bool_t GetMaskBits(UInt_t &width, UInt_t &height, std::vector<char> &bits) override;
Pixmap_t GetMask() override;
Expand Down
41 changes: 41 additions & 0 deletions graf2d/asimage/inc/TASUtils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// @(#)root/asimage:$Id$
// Author: Sergey Linev 16/10/2026

/*************************************************************************
* Copyright (C) 1995-2026, Rene Brun and Fons Rademakers *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/

#ifndef ROOT_TASUtils
#define ROOT_TASUtils

//////////////////////////////////////////////////////////////////////////
// //
// TASUtils //
// //
// Extra functions for TASImage requiring gVirtualX and X11 usage //
// //
//////////////////////////////////////////////////////////////////////////

#include "Rtypes.h"
#include "GuiTypes.h"
#include <memory>

class TImage;

class TASUtils {
Comment thread
silverweed marked this conversation as resolved.
public:
static Pixmap_t GetPixmap(TImage *timg);
static Pixmap_t GetMask(TImage *timg);

static Bool_t PaintImage(TImage *timg, Drawable_t wid, Int_t x, Int_t y, Bool_t opaque = kFALSE);
static Bool_t FillImageFromWindow(TImage *img, Window_t wid, Int_t width, Int_t height);

static std::unique_ptr<TImage> FromWindow(Window_t wid);
static std::unique_ptr<TImage> FromPixmap(Pixmap_t pxm, Pixmap_t mask);
};

#endif
Loading
Loading