13#include "RConfigure.h"
32 ::Error(
"TASUtils::GetPixmap",
"Not implemented, ASImage is not compiled");
38 ::Error(
"TASUtils::GetMask",
"Not implemented, ASImage is not compiled");
44 ::Error(
"TASUtils::PaintImage",
"Not implemented, ASImage is not compiled");
50 ::Error(
"TASUtils::FillImageFromWindow",
"Not implemented, ASImage is not compiled");
56 ::Error(
"TASUtils::FromWindow",
"Not implemented, ASImage is not compiled");
62 ::Error(
"TASUtils::FromPixmap",
"Not implemented, ASImage is not compiled");
75 thread_local struct ASHolder {
76 ASVisual *fVisual =
nullptr;
93 return holder.fVisual;
111 ::Error(
"TASUtils::GetPixmap",
"Image not provided");
118 auto asimg =
dynamic_cast<TASImage *
>(timg);
120 ::Warning(
"TASUtils::GetPixmap",
"ASImage not provided");
124 ASImage *img = asimg->fScaledImage ? asimg->fScaledImage->fImage : asimg->fImage;
131 ::Error(
"TASUtils::GetPixmap",
"ARGB array is not exists");
148 std::vector<char> bits;
151 ::Error(
"TGWindow::GetImageMask",
"Image not provided");
163 auto asimg =
dynamic_cast<TASImage *
> (img);
168 asimg->DestroyScaledImage();
185 ::Error(
"TASUtils::FillImageFromWindow",
"Fail to extract color bits for specified window");
192 if (!asimg->IsValid())
211 auto asimg = std::make_unique<TASImage>();
224 auto asimg = std::make_unique<TASImage>();
243 asimg->FromBitmap(bits,
w,
h, mask_bits);
250 if (!asimg->IsValid())
261 auto asimg =
dynamic_cast<TASImage *
>(timg);
263 ::Warning(
"TASUtils::PaintImage",
"Image not provided");
272 UInt_t mwidth = 0, mheight = 0;
273 std::vector<char> bits;
274 if (asimg->GetMaskBits(mwidth, mheight, bits))
294 ASImage *im = asimg->fScaledImage ? asimg->fScaledImage->fImage : asimg->fImage;
300 auto argb = asimg->GetArgbArray();
Handle_t Pixmap_t
Pixmap handle.
const Mask_t kGCClipXOrigin
Handle_t Window_t
Window handle.
Handle_t GContext_t
Graphics context handle.
Handle_t Drawable_t
Drawable handle.
const Mask_t kGCClipYOrigin
bool Bool_t
Boolean (0=false, 1=true) (bool)
int Int_t
Signed integer 4 bytes (int)
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t mask
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize wid
Option_t Option_t TPoint xy
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void pxm
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
R__EXTERN TSystem * gSystem
R__EXTERN Int_t(* gThreadXAR)(const char *xact, Int_t nb, void **ar, Int_t *iret)
static ASImage * Picture2ASImage(struct ASVisual *visual, Pixmap_t pxm, Pixmap_t mask, UInt_t width, UInt_t height)
Convert picture (X11 pixmap with mask) to ASImage For internal use in TASUtils class.
static void ASImage2Drawable(struct ASVisual *visual, ASImage *image, Drawable_t wid, GContext_t gc, Int_t xsrc, Int_t ysrc, Int_t x, Int_t y, UInt_t width, UInt_t height)
Output ASImage on X11 drawable For internal use in TASUtils class.
static ASImage * Pixmap2ASImage(struct ASVisual *visual, Window_t wid, Int_t x, Int_t y, UInt_t width, UInt_t height)
Convert region of X11 window to ASImage For internal use in TASUtils class.
void DestroyImage()
Destroy image.
static struct ASVisual * CreateX11Visual(Display_t display, Int_t screen, Int_t depth, Visual_t visual, Colormap_t cmap)
Create ASVisual for X11 display For internal use in TASUtils class.
static Pixmap_t ASImage2Pixmap(struct ASVisual *visual, Window_t root_window, ASImage *image)
Convert ASImage to pixmap for X11 For internal use in TASUtils class.
static void DestroyVisual(struct ASVisual *visual)
Destroy ASVisual for X11 display For internal use in TASUtils class.
static Pixmap_t GetPixmap(TImage *timg)
Returns image pixmap.
static std::unique_ptr< TImage > FromWindow(Window_t wid)
Create an image from the given window.
static Bool_t FillImageFromWindow(TImage *img, Window_t wid, Int_t width, Int_t height)
Create an image from the given window.
static Bool_t PaintImage(TImage *timg, Drawable_t wid, Int_t x, Int_t y, Bool_t opaque=kFALSE)
Paint image on specified window.
static Pixmap_t GetMask(TImage *timg)
Returns image mask pixmap (alpha channel).
static std::unique_ptr< TImage > FromPixmap(Pixmap_t pxm, Pixmap_t mask)
Create image from pixmap.
static struct ASVisual * GetX11Visual()
An abstract interface to image processing library.
virtual Bool_t GetMaskBits(UInt_t &, UInt_t &, std::vector< char > &)
virtual UInt_t GetScaledWidth() const
virtual UInt_t * GetArgbArray()
virtual UInt_t GetScaledHeight() const
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
Graphics context structure.
Pixmap_t fClipMask
bitmap clipping; other calls for rects
Int_t fClipXOrigin
origin for clipping
Mask_t fMask
bit mask specifying which fields are valid