52#include <X11/cursorfont.h>
53#include <X11/keysym.h>
62# include <sys/socket.h>
80 int,
int,
char*,
int);
168 EnterWindowMask | LeaveWindowMask |
169 PointerMotionMask | KeyPressMask |
172 EnterWindowMask | LeaveWindowMask;
1780x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1790x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1800x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
282 fXEvent = org.fXEvent; org.fXEvent =
nullptr;
283 fColors = org.fColors; org.fColors =
nullptr;
304 while (it.
Next(key, value)) {
347 if (XAllocColor((Display*)
fDisplay, cmap, color))
364 XQueryColors((Display*)
fDisplay, cmap, color, ncolors);
367 for (
Int_t i = 0; i < ncolors; i++) {
377 color[i].flags = DoRed | DoGreen | DoBlue;
400 if (!ctxt->fIsPixmap && !ctxt->fDoubleBuffer) {
401 XSetWindowBackground((Display*)
fDisplay, ctxt->fDrawing,
GetColor(0).fPixel);
402 XClearWindow((Display*)
fDisplay, ctxt->fDrawing);
406 XFillRectangle((Display*)
fDisplay, ctxt->fDrawing, ctxt->fGClist[
kGCpxmp],
407 0, 0, ctxt->fWidth, ctxt->fHeight);
428 if (!
gCws->fNewColors.empty()) {
431 gCws->fNewColors.clear();
434 if (!
gCws->fShared) {
443 for (
int i = 0; i <
kMAXGC; ++i)
446 if (
gCws->fillPattern != 0) {
448 gCws->fillPattern = 0;
454 if (iter->second.get() ==
gCws) {
461 Fatal(
"CloseWindow",
"Not found gCws in list of windows");
465 if (iter->second && iter->second->fOpen) {
466 gCws = iter->second.get();
508 XDrawRectangle((Display*)
fDisplay, ctxt->fDrawing, ctxt->fGClist[
kGCline],
x,
y, w,
h);
512 XFillRectangle((Display*)
fDisplay, ctxt->fDrawing, ctxt->fGClist[
kGCfill],
x,
y, w,
h);
534 int i, j, icol, ix, iy, w,
h, current_icol;
541 for (i = 0; i < nx; i++) {
543 for (j = 0; j < ny; j++) {
545 if (icol != current_icol) {
578 if (ctxt->fillHollow)
579 XDrawLines((Display*)
fDisplay, ctxt->fDrawing, ctxt->fGClist[
kGCfill], xyp,
n, CoordModeOrigin);
582 XFillPolygon((Display*)
fDisplay, ctxt->fDrawing, ctxt->fGClist[
kGCfill],
583 xyp,
n, Nonconvex, CoordModeOrigin);
608 if (ctxt->lineStyle == LineSolid)
609 XDrawLine((Display*)
fDisplay, ctxt->fDrawing, ctxt->fGClist[
kGCline], x1, y1, x2, y2);
611 XSetDashes((Display*)
fDisplay, ctxt->fGClist[
kGCdash], ctxt->dashOffset, ctxt->dashList.data(), ctxt->dashList.size());
612 XDrawLine((Display*)
fDisplay, ctxt->fDrawing, ctxt->fGClist[
kGCdash], x1, y1, x2, y2);
638 const Int_t kMaxPoints = 1000001;
640 if (
n > kMaxPoints) {
642 int iend = kMaxPoints - 1;
646 iend += kMaxPoints - 1;
653 if (ctxt->lineStyle == LineSolid)
654 XDrawLines((Display*)
fDisplay, ctxt->fDrawing, ctxt->fGClist[
kGCline], xyp,
n, CoordModeOrigin);
656 XSetDashes((Display*)
fDisplay, ctxt->fGClist[
kGCdash], ctxt->dashOffset, ctxt->dashList.data(), ctxt->dashList.size());
657 XDrawLines((Display*)
fDisplay, ctxt->fDrawing, ctxt->fGClist[
kGCdash], xyp,
n, CoordModeOrigin);
660 for (
int i = 1; i <
n; i++) {
661 int dx = xyp[i].x - xyp[i-1].x;
662 int dy = xyp[i].y - xyp[i-1].y;
663 if (dx < 0) dx = - dx;
664 if (dy < 0) dy = - dy;
665 ctxt->dashOffset += dx > dy ? dx : dy;
667 ctxt->dashOffset %= ctxt->dashLength;
672 XDrawPoint((Display*)
fDisplay, ctxt->fDrawing,
673 ctxt->lineStyle == LineSolid ? ctxt->fGClist[
kGCline] : ctxt->fGClist[
kGCdash], px, py);
698 const Int_t kMaxSegments = 500000;
699 if (
n > kMaxSegments) {
701 Int_t iend = kMaxSegments;
708 if (ctxt->lineStyle == LineSolid)
709 XDrawSegments((Display*)
fDisplay, ctxt->fDrawing, ctxt->fGClist[
kGCline], (XSegment *) xy,
n);
711 XSetDashes((Display*)
fDisplay, ctxt->fGClist[
kGCdash], ctxt->dashOffset, ctxt->dashList.data(), ctxt->dashList.size());
712 XDrawSegments((Display*)
fDisplay, ctxt->fDrawing, ctxt->fGClist[
kGCdash], (XSegment *) xy,
n);
740 if ((ctxt->markerShape.size() == 0) && (ctxt->markerSize <= 0)) {
741 const int kNMAX = 1000000;
743 for (
int it=0;it<=nt;it++) {
745 XDrawPoints((Display*)
fDisplay, ctxt->fDrawing, ctxt->fGClist[
kGCmark], &xyp[it*kNMAX], kNMAX, CoordModeOrigin);
747 XDrawPoints((Display*)
fDisplay, ctxt->fDrawing, ctxt->fGClist[
kGCmark], &xyp[it*kNMAX],
n-it*kNMAX, CoordModeOrigin);
751 int r = ctxt->markerSize / 2;
752 auto &shape = ctxt->markerShape;
754 for (
int m = 0;
m <
n;
m++) {
755 if (ctxt->markerType == 0) {
758 xyp[
m].x -
r, xyp[
m].y -
r, ctxt->markerSize, ctxt->markerSize, 0, 360*64);
759 }
else if (ctxt->markerType == 1) {
762 xyp[
m].x -
r, xyp[
m].y -
r, ctxt->markerSize, ctxt->markerSize, 0, 360*64);
764 for (
size_t i = 0; i < shape.size(); i++) {
765 shape[i].x += xyp[
m].x;
766 shape[i].y += xyp[
m].y;
768 switch(ctxt->markerType) {
772 shape.data(), shape.size(), CoordModeOrigin);
776 XFillPolygon((Display*)
fDisplay, ctxt->fDrawing, ctxt->fGClist[
kGCmark],
777 shape.data(), shape.size(), Nonconvex, CoordModeOrigin);
781 XDrawSegments((Display*)
fDisplay, ctxt->fDrawing, ctxt->fGClist[
kGCmark],
782 (XSegment *) shape.data(), shape.size()/2);
785 for (
size_t i = 0; i < shape.size(); i++) {
786 shape[i].x -= xyp[
m].x;
787 shape[i].y -= xyp[
m].y;
844 if (!
text || !ctxt->textFont || ctxt->fAttText.GetTextSize() < 0)
853 ctxt->fDrawing, ctxt->fGClist[
kGCtext],
x,
y, (
char*)
text, (
int) ctxt->textAlign);
858 ctxt->fDrawing, ctxt->fGClist[
kGCtext],
x,
y, (
char*)
text, (
int) ctxt->textAlign);
873 Int_t findvis =
gEnv->GetValue(
"X11.FindBestVisual", 1);
876 if (((vis->c_class != TrueColor && vis->c_class != DirectColor) ||
882 {
nullptr, 0 , 0 , 24 , TrueColor , 0 , 0 , 0 , 0 , 0 },
883 {
nullptr, 0 , 0 , 32 , TrueColor , 0 , 0 , 0 , 0 , 0 },
884 {
nullptr, 0 , 0 , 16 , TrueColor , 0 , 0 , 0 , 0 , 0 },
885 {
nullptr, 0 , 0 , 15 , TrueColor , 0 , 0 , 0 , 0 , 0 },
887 {
nullptr, 0 , 0 , 24 , DirectColor, 0 , 0 , 0 , 0 , 0 },
888 {
nullptr, 0 , 0 , 32 , DirectColor, 0 , 0 , 0 , 0 , 0 },
889 {
nullptr, 0 , 0 , 16 , DirectColor, 0 , 0 , 0 , 0 , 0 },
890 {
nullptr, 0 , 0 , 15 , DirectColor, 0 , 0 , 0 , 0 , 0 },
891 {
nullptr, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },
896 for (
Int_t i = 0; templates[i].depth != 0; i++) {
897 Int_t mask = VisualScreenMask|VisualDepthMask|VisualClassMask;
899 if ((vlist = XGetVisualInfo((Display*)
fDisplay, mask, &(templates[i]), &nitems))) {
921 Printf(
"Selected visual 0x%lx: depth %d, class %d, colormap: %s",
941 Int_t (*oldErrorHandler)(Display *, XErrorEvent *) =
945 memset(&attr, 0,
sizeof(attr));
949 for (
Int_t i = 0; i < nitems; i++) {
951 UInt_t width, height, ujunk;
958 attr.colormap = XCreateColormap((Display*)
fDisplay, root, vlist[i].visual, AllocNone);
961 static XColor black_xcol = { 0, 0x0000, 0x0000, 0x0000, DoRed|DoGreen|DoBlue, 0 };
962 static XColor white_xcol = { 0, 0xFFFF, 0xFFFF, 0xFFFF, DoRed|DoGreen|DoBlue, 0 };
963 XAllocColor((Display*)
fDisplay, attr.colormap, &black_xcol);
964 XAllocColor((Display*)
fDisplay, attr.colormap, &white_xcol);
965 attr.border_pixel = black_xcol.pixel;
966 attr.override_redirect = True;
968 w = XCreateWindow((Display*)
fDisplay, root, -20, -20, 10, 10, 0, vlist[i].depth,
969 CopyFromParent, vlist[i].visual,
970 CWColormap|CWBorderPixel|CWOverrideRedirect, &attr);
971 if (w != None && XGetGeometry((Display*)
fDisplay, w, &wjunk, &junk, &junk,
972 &width, &height, &ujunk, &ujunk)) {
982 XFreeColormap((Display*)
fDisplay, attr.colormap);
984 XSetErrorHandler(oldErrorHandler);
1024 if (which >=
kMAXGC || which < 0) {
1025 Error(
"GetGC",
"trying to get illegal GC (which = %d)", which);
1029 Error(
"GetGC",
"No current window selected");
1032 return &
gCws->fGClist[which];
1042 return (
Window_t) (ctxt ? ctxt->fDrawing : 0);
1053 Error(
"GetGC",
"No window context specified");
1057 if (which >=
kMAXGC || which < 0) {
1058 Error(
"GetGC",
"trying to get illegal GC (which = %d)", which);
1061 return &ctxt->fGClist[which];
1081 return ctxt->fAttText;
1094 return gTws->fDoubleBuffer;
1117 unsigned int border, depth;
1118 unsigned int width, height;
1122 &width, &height, &border, &depth);
1124 0, 0, &
x, &
y, &junkwin);
1127 if (height >= 65535)
1129 if (width > 0 && height > 0) {
1130 gTws->fWidth = width;
1131 gTws->fHeight = height;
1143 return XDisplayName(dpyName);
1153 SetRGB(ci, color->GetRed(), color->GetGreen(), color->GetBlue());
1176 }
else if (index == 1) {
1196 if (!mess || !*mess)
1243 if (
fWindows.count(wid) == 0)
return 0;
1257 if (!
gTws->fOpen)
return;
1267 Pixmap pixmp1, pixmp2;
1287 strlcpy(vendor, XServerVendor((Display*)
fDisplay),132);
1293 if (strstr(vendor,
"Hewlett"))
1294 echov.function = GXxor;
1296 echov.function = GXinvert;
1299 GCForeground | GCBackground | GCFunction,
1303 static int isdisp = 0;
1306 gFont[i].id =
nullptr;
1309 fontlist = XListFonts((Display*)
fDisplay,
"*courier*", 1, &fontcount);
1310 if (fontlist && fontcount != 0) {
1315 XFreeFontNames(fontlist);
1318 fontlist = XListFonts((Display*)
fDisplay,
"fixed", 1, &fontcount);
1319 if (fontlist && fontcount != 0) {
1324 XFreeFontNames(fontlist);
1326 Warning(
"OpenDisplay",
"no default font loaded");
1363 if (
fVisual->c_class == TrueColor) {
1367 if ((
fVisual->blue_mask >> i) == 1) {
1375 if ((
fVisual->green_mask >> i) == 1) {
1383 if ((
fVisual->red_mask >> i) == 1) {
1404 if (!
pair.second->fOpen) {
1405 pair.second->fOpen = 1;
1408 if (
pair.first > maxid)
1412 if (
fWindows.size() == (
size_t) maxid) {
1416 for (
int id = 1;
id < maxid;
id++) {
1423 fWindows.emplace(maxid, std::make_unique<XWindow_t>());
1432 if (XGetGCValues((Display*)
fDisplay, ctxt->fGClist[
kGCtext], GCForeground|GCBackground, &values)) {
1433 XSetForeground((Display*)
fDisplay, ctxt->fGClist[
kGCinvt], values.background);
1434 XSetBackground((Display*)
fDisplay, ctxt->fGClist[
kGCinvt], values.foreground);
1436 Error(
"AddWindowHandle",
"cannot get GC values");
1442 XSetGraphicsExposures((Display*)
fDisplay, ctxt->fGClist[
kGCpxmp], False);
1457 unsigned int wval, hval;
1459 unsigned int ww, hh, border, depth;
1468 XGetGeometry((Display*)
fDisplay,
gCws->fWindow, &root, &xx, &yy, &ww, &hh, &border, &depth);
1470 for (
int i = 0; i <
kMAXGC; i++)
1471 XSetClipMask((Display*)
fDisplay,
gCws->fGClist[i], None);
1480 gCws->fDoubleBuffer = 0;
1481 gCws->fIsPixmap = 1;
1483 gCws->fWidth = wval;
1484 gCws->fHeight = hval;
1500 unsigned int wval, hval, border, depth;
1505 XGetGeometry((Display*)
fDisplay, wind, &root, &xval, &yval, &wval, &hval, &border, &depth);
1511 gCws->fDoubleBuffer = 0;
1516 attr_mask |= CWBackPixel;
1518 attr_mask |= CWBorderPixel;
1519 attributes.event_mask = NoEventMask;
1520 attr_mask |= CWEventMask;
1521 attributes.backing_store = Always;
1522 attr_mask |= CWBackingStore;
1523 attributes.bit_gravity = NorthWestGravity;
1524 attr_mask |= CWBitGravity;
1527 attr_mask |= CWColormap;
1530 gCws->fWindow = XCreateWindow((Display*)
fDisplay, wind,
1531 xval, yval, wval, hval, 0,
fDepth,
1533 attr_mask, &attributes);
1542 gCws->fDoubleBuffer = 0;
1543 gCws->fIsPixmap = 0;
1545 gCws->fWidth = wval;
1546 gCws->fHeight = hval;
1560 gCws->fDoubleBuffer = 0;
1562 gCws->fWindow = qwid;
1567 gCws->fDoubleBuffer = 0;
1568 gCws->fIsPixmap = 0;
1596 Window root_return, child_return;
1597 int win_x_return, win_y_return;
1598 int root_x_return, root_y_return;
1599 unsigned int mask_return;
1601 XQueryPointer((Display*)
fDisplay,
gCws->fWindow, &root_return,
1602 &child_return, &root_x_return, &root_y_return, &win_x_return,
1603 &win_y_return, &mask_return);
1640 static int xloc = 0;
1641 static int yloc = 0;
1642 static int xlocp = 0;
1643 static int ylocp = 0;
1644 static Cursor cursor = 0;
1656 cursor = XCreateFontCursor((Display*)
fDisplay, XC_crosshair);
1657 XDefineCursor((Display*)
fDisplay,
gCws->fWindow, cursor);
1665 while (button_press == 0) {
1674 xloc, 0, xloc,
gCws->fHeight);
1676 0, yloc,
gCws->fWidth, yloc);
1681 (yloc-ylocp)*(yloc-ylocp)));
1683 xlocp-radius, ylocp-radius,
1684 2*radius, 2*radius, 0, 23040);
1689 xlocp, ylocp, xloc, yloc);
1702 while (XEventsQueued( (Display*)
fDisplay, QueuedAlready) > 1) {
1703 XNextEvent((Display*)
fDisplay, &event);
1714 xloc, 0, xloc,
gCws->fHeight);
1716 0, yloc,
gCws->fWidth, yloc);
1721 (yloc-ylocp)*(yloc-ylocp)));
1723 xlocp-radius, ylocp-radius,
1724 2*radius, 2*radius, 0, 23040);
1729 xlocp, ylocp, xloc, yloc);
1742 xloc =
event.xbutton.x;
1743 yloc =
event.xbutton.y;
1745 switch (event.type) {
1750 XNextEvent((Display*)
fDisplay, &event);
1751 if (event.type == EnterNotify)
break;
1759 button_press =
event.xbutton.button ;
1760 xlocp =
event.xbutton.x;
1761 ylocp =
event.xbutton.y;
1766 case ButtonRelease :
1768 button_press = 10+
event.xbutton.button ;
1769 xlocp =
event.xbutton.x;
1770 ylocp =
event.xbutton.y;
1776 button_press =
event.xkey.keycode;
1777 xlocp =
event.xbutton.x;
1778 ylocp =
event.xbutton.y;
1784 button_press = -
event.xkey.keycode;
1785 xlocp =
event.xbutton.x;
1786 ylocp =
event.xbutton.y;
1795 if (button_press == 0)
1800 x =
event.xbutton.x;
1801 y =
event.xbutton.y;
1803 return button_press;
1818 static Cursor cursor = 0;
1819 static int percent = 0;
1825 int len_text = strlen(
text);
1831 XKeyboardState kbstate;
1832 cursor = XCreateFontCursor((Display*)
fDisplay, XC_question_arrow);
1833 XGetKeyboardControl((Display*)
fDisplay, &kbstate);
1834 percent = kbstate.bell_percent;
1837 XDefineCursor((Display*)
fDisplay,
gCws->fWindow, cursor);
1838 for (nt = len_text; nt > 0 &&
text[nt-1] ==
' '; nt--) { }
1840 XGetInputFocus((Display*)
fDisplay, &focuswindow, &focusrevert);
1841 XSetInputFocus((Display*)
fDisplay,
gCws->fWindow, focusrevert, CurrentTime);
1848 dx = XTextWidth(
gCws->textFont,
text, nt);
1850 dx =
pt == 0 ? 0 : XTextWidth(
gCws->textFont,
text,
pt);
1852 x + dx,
y,
pt < len_text ? &
text[
pt] :
" ", 1);
1854 switch (event.type) {
1857 XSetInputFocus((Display*)
fDisplay,
gCws->fWindow, focusrevert, CurrentTime);
1860 XSetInputFocus((Display*)
fDisplay, focuswindow, focusrevert, CurrentTime);
1863 nbytes = XLookupString(&event.xkey, keybuf,
sizeof(keybuf),
1876 if (isascii(keybuf[0]) && isprint(keybuf[0])) {
1880 for (i = nt - 1; i >
pt; i--)
1882 if (
pt < len_text) {
1887 switch (keybuf[0]) {
1894 for (i =
pt; i < nt; i++)
1913 for (i =
pt; i < nt; i++)
1931 for (i =
pt; i < nt; i++)
1952 XBell((Display*)
fDisplay, percent);
1957 XSetInputFocus((Display*)
fDisplay, focuswindow, focusrevert, CurrentTime);
1977 if (!
gTws->fOpen)
return;
1980 if (
gTws->fWidth == w &&
gTws->fHeight ==
h)
return;
1984 if (
gTws->fBuffer) {
1986 if (
gTws->fWidth < w ||
gTws->fHeight <
h) {
1990 for (
int i = 0; i <
kMAXGC; i++)
1991 XSetClipMask((Display*)
fDisplay,
gTws->fGClist[i], None);
1995 if (
gTws->fDoubleBuffer)
2011 unsigned int wval, hval;
2013 unsigned int ww, hh, border, depth;
2024 if (
gTws->fWidth >= wval-1 &&
gTws->fWidth <= wval+1 &&
2025 gTws->fHeight >= hval-1 &&
gTws->fHeight <= hval+1)
return 0;
2028 if (
gTws->fWidth < wval ||
gTws->fHeight < hval) {
2032 XGetGeometry((Display*)
fDisplay,
gTws->fWindow, &root, &xx, &yy, &ww, &hh, &border, &depth);
2034 for (i = 0; i <
kMAXGC; i++)
2035 XSetClipMask((Display*)
fDisplay,
gTws->fGClist[i], None);
2043 gTws->fWidth = wval;
2044 gTws->fHeight = hval;
2056 unsigned int wval=0, hval=0, border=0, depth=0;
2060 win =
gTws->fWindow;
2062 XGetGeometry((Display*)
fDisplay, win, &root,
2063 &xval, &yval, &wval, &hval, &border, &depth);
2064 if (wval >= 65500) wval = 1;
2065 if (hval >= 65500) hval = 1;
2068 if (
gTws->fWidth == wval &&
gTws->fHeight == hval)
return;
2070 XResizeWindow((Display*)
fDisplay,
gTws->fWindow, wval, hval);
2072 if (
gTws->fBuffer) {
2073 if (
gTws->fWidth < wval ||
gTws->fHeight < hval) {
2077 for (
int i = 0; i <
kMAXGC; i++)
2078 XSetClipMask((Display*)
fDisplay,
gTws->fGClist[i], None);
2082 if (
gTws->fDoubleBuffer)
2085 gTws->fWidth = wval;
2086 gTws->fHeight = hval;
2094 if ((wid == 0) || (
fWindows.count(wid) == 0))
2102 if (
gCws->fClip && !
gCws->fIsPixmap && !
gCws->fDoubleBuffer) {
2104 region.x =
gCws->fXclip;
2105 region.y =
gCws->fYclip;
2106 region.width =
gCws->fWclip;
2107 region.height =
gCws->fHclip;
2108 for (
int i = 0; i <
kMAXGC; i++)
2109 XSetClipRectangles((Display*)
fDisplay,
gCws->fGClist[i], 0, 0, ®ion, 1, YXBanded);
2111 for (
int i = 0; i <
kMAXGC; i++)
2112 XSetClipMask((Display*)
fDisplay,
gCws->fGClist[i], None);
2123 if (chupx == 0 && chupy == 0)
fTextAngle = 0;
2124 else if (chupx == 0 && chupy == 1)
fTextAngle = 0;
2125 else if (chupx == -1 && chupy == 0)
fTextAngle = 90;
2126 else if (chupx == 0 && chupy == -1)
fTextAngle = 180;
2127 else if (chupx == 1 && chupy == 0)
fTextAngle = 270;
2145 for (
int i = 0; i <
kMAXGC; i++)
2146 XSetClipMask( (Display*)
fDisplay,
gTws->fGClist[i], None );
2164 if (
gTws->fClip && !
gTws->fIsPixmap && !
gTws->fDoubleBuffer) {
2166 region.x =
gTws->fXclip;
2167 region.y =
gTws->fYclip;
2168 region.width =
gTws->fWclip;
2169 region.height =
gTws->fHclip;
2170 for (
int i = 0; i <
kMAXGC; i++)
2171 XSetClipRectangles((Display*)
fDisplay,
gTws->fGClist[i], 0, 0, ®ion, 1, YXBanded);
2184 SetRGB(ci, color->GetRed(), color->GetGreen(), color->GetBlue());
2189 }
else if (!
fColormap && (ci < 0 || ci > 1)) {
2195 XGetGCValues((Display*)
fDisplay, gc, GCBackground, &values);
2196 XSetForeground((Display*)
fDisplay, gc, col.
fPixel ^ values.background);
2202 XGetGCValues((Display*)
fDisplay, gc, GCForeground | GCBackground, &values);
2203 if (values.foreground == values.background)
2262 if (!
gTws->fDoubleBuffer)
return;
2263 gTws->fDoubleBuffer = 0;
2272 if (
gTws->fDoubleBuffer ||
gTws->fIsPixmap)
2274 if (!
gTws->fBuffer) {
2281 for (
int i = 0; i <
kMAXGC; i++)
2282 XSetClipMask((Display*)
fDisplay,
gTws->fGClist[i], None);
2283 gTws->fDoubleBuffer = 1;
2307 if (cindex < 0)
return;
2364 attr_mask = CWEventMask;
2365 XChangeWindowAttributes((Display*)
fDisplay,
gCws->fWindow, attr_mask, &attributes);
2367 attributes.event_mask = NoEventMask;
2368 attr_mask = CWEventMask;
2369 XChangeWindowAttributes((Display*)
fDisplay,
gCws->fWindow, attr_mask, &attributes);
2378 if (cindex < 0)
return;
2401 Warning(
"SetLineType",
"DEPRECATED, use SetAttLine() instead");
2457 if (cindex < 0)
return;
2520 xcol.flags = DoRed | DoGreen | DoBlue;
2524 if (col.
fRed == xcol.red && col.
fGreen == xcol.green &&
2525 col.
fBlue == xcol.blue)
2534 col.
fRed = xcol.red;
2536 col.
fBlue = xcol.blue;
2561 if (cindex < 0)
return;
2587 if (mode ==
kLoad) {
2588 for (
int i = 0; i <
kMAXFONT; i++) {
2589 if (strcmp(fontname,
gFont[i].
name) == 0) {
2601 fontlist = XListFonts((Display*)
fDisplay, fontname, 1, &fontcount);
2603 if (fontlist && fontcount != 0) {
2604 if (mode ==
kLoad) {
2613 XFreeFontNames(fontlist);
2658 XSynchronize((Display*)
fDisplay,1);
2662 XSynchronize((Display*)
fDisplay,0);
2696 if (ctxt->fDoubleBuffer) {
2697 XCopyArea((Display*)
fDisplay, ctxt->fDrawing, ctxt->fWindow,
2698 ctxt->fGClist[
kGCpxmp], 0, 0, ctxt->fWidth, ctxt->fHeight, 0, 0);
2716 if ((
fDepth <= 8) || (percent <= 0))
return;
2717 if (percent > 100) percent = 100;
2722 XImage *image = XGetImage((Display*)
fDisplay, ctxt->fDrawing, 0, 0, ctxt->fWidth,
2723 ctxt->fHeight, AllPlanes, ZPixmap);
2727 std::vector<ULong_t> orgcolors;
2728 for (
UInt_t y = 0;
y < ctxt->fHeight;
y++) {
2729 for (
UInt_t x = 0;
x < ctxt->fWidth;
x++) {
2731 if (std::find(orgcolors.begin(), orgcolors.end(), pixel) == orgcolors.end())
2732 orgcolors.emplace_back(pixel);
2735 if (orgcolors.empty()) {
2736 XDestroyImage(image);
2741 if (!ctxt->fNewColors.empty()) {
2743 XFreeColors((Display*)
fDisplay,
fColormap, ctxt->fNewColors.data(), ctxt->fNewColors.size(), 0);
2744 ctxt->fNewColors.clear();
2747 std::vector<RXColor> xcol(orgcolors.size());
2749 for (std::size_t i = 0; i < orgcolors.size(); i++) {
2750 xcol[i].pixel = orgcolors[i];
2751 xcol[i].red = xcol[i].green = xcol[i].blue = 0;
2752 xcol[i].flags = DoRed | DoGreen | DoBlue;
2759 for (std::size_t i = 0; i < orgcolors.size(); i++) {
2764 Warning(
"SetOpacityW",
"failed to allocate color %hd, %hd, %hd",
2765 xcol[i].red, xcol[i].green, xcol[i].blue);
2769 ctxt->fNewColors.resize(orgcolors.size());
2771 for (std::size_t i = 0; i < orgcolors.size(); i++)
2772 ctxt->fNewColors[i] = xcol[i].pixel;
2775 for (
UInt_t y = 0;
y < ctxt->fHeight;
y++) {
2776 for (
UInt_t x = 0;
x < ctxt->fWidth;
x++) {
2778 auto iter = std::find(orgcolors.begin(), orgcolors.end(), pixel);
2779 if (iter != orgcolors.end()) {
2780 auto idx = iter - orgcolors.begin();
2781 XPutPixel(image,
x,
y, ctxt->fNewColors[idx]);
2787 XPutImage((Display*)
fDisplay, ctxt->fDrawing, ctxt->fGClist[
kGCpxmp], image, 0, 0, 0, 0,
2788 ctxt->fWidth, ctxt->fHeight);
2791 XDestroyImage(image);
2804 gTws->fHeight, xpos, ypos);
2824 XWarpPointer((Display*)
fDisplay, None, (
Window)
id, 0, 0, 0, 0, ix, iy);
2837 unsigned int wval, hval;
2842 XWriteBitmapFile((Display*)
fDisplay, pxname,
gTws->fDrawing, wval, hval, -1, -1);
2854 for (
int x = 0;
x < width;
x++) {
2862 buf[
x] = (
unsigned char) idx;
2890 XImage *image = XGetImage((Display*)
fDisplay, ctxt->fDrawing, 0, 0,
2891 ctxt->fWidth, ctxt->fHeight,
2892 AllPlanes, ZPixmap);
2895 Error(
"WriteGIFW",
"Cannot create image for writing GIF. Try in batch mode.");
2909 for (
UInt_t x = 0;
x < ctxt->fWidth;
x++) {
2910 for (
UInt_t y = 0;
y < ctxt->fHeight;
y++) {
2919 if (ncolors > 256) {
2920 Error(
"WriteGIFW",
"Cannot create GIF of image containing more than 256 colors. Try in batch mode.");
2921 XDestroyImage(image);
2926 std::vector<RXColor> xcol(ncolors);
2928 for (std::size_t i = 0; i < ncolors; i++) {
2930 xcol[i].red = xcol[i].green = xcol[i].blue = 0;
2931 xcol[i].flags = DoRed | DoGreen | DoBlue;
2937 for (std::size_t i = 0; i < ncolors; i++) {
2945 std::vector<unsigned char>
r(ncolors),
b(ncolors),
g(ncolors);
2947 for (std::size_t i = 0; i < ncolors; i++) {
2948 r[i] = (
unsigned char) (xcol[i].red * 255 / maxcol);
2949 g[i] = (
unsigned char) (xcol[i].green * 255 / maxcol);
2950 b[i] = (
unsigned char) (xcol[i].blue * 255 / maxcol);
2955 if (gif.OpenFile(
name)) {
2956 auto len = gif.GIFencode(ctxt->fWidth, ctxt->fHeight, ncolors,
r.data(),
g.data(),
b.data());
2961 Error(
"WriteGIFW",
"cannot write file: %s",
name);
2965 XDestroyImage(image);
2977 const int maxSegment = 20;
2978 int i,
n,
x,
y, xcur, x1, x2, y1, y2;
2979 unsigned char *jimg, *jbase, icol;
2981 XSegment lines[256][maxSegment];
2989 id =
gCws->fDrawing;
2993 for (i = 0; i < 256; i++) nlines[i] = 0;
2995 x1 = x0 +
xmin; y1 = y0 + ny -
ymax - 1;
2996 x2 = x0 +
xmax; y2 = y0 + ny -
ymin - 1;
2997 jbase = image + (
ymin-1)*nx +
xmin;
2999 for (
y = y2;
y >= y1;
y--) {
3000 xcur = x1; jbase += nx;
3001 for (jimg = jbase, icol = *jimg++,
x = x1+1;
x <= x2; jimg++,
x++) {
3002 if (icol != *jimg) {
3003 if (icol != itran) {
3005 lines[icol][
n].x1 = xcur; lines[icol][
n].y1 =
y;
3006 lines[icol][
n].x2 =
x-1; lines[icol][
n].y2 =
y;
3007 if (nlines[icol] == maxSegment) {
3008 SetColor(wid ?
nullptr :
gCws, &lineGC, (
int)icol+offset);
3009 XDrawSegments((Display*)
fDisplay,
id,lineGC,&lines[icol][0],
3014 icol = *jimg; xcur =
x;
3017 if (icol != itran) {
3019 lines[icol][
n].x1 = xcur; lines[icol][
n].y1 =
y;
3020 lines[icol][
n].x2 =
x-1; lines[icol][
n].y2 =
y;
3021 if (nlines[icol] == maxSegment) {
3022 SetColor(wid ?
nullptr :
gCws, &lineGC, (
int)icol+offset);
3023 XDrawSegments((Display*)
fDisplay,
id,lineGC,&lines[icol][0],
3030 for (i = 0; i < 256; i++) {
3031 if (nlines[i] != 0) {
3033 XDrawSegments((Display*)
fDisplay,
id,lineGC,&lines[i][0],nlines[i]);
3038 XFreeGC((Display*)
fDisplay, lineGC);
3048 unsigned char *gifArr, *pixArr, red[256], green[256], blue[256], *j1, *j2, icol;
3049 int i, j, k, width, height, ncolor, irep, offset;
3053 FILE *fd = fopen(file,
"r");
3055 Error(
"ReadGIF",
"unable to open GIF file");
3060 long ft = ftell(fd);
3062 Error(
"ReadGIF",
"unable to open GIF file");
3070 if (!(gifArr = (
unsigned char *)
calloc(filesize+256,1))) {
3071 Error(
"ReadGIF",
"unable to allocate array for gif");
3076 if (fread(gifArr, filesize, 1, fd) != 1) {
3077 Error(
"ReadGIF",
"GIF file read failed");
3084 irep = TGifDecode::GIFinfo(gifArr, &width, &height, &ncolor);
3090 if (!(pixArr = (
unsigned char *)
calloc((width*height),1))) {
3091 Error(
"ReadGIF",
"unable to allocate array for image");
3098 irep = gif.GIFdecode(gifArr, pixArr, &width, &height, &ncolor, red, green, blue);
3109 for (i = 0; i < ncolor; i++) {
3119 for (i = 1; i <= height/2; i++) {
3120 j1 = pixArr + (i-1)*width;
3121 j2 = pixArr + (height-i)*width;
3122 for (k = 0; k < width; k++) {
3123 icol = *j1; *j1++ = *j2; *j2++ = icol;
3128 PutImage(offset,-1,x0,y0,width,height,0,0,width-1,height-1,pixArr,pic);
3183 gCws->fWindow = pixid;
3186 gCws->fDoubleBuffer = 0;
3187 gCws->fIsPixmap = 1;
3207 Int_t major_opcode, first_event, first_error;
3210 return XQueryExtension((Display*)
fDisplay, ext, &major_opcode, &first_event, &first_error);
3234 if (!
gStyle->GetFillColor() && cindex > 1)
3238 ctxt->fAttFill.SetFillColor(cindex);
3242 Int_t stn = (fasi >= 1 && fasi <=25) ? fasi : 2;
3243 ctxt->fAttFill.SetFillStyle(
style * 1000 + fasi);
3247 ctxt->fillHollow = 0;
3252 ctxt->fillHollow = 1;
3256 ctxt->fillHollow = 0;
3257 XSetFillStyle((Display*)
fDisplay, ctxt->fGClist[
kGCfill], FillStippled);
3259 if (stn != ctxt->fillFasi) {
3260 if (ctxt->fillPattern != 0)
3261 XFreePixmap((Display*)
fDisplay, ctxt->fillPattern);
3266 XSetStipple((Display*)
fDisplay, ctxt->fGClist[
kGCfill], ctxt->fillPattern);
3267 ctxt->fillFasi = stn;
3272 ctxt->fillHollow = 1;
3285 if (ctxt->fAttLine.GetLineStyle() != att.
GetLineStyle()) {
3287 ctxt->dashList.clear();
3289 ctxt->dashList = { 3, 3 };
3291 ctxt->dashList = { 1, 2 };
3293 ctxt->dashList = { 3, 4, 1, 4} ;
3297 Int_t nt = tokens->GetEntries();
3298 ctxt->dashList.resize(nt);
3299 for (
Int_t j = 0; j < nt; ++j) {
3301 sscanf(tokens->At(j)->GetName(),
"%d", &it);
3302 ctxt->dashList[j] = (
Int_t) (it/4);
3306 ctxt->dashLength = 0;
3307 for (
auto elem : ctxt->dashList)
3308 ctxt->dashLength += elem;
3309 ctxt->dashOffset = 0;
3310 ctxt->lineStyle = ctxt->dashList.size() == 0 ? LineSolid : LineOnOffDash;
3314 if (ctxt->lineStyle == LineSolid) {
3315 if (ctxt->lineWidth == 1)
3316 ctxt->lineWidth = 0;
3318 if (ctxt->lineWidth == 0)
3319 ctxt->lineWidth = 1;
3322 if (ctxt->lineWidth >= 0) {
3323 XSetLineAttributes((Display*)
fDisplay, ctxt->fGClist[
kGCline], ctxt->lineWidth,
3325 if (ctxt->lineStyle == LineOnOffDash)
3326 XSetLineAttributes((Display*)
fDisplay, ctxt->fGClist[
kGCdash], ctxt->lineWidth,
3335 ctxt->fAttLine = att;
3352 ctxt->fAttMarker = att;
3361 if (markerstyle == 1 || markerstyle == 6 || markerstyle == 7) {
3362 XSetLineAttributes((Display*)
fDisplay, ctxt->fGClist[
kGCmark], 0, LineSolid, CapButt, JoinMiter);
3364 XSetLineAttributes((Display*)
fDisplay, ctxt->fGClist[
kGCmark], ctxt->markerLineWidth,
3370 auto &shape = ctxt->markerShape;
3371 ctxt->markerSize = 0;
3372 ctxt->markerType = 0;
3373 if (markerstyle == 2) {
3376 shape[0].x = -im; shape[0].y = 0;
3377 shape[1].x = im; shape[1].y = 0;
3378 shape[2].x = 0 ; shape[2].y = -im;
3379 shape[3].x = 0 ; shape[3].y = im;
3380 ctxt->markerType = 4;
3381 }
else if (markerstyle == 3 || markerstyle == 31) {
3384 shape[0].x = -im; shape[0].y = 0;
3385 shape[1].x = im; shape[1].y = 0;
3386 shape[2].x = 0 ; shape[2].y = -im;
3387 shape[3].x = 0 ; shape[3].y = im;
3389 shape[4].x = -im; shape[4].y = -im;
3390 shape[5].x = im; shape[5].y = im;
3391 shape[6].x = -im; shape[6].y = im;
3392 shape[7].x = im; shape[7].y = -im;
3393 ctxt->markerType = 4;
3394 }
else if (markerstyle == 4 || markerstyle == 24) {
3397 ctxt->markerType = 0;
3398 ctxt->markerSize = im*2;
3399 }
else if (markerstyle == 5) {
3403 shape[0].x = -im; shape[0].y = -im;
3404 shape[1].x = im; shape[1].y = im;
3405 shape[2].x = -im; shape[2].y = im;
3406 shape[3].x = im; shape[3].y = -im;
3407 ctxt->markerType = 4;
3408 }
else if (markerstyle == 6) {
3411 shape[0].x = -1 ; shape[0].y = 0;
3412 shape[1].x = 1 ; shape[1].y = 0;
3413 shape[2].x = 0 ; shape[2].y = -1;
3414 shape[3].x = 0 ; shape[3].y = 1;
3415 ctxt->markerType = 4;
3416 }
else if (markerstyle == 7) {
3419 shape[0].x = -1 ; shape[0].y = 1;
3420 shape[1].x = 1 ; shape[1].y = 1;
3421 shape[2].x = -1 ; shape[2].y = 0;
3422 shape[3].x = 1 ; shape[3].y = 0;
3423 shape[4].x = -1 ; shape[4].y = -1;
3424 shape[5].x = 1 ; shape[5].y = -1;
3425 ctxt->markerType = 4;
3426 }
else if (markerstyle == 8 || markerstyle == 20) {
3429 ctxt->markerType = 1;
3430 ctxt->markerSize = im*2;
3431 }
else if (markerstyle == 21) {
3434 shape[0].x = -im; shape[0].y = -im;
3435 shape[1].x = im; shape[1].y = -im;
3436 shape[2].x = im; shape[2].y = im;
3437 shape[3].x = -im; shape[3].y = im;
3438 shape[4].x = -im; shape[4].y = -im;
3439 ctxt->markerType = 3;
3440 }
else if (markerstyle == 22) {
3443 shape[0].x = -im; shape[0].y = im;
3444 shape[1].x = im; shape[1].y = im;
3445 shape[2].x = 0; shape[2].y = -im;
3446 shape[3].x = -im; shape[3].y = im;
3447 ctxt->markerType = 3;
3448 }
else if (markerstyle == 23) {
3451 shape[0].x = 0; shape[0].y = im;
3452 shape[1].x = im; shape[1].y = -im;
3453 shape[2].x = -im; shape[2].y = -im;
3454 shape[3].x = 0; shape[3].y = im;
3455 ctxt->markerType = 3;
3456 }
else if (markerstyle == 25) {
3459 shape[0].x = -im; shape[0].y = -im;
3460 shape[1].x = im; shape[1].y = -im;
3461 shape[2].x = im; shape[2].y = im;
3462 shape[3].x = -im; shape[3].y = im;
3463 shape[4].x = -im; shape[4].y = -im;
3464 ctxt->markerType = 2;
3465 }
else if (markerstyle == 26) {
3468 shape[0].x = -im; shape[0].y = im;
3469 shape[1].x = im; shape[1].y = im;
3470 shape[2].x = 0; shape[2].y = -im;
3471 shape[3].x = -im; shape[3].y = im;
3472 ctxt->markerType = 2;
3473 }
else if (markerstyle == 27) {
3476 Int_t imx =
Int_t(2.66*MarkerSizeReduced + 0.5);
3477 shape[0].x =-imx; shape[0].y = 0;
3478 shape[1].x = 0; shape[1].y = -im;
3479 shape[2].x = imx; shape[2].y = 0;
3480 shape[3].x = 0; shape[3].y = im;
3481 shape[4].x =-imx; shape[4].y = 0;
3482 ctxt->markerType = 2;
3483 }
else if (markerstyle == 28) {
3486 Int_t imx =
Int_t(1.33*MarkerSizeReduced + 0.5);
3487 shape[0].x = -im; shape[0].y =-imx;
3488 shape[1].x =-imx; shape[1].y =-imx;
3489 shape[2].x =-imx; shape[2].y = -im;
3490 shape[3].x = imx; shape[3].y = -im;
3491 shape[4].x = imx; shape[4].y =-imx;
3492 shape[5].x = im; shape[5].y =-imx;
3493 shape[6].x = im; shape[6].y = imx;
3494 shape[7].x = imx; shape[7].y = imx;
3495 shape[8].x = imx; shape[8].y = im;
3496 shape[9].x =-imx; shape[9].y = im;
3497 shape[10].x=-imx; shape[10].y= imx;
3498 shape[11].x= -im; shape[11].y= imx;
3499 shape[12].x= -im; shape[12].y=-imx;
3500 ctxt->markerType = 2;
3501 }
else if (markerstyle == 29) {
3504 Int_t im1 =
Int_t(0.66*MarkerSizeReduced + 0.5);
3505 Int_t im2 =
Int_t(2.00*MarkerSizeReduced + 0.5);
3506 Int_t im3 =
Int_t(2.66*MarkerSizeReduced + 0.5);
3507 Int_t im4 =
Int_t(1.33*MarkerSizeReduced + 0.5);
3508 shape[0].x = -im; shape[0].y = im4;
3509 shape[1].x =-im2; shape[1].y =-im1;
3510 shape[2].x =-im3; shape[2].y = -im;
3511 shape[3].x = 0; shape[3].y =-im2;
3512 shape[4].x = im3; shape[4].y = -im;
3513 shape[5].x = im2; shape[5].y =-im1;
3514 shape[6].x = im; shape[6].y = im4;
3515 shape[7].x = im4; shape[7].y = im4;
3516 shape[8].x = 0; shape[8].y = im;
3517 shape[9].x =-im4; shape[9].y = im4;
3518 shape[10].x= -im; shape[10].y= im4;
3519 ctxt->markerType = 3;
3520 }
else if (markerstyle == 30) {
3523 Int_t im1 =
Int_t(0.66*MarkerSizeReduced + 0.5);
3524 Int_t im2 =
Int_t(2.00*MarkerSizeReduced + 0.5);
3525 Int_t im3 =
Int_t(2.66*MarkerSizeReduced + 0.5);
3526 Int_t im4 =
Int_t(1.33*MarkerSizeReduced + 0.5);
3527 shape[0].x = -im; shape[0].y = im4;
3528 shape[1].x =-im2; shape[1].y =-im1;
3529 shape[2].x =-im3; shape[2].y = -im;
3530 shape[3].x = 0; shape[3].y =-im2;
3531 shape[4].x = im3; shape[4].y = -im;
3532 shape[5].x = im2; shape[5].y =-im1;
3533 shape[6].x = im; shape[6].y = im4;
3534 shape[7].x = im4; shape[7].y = im4;
3535 shape[8].x = 0; shape[8].y = im;
3536 shape[9].x =-im4; shape[9].y = im4;
3537 shape[10].x= -im; shape[10].y= im4;
3538 ctxt->markerType = 2;
3539 }
else if (markerstyle == 32) {
3542 shape[0].x = 0; shape[0].y = im;
3543 shape[1].x = im; shape[1].y = -im;
3544 shape[2].x = -im; shape[2].y = -im;
3545 shape[3].x = 0; shape[3].y = im;
3546 ctxt->markerType = 2;
3547 }
else if (markerstyle == 33) {
3550 Int_t imx =
Int_t(2.66*MarkerSizeReduced + 0.5);
3551 shape[0].x =-imx; shape[0].y = 0;
3552 shape[1].x = 0; shape[1].y = -im;
3553 shape[2].x = imx; shape[2].y = 0;
3554 shape[3].x = 0; shape[3].y = im;
3555 shape[4].x =-imx; shape[4].y = 0;
3556 ctxt->markerType = 3;
3557 }
else if (markerstyle == 34) {
3560 Int_t imx =
Int_t(1.33*MarkerSizeReduced + 0.5);
3561 shape[0].x = -im; shape[0].y =-imx;
3562 shape[1].x =-imx; shape[1].y =-imx;
3563 shape[2].x =-imx; shape[2].y = -im;
3564 shape[3].x = imx; shape[3].y = -im;
3565 shape[4].x = imx; shape[4].y =-imx;
3566 shape[5].x = im; shape[5].y =-imx;
3567 shape[6].x = im; shape[6].y = imx;
3568 shape[7].x = imx; shape[7].y = imx;
3569 shape[8].x = imx; shape[8].y = im;
3570 shape[9].x =-imx; shape[9].y = im;
3571 shape[10].x=-imx; shape[10].y= imx;
3572 shape[11].x= -im; shape[11].y= imx;
3573 shape[12].x= -im; shape[12].y=-imx;
3574 ctxt->markerType = 3;
3575 }
else if (markerstyle == 35) {
3578 shape[0].x =-im; shape[0].y = 0;
3579 shape[1].x = 0; shape[1].y = -im;
3580 shape[2].x = im; shape[2].y = 0;
3581 shape[3].x = 0; shape[3].y = im;
3582 shape[4].x =-im; shape[4].y = 0;
3583 shape[5].x = im; shape[5].y = 0;
3584 shape[6].x = 0; shape[6].y = im;
3585 shape[7].x = 0; shape[7].y =-im;
3586 ctxt->markerType = 2;
3587 }
else if (markerstyle == 36) {
3590 shape[0].x = -im; shape[0].y = -im;
3591 shape[1].x = im; shape[1].y = -im;
3592 shape[2].x = im; shape[2].y = im;
3593 shape[3].x = -im; shape[3].y = im;
3594 shape[4].x = -im; shape[4].y = -im;
3595 shape[5].x = im; shape[5].y = im;
3596 shape[6].x = -im; shape[6].y = im;
3597 shape[7].x = im; shape[7].y = -im;
3598 ctxt->markerType = 2;
3599 }
else if (markerstyle == 37) {
3602 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
3603 shape[0].x = 0; shape[0].y = 0;
3604 shape[1].x =-im2; shape[1].y = im;
3605 shape[2].x = im2; shape[2].y = im;
3606 shape[3].x = 0; shape[3].y = 0;
3607 shape[4].x =-im2; shape[4].y = -im;
3608 shape[5].x = -im; shape[5].y = 0;
3609 shape[6].x = 0; shape[6].y = 0;
3610 shape[7].x = im; shape[7].y = 0;
3611 shape[8].x = im2; shape[8].y = -im;
3612 shape[9].x = 0; shape[9].y = 0;
3613 ctxt->markerType = 2;
3614 }
else if (markerstyle == 38) {
3617 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
3618 shape[0].x = -im; shape[0].y = 0;
3619 shape[1].x = -im; shape[1].y =-im2;
3620 shape[2].x =-im2; shape[2].y = -im;
3621 shape[3].x = im2; shape[3].y = -im;
3622 shape[4].x = im; shape[4].y =-im2;
3623 shape[5].x = im; shape[5].y = im2;
3624 shape[6].x = im2; shape[6].y = im;
3625 shape[7].x =-im2; shape[7].y = im;
3626 shape[8].x = -im; shape[8].y = im2;
3627 shape[9].x = -im; shape[9].y = 0;
3628 shape[10].x = im; shape[10].y = 0;
3629 shape[11].x = 0; shape[11].y = 0;
3630 shape[12].x = 0; shape[12].y = -im;
3631 shape[13].x = 0; shape[13].y = im;
3632 shape[14].x = 0; shape[14].y = 0;
3633 ctxt->markerType = 2;
3634 }
else if (markerstyle == 39) {
3637 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
3638 shape[0].x = 0; shape[0].y = 0;
3639 shape[1].x =-im2; shape[1].y = im;
3640 shape[2].x = im2; shape[2].y = im;
3641 shape[3].x = 0; shape[3].y = 0;
3642 shape[4].x =-im2; shape[4].y = -im;
3643 shape[5].x = -im; shape[5].y = 0;
3644 shape[6].x = 0; shape[6].y = 0;
3645 shape[7].x = im; shape[7].y = 0;
3646 shape[8].x = im2; shape[8].y = -im;
3647 ctxt->markerType = 3;
3648 }
else if (markerstyle == 40) {
3651 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
3652 shape[0].x = 0; shape[0].y = 0;
3653 shape[1].x = im2; shape[1].y = im;
3654 shape[2].x = im; shape[2].y = im2;
3655 shape[3].x = 0; shape[3].y = 0;
3656 shape[4].x = im; shape[4].y = -im2;
3657 shape[5].x = im2; shape[5].y = -im;
3658 shape[6].x = 0; shape[6].y = 0;
3659 shape[7].x = -im2; shape[7].y = -im;
3660 shape[8].x = -im; shape[8].y = -im2;
3661 shape[9].x = 0; shape[9].y = 0;
3662 shape[10].x = -im; shape[10].y = im2;
3663 shape[11].x = -im2; shape[11].y = im;
3664 shape[12].x = 0; shape[12].y = 0;
3665 ctxt->markerType = 2;
3666 }
else if (markerstyle == 41) {
3669 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
3670 shape[0].x = 0; shape[0].y = 0;
3671 shape[1].x = im2; shape[1].y = im;
3672 shape[2].x = im; shape[2].y = im2;
3673 shape[3].x = 0; shape[3].y = 0;
3674 shape[4].x = im; shape[4].y = -im2;
3675 shape[5].x = im2; shape[5].y = -im;
3676 shape[6].x = 0; shape[6].y = 0;
3677 shape[7].x = -im2; shape[7].y = -im;
3678 shape[8].x = -im; shape[8].y = -im2;
3679 shape[9].x = 0; shape[9].y = 0;
3680 shape[10].x = -im; shape[10].y = im2;
3681 shape[11].x = -im2; shape[11].y = im;
3682 shape[12].x = 0; shape[12].y = 0;
3683 ctxt->markerType = 3;
3684 }
else if (markerstyle == 42) {
3688 shape[0].x= 0; shape[0].y= im;
3689 shape[1].x= -imx; shape[1].y= imx;
3690 shape[2].x = -im; shape[2].y = 0;
3691 shape[3].x = -imx; shape[3].y = -imx;
3692 shape[4].x = 0; shape[4].y = -im;
3693 shape[5].x = imx; shape[5].y = -imx;
3694 shape[6].x = im; shape[6].y = 0;
3695 shape[7].x= imx; shape[7].y= imx;
3696 shape[8].x= 0; shape[8].y= im;
3697 ctxt->markerType = 2;
3698 }
else if (markerstyle == 43) {
3702 shape[0].x = 0; shape[0].y = im;
3703 shape[1].x = -imx; shape[1].y = imx;
3704 shape[2].x = -im; shape[2].y = 0;
3705 shape[3].x = -imx; shape[3].y = -imx;
3706 shape[4].x = 0; shape[4].y = -im;
3707 shape[5].x = imx; shape[5].y = -imx;
3708 shape[6].x = im; shape[6].y = 0;
3709 shape[7].x = imx; shape[7].y = imx;
3710 shape[8].x = 0; shape[8].y = im;
3711 ctxt->markerType = 3;
3712 }
else if (markerstyle == 44) {
3715 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
3716 shape[0].x = 0; shape[0].y = 0;
3717 shape[1].x = im2; shape[1].y = im;
3718 shape[2].x = -im2; shape[2].y = im;
3719 shape[3].x = im2; shape[3].y = -im;
3720 shape[4].x = -im2; shape[4].y = -im;
3721 shape[5].x = 0; shape[5].y = 0;
3722 shape[6].x = im; shape[6].y = im2;
3723 shape[7].x = im; shape[7].y = -im2;
3724 shape[8].x = -im; shape[8].y = im2;
3725 shape[9].x = -im; shape[9].y = -im2;
3726 shape[10].x = 0; shape[10].y = 0;
3727 ctxt->markerType = 2;
3728 }
else if (markerstyle == 45) {
3731 Int_t im0 =
Int_t(0.4*MarkerSizeReduced + 0.5);
3732 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
3733 shape[0].x = im0; shape[0].y = im0;
3734 shape[1].x = im2; shape[1].y = im;
3735 shape[2].x = -im2; shape[2].y = im;
3736 shape[3].x = -im0; shape[3].y = im0;
3737 shape[4].x = -im; shape[4].y = im2;
3738 shape[5].x = -im; shape[5].y = -im2;
3739 shape[6].x = -im0; shape[6].y = -im0;
3740 shape[7].x = -im2; shape[7].y = -im;
3741 shape[8].x = im2; shape[8].y = -im;
3742 shape[9].x = im0; shape[9].y = -im0;
3743 shape[10].x = im; shape[10].y = -im2;
3744 shape[11].x = im; shape[11].y = im2;
3745 shape[12].x = im0; shape[12].y = im0;
3746 ctxt->markerType = 3;
3747 }
else if (markerstyle == 46) {
3750 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
3751 shape[0].x = 0; shape[0].y = im2;
3752 shape[1].x = -im2; shape[1].y = im;
3753 shape[2].x = -im; shape[2].y = im2;
3754 shape[3].x = -im2; shape[3].y = 0;
3755 shape[4].x = -im; shape[4].y = -im2;
3756 shape[5].x = -im2; shape[5].y = -im;
3757 shape[6].x = 0; shape[6].y = -im2;
3758 shape[7].x = im2; shape[7].y = -im;
3759 shape[8].x = im; shape[8].y = -im2;
3760 shape[9].x = im2; shape[9].y = 0;
3761 shape[10].x = im; shape[10].y = im2;
3762 shape[11].x = im2; shape[11].y = im;
3763 shape[12].x = 0; shape[12].y = im2;
3764 ctxt->markerType = 2;
3765 }
else if (markerstyle == 47) {
3768 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
3769 shape[0].x = 0; shape[0].y = im2;
3770 shape[1].x = -im2; shape[1].y = im;
3771 shape[2].x = -im; shape[2].y = im2;
3772 shape[3].x = -im2; shape[3].y = 0;
3773 shape[4].x = -im; shape[4].y = -im2;
3774 shape[5].x = -im2; shape[5].y = -im;
3775 shape[6].x = 0; shape[6].y = -im2;
3776 shape[7].x = im2; shape[7].y = -im;
3777 shape[8].x = im; shape[8].y = -im2;
3778 shape[9].x = im2; shape[9].y = 0;
3779 shape[10].x = im; shape[10].y = im2;
3780 shape[11].x = im2; shape[11].y = im;
3781 shape[12].x = 0; shape[12].y = im2;
3782 ctxt->markerType = 3;
3783 }
else if (markerstyle == 48) {
3786 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
3787 shape[0].x = 0; shape[0].y = im2*1.005;
3788 shape[1].x = -im2; shape[1].y = im;
3789 shape[2].x = -im; shape[2].y = im2;
3790 shape[3].x = -im2; shape[3].y = 0;
3791 shape[4].x = -im; shape[4].y = -im2;
3792 shape[5].x = -im2; shape[5].y = -im;
3793 shape[6].x = 0; shape[6].y = -im2;
3794 shape[7].x = im2; shape[7].y = -im;
3795 shape[8].x = im; shape[8].y = -im2;
3796 shape[9].x = im2; shape[9].y = 0;
3797 shape[10].x = im; shape[10].y = im2;
3798 shape[11].x = im2; shape[11].y = im;
3799 shape[12].x = 0; shape[12].y = im2*0.995;
3800 shape[13].x = im2*0.995; shape[13].y = 0;
3801 shape[14].x = 0; shape[14].y = -im2*0.995;
3802 shape[15].x = -im2*0.995; shape[15].y = 0;
3803 shape[16].x = 0; shape[16].y = im2*0.995;
3804 ctxt->markerType = 3;
3805 }
else if (markerstyle == 49) {
3808 Int_t imx =
Int_t(1.33*MarkerSizeReduced + 0.5);
3809 shape[0].x =-imx; shape[0].y =-imx*1.005;
3810 shape[1].x =-imx; shape[1].y = -im;
3811 shape[2].x = imx; shape[2].y = -im;
3812 shape[3].x = imx; shape[3].y =-imx;
3813 shape[4].x = im; shape[4].y =-imx;
3814 shape[5].x = im; shape[5].y = imx;
3815 shape[6].x = imx; shape[6].y = imx;
3816 shape[7].x = imx; shape[7].y = im;
3817 shape[8].x =-imx; shape[8].y = im;
3818 shape[9].x =-imx; shape[9].y = imx;
3819 shape[10].x = -im; shape[10].y = imx;
3820 shape[11].x = -im; shape[11].y =-imx;
3821 shape[12].x =-imx; shape[12].y =-imx*0.995;
3822 shape[13].x =-imx; shape[13].y = imx;
3823 shape[14].x = imx; shape[14].y = imx;
3824 shape[15].x = imx; shape[15].y =-imx;
3825 shape[16].x =-imx; shape[16].y =-imx*1.005;
3826 ctxt->markerType = 3;
3830 ctxt->markerType = 0;
3831 ctxt->markerSize = 0;
3854 ctxt->textAlign =
kBLeft;
3857 ctxt->textAlign =
kMLeft;
3860 ctxt->textAlign =
kTLeft;
3895 if (XGetGCValues((Display*)
fDisplay, ctxt->fGClist[
kGCtext], GCForeground | GCBackground, &values)) {
3896 XSetForeground( (Display*)
fDisplay, ctxt->fGClist[
kGCinvt], values.background );
3897 XSetBackground( (Display*)
fDisplay, ctxt->fGClist[
kGCinvt], values.foreground );
3899 Error(
"SetAttText",
"cannot get GC values");
3906 ctxt->textFont =
gFont[i].id;
3907 XSetFont((Display*)
fDisplay, ctxt->fGClist[
kGCtext], ctxt->textFont->fid);
3908 XSetFont((Display*)
fDisplay, ctxt->fGClist[
kGCinvt], ctxt->textFont->fid);
3912 ctxt->fAttText = att;
3926 auto gxmode = GXcopy;
3931 for (
int i = 0; i <
kMAXGC; i++)
3932 XSetFunction((Display*)
fDisplay, ctxt->fGClist[i], gxmode);
3934 ctxt->drawMode = mode;
3943 return ctxt ? ctxt->drawMode :
kCopy;
Handle_t WinContext_t
Window drawing context.
Handle_t Pixmap_t
Pixmap handle.
Handle_t Drawable_t
Drawable handle.
Handle_t Window_t
Window handle.
const unsigned char gStipples[26][32]
int XRotDrawAlignedImageString(Display *, XFontStruct *, float, Drawable, GC, int, int, char *, int)
A front end to XRotPaintAlignedString: -does alignment, paints background.
int XRotDrawAlignedString(Display *, XFontStruct *, float, Drawable, GC, int, int, char *, int)
A front end to XRotPaintAlignedString: -does alignment, no background.
XPoint * XRotTextExtents(Display *, XFontStruct *, float, int, int, char *, int)
Calculate the bounding box some text will have when painted.
void XRotSetMagnification(float)
Set the font magnification factor for all subsequent operations.
unsigned short UShort_t
Unsigned Short integer 2 bytes (unsigned short).
int Int_t
Signed integer 4 bytes (int).
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char).
constexpr ULong_t kBitsPerByte
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
int Seek_t
File pointer (int).
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
short Width_t
Line width (short).
bool Bool_t
Boolean (0=false, 1=true) (bool).
short Font_t
Font number (short).
short Short_t
Signed Short integer 2 bytes (short).
double Double_t
Double 8 bytes.
short Color_t
Color number (short).
long long Long64_t
Portable signed long integer 8 bytes.
short Style_t
Style number (short).
float Float_t
Float 4 bytes (float).
XPoint * XRotTextExtents(Display *, XFontStruct *, float, int, int, char *, int)
Calculate the bounding box some text will have when painted.
static int gMarkerJoinStyle
static int gMarkerLineStyle
float XRotVersion(char *, int)
Return version/copyright information.
static ULong_t gKeybdMask
void XRotSetMagnification(float)
Set the font magnification factor for all subsequent operations.
static Cursor gNullCursor
const char null_cursor_bits[]
int XRotDrawString(Display *, XFontStruct *, float, Drawable, GC, int, int, char *)
A front end to XRotPaintAlignedString: -no alignment, no background.
const Int_t kBIGGEST_RGB_VALUE
static struct @106043032323167054144317363033145345356333274174 gFont[kMAXFONT]
int XRotDrawAlignedImageString(Display *, XFontStruct *, float, Drawable, GC, int, int, char *, int)
A front end to XRotPaintAlignedString: -does alignment, paints background.
static ULong_t gMouseMask
static Int_t gCurrentFontNumber
int XRotDrawAlignedString(Display *, XFontStruct *, float, Drawable, GC, int, int, char *, int)
A front end to XRotPaintAlignedString: -does alignment, no background.
int XRotDrawImageString(Display *, XFontStruct *, float, Drawable, GC, int, int, char *)
A front end to XRotPaintAlignedString: -no alignment, paints background.
static int gMarkerCapStyle
static XFontStruct * gTextFont
void XRotSetBoundingBoxPad(int)
Set the padding used when calculating bounding boxes.
static Int_t DummyX11ErrorHandler(Display *, XErrorEvent *)
Dummy error handler for X11. Used by FindUsableVisual().
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
virtual Color_t GetFillColor() const
Return the fill area color.
virtual Style_t GetFillStyle() const
Return the fill area style.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
virtual Color_t GetLineColor() const
Return the line color.
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
virtual Width_t GetLineWidth() const
Return the line width.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual Style_t GetLineStyle() const
Return the line style.
virtual Style_t GetMarkerStyle() const
Return the marker style.
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
virtual Color_t GetMarkerColor() const
Return the marker color.
virtual Size_t GetMarkerSize() const
Return the marker size.
static Style_t GetMarkerStyleBase(Style_t style)
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
static Width_t GetMarkerLineWidth(Style_t style)
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
virtual Short_t GetTextAlign() const
Return the text alignment.
Float_t fTextAngle
Text angle.
virtual Color_t GetTextColor() const
Return the text color.
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
Bool_t Next(ULong64_t &hash, Long64_t &key, Long64_t &value)
Get next entry from TExMap. Returns kFALSE at end of map.
This class stores a (key,value) pair using an external hash.
void DrawFillArea(Int_t n, TPoint *xy) override
Fill area described by polygon.
void * fDisplay
Pointer to display.
void DrawBoxW(WinContext_t wctxt, Int_t x1, Int_t y1, Int_t x2, Int_t y2, EBoxMode mode) override
Draw a box on specified window.
const TAttText & GetTextAttW(WinContext_t wctxt) const
Return text attributes for specified window context.
void SetLineColor(Color_t cindex) override
Set color index for lines.
void GetGeometry(Int_t wid, Int_t &x, Int_t &y, UInt_t &w, UInt_t &h) override
Return position and size of window wid.
Colormap fColormap
Default colormap, 0 if b/w.
std::unordered_map< Int_t, std::unique_ptr< XWindow_t > > fWindows
Window_t GetWindowID(Int_t wid) override
Return the X11 window identifier.
Int_t WriteGIF(char *name) override
Writes the current window into GIF file.
void SetFillColor(Color_t cindex) override
Set color index for fill areas.
void ResizeWindow(Int_t wid) override
Resize the current window if necessary.
Pixmap_t CreatePixmap(Drawable_t id, UInt_t w, UInt_t h) override
Creates a pixmap of the width and height you specified and returns a pixmap ID that identifies it.
void SetTextAlign(Short_t talign=11) override
Set text alignment.
void RescaleWindow(Int_t wid, UInt_t w, UInt_t h) override
Rescale the window wid.
void SetCursor(Int_t win, ECursor cursor) override
Set the cursor.
Int_t fScreenNumber
Screen number.
void Sync(Int_t mode) override
Set synchronisation on or off.
Pixmap_t CreatePixmapFromData(unsigned char *bits, UInt_t width, UInt_t height) override
create pixmap from RGB data.
WinContext_t GetWindowContext(Int_t wid) override
Returns window context for specified window id Window context is valid until window not closed or des...
TGX11(TGX11 &&org)
Copy constructor. Currently only used by TGX11TTF.
unsigned char * GetColorBits(Drawable_t wid, Int_t x=0, Int_t y=0, UInt_t w=0, UInt_t h=0) override
Returns an array of pixels created from a part of drawable (defined by x, y, w, h) in format: b1,...
Int_t WriteGIFW(WinContext_t wctxt, const char *name) override
Writes the specified window into GIF file.
ULong_t fWhitePixel
Value of white pixel in colormap.
Cursor fCursors[kNumCursors]
List of cursors.
Bool_t AllocColor(Colormap cmap, RXColor *color)
Allocate color in colormap.
void DrawText(Int_t x, Int_t y, Float_t angle, Float_t mgn, const char *text, ETextMode mode) override
Draw a text string using current font.
Bool_t GetTextExtentA(Font_t font, Double_t size, UInt_t &w, UInt_t &h, const char *mess) override
Return the size of a character string for specified font and size On plain X11 font and size is ignor...
void QueryColors(Colormap cmap, RXColor *colors, Int_t ncolors)
Returns the current RGB value for the pixel in the XColor structure.
Int_t fBlueShift
Bits to left shift blue.
void SetMarkerColor(Color_t cindex) override
Set color index for markers.
void DrawFillAreaW(WinContext_t wctxt, Int_t n, TPoint *xy) override
Fill area described by polygon on specified window.
void SetAttText(WinContext_t wctxt, const TAttText &att) override
Set text attributes for specified window.
void Warp(Int_t ix, Int_t iy, Window_t id=0) override
Set pointer position.
void * GetGC(Int_t which) const
Return desired Graphics Context ("which" maps directly on gGCList[]).
void SetOpacityW(WinContext_t wctxt, Int_t percent) override
Set opacity of a specified window.
void SetClipOFF(Int_t wid) override
Turn off the clipping for the window wid.
Int_t ResizePixmap(Int_t wid, UInt_t w, UInt_t h) override
Resize a pixmap.
void SetDoubleBufferOFF() override
Turn double buffer mode off.
void DrawTextW(WinContext_t wctxt, Int_t x, Int_t y, Float_t angle, Float_t mgn, const char *text, ETextMode mode) override
Draw a text string using current font on specified window.
void SetTextColor(Color_t cindex) override
Set color index for text.
void UpdateWindow(Int_t mode) override
Update display.
Bool_t fHasXft
True when XftFonts are used.
Int_t SupportsExtension(const char *ext) const override
Returns 1 if window system server supports extension given by the argument, returns 0 in case extensi...
Int_t InitWindow(ULong_t window) override
Open window and return window number.
Style_t GetLineStyle() const override
Return current line style.
~TGX11() override
Destructor.
void MoveWindow(Int_t wid, Int_t x, Int_t y) override
Move the window wid.
Int_t SetTextFont(char *fontname, ETextSetMode mode) override
Set text font to specified name.
void SetFillStyle(Style_t style) override
Set fill area style.
void CopyPixmapW(WinContext_t wctxt, Int_t wid, Int_t xpos, Int_t ypos) override
Copy the pixmap wid at the position xpos, ypos in the specified window.
Float_t fTextMagnitude
Text Magnitude.
void SetCharacterUp(Float_t chupx, Float_t chupy) override
Set character up vector.
Drawable fRootWin
Root window used as parent of all windows.
void WritePixmap(Int_t wid, UInt_t w, UInt_t h, char *pxname) override
Write the pixmap wid in the bitmap file pxname.
void DrawPolyLineW(WinContext_t wctxt, Int_t n, TPoint *xy) override
Draw a line through all points on specified window.
void SetInput(Int_t inp)
Set input on or off.
void GetPlanes(Int_t &nplanes) override
Get maximum number of planes.
void ClearWindow() override
Clear current window.
void * fXEvent
Current native (X11) event.
Int_t fGreenShift
Bits to left shift green.
void DrawBox(Int_t x1, Int_t y1, Int_t x2, Int_t y2, EBoxMode mode) override
Draw a box.
void CopyPixmap(Int_t wid, Int_t xpos, Int_t ypos) override
Copy the pixmap wid at the position xpos, ypos in the current window.
void SetOpacity(Int_t percent) override
Set opacity of a selected window.
Style_t GetFillStyle() const override
Return current fill style.
void DrawPolyMarkerW(WinContext_t wctxt, Int_t n, TPoint *xy) override
Draw n markers with the current attributes at position x, y on specified window.
Int_t OpenPixmap(UInt_t w, UInt_t h) override
Open a new pixmap.
XColor_t & GetColor(Int_t cid)
Return reference to internal color structure associated to color index cid.
void * GetGCW(WinContext_t wctxt, Int_t which) const
Return X11 Graphics Context for specified window context.
void SetAttMarker(WinContext_t wctxt, const TAttMarker &att) override
Set marker attributes for specified window.
Int_t fBlueDiv
Blue value divider.
void DrawPolyMarker(Int_t n, TPoint *xy) override
Draw n markers with the current attributes at position x, y.
void UpdateWindowW(WinContext_t wctxt, Int_t mode) override
Update display for specified window.
void CloseWindow() override
Delete current window.
void SetMarkerSize(Float_t markersize) override
Set marker size index.
void SetAttLine(WinContext_t wctxt, const TAttLine &att) override
Set line attributes for specified window.
Drawable fVisRootWin
Root window with fVisual to be used to create GC's and XImages.
void SetDoubleBufferON() override
Turn double buffer mode on.
void SetColor(XWindow_t *ctxt, void *gc, Int_t ci)
Set the foreground color in GC.
TExMap * fColors
Hash list of colors.
void DrawLinesSegments(Int_t n, TPoint *xy) override
Draws N segments between provided points.
void SetAttFill(WinContext_t wctxt, const TAttFill &att) override
Set fill attributes for specified window.
void SetDrawModeW(WinContext_t wctxt, EDrawMode mode) override
Set window draw mode.
Int_t fRedDiv
Red value divider, -1 if no TrueColor visual.
Int_t fDepth
Number of color planes.
Color_t GetFillColor() const override
Return current fill color.
Bool_t Init(void *display) override
Initialize X11 system. Returns kFALSE in case of failure.
void SetLineType(Int_t n, Int_t *dash) override
Set line type.
Window_t GetWindow(WinContext_t wctxt) const
Return X11 window for specified window context.
ULong_t fBlackPixel
Value of black pixel in colormap.
void SetTextSize(Float_t textsize) override
Set current text size.
Float_t fCharacterUpX
Character Up vector along X.
void DrawCellArray(Int_t x1, Int_t y1, Int_t x2, Int_t y2, Int_t nx, Int_t ny, Int_t *ic) override
Draw a cell array.
void SetLineStyle(Style_t linestyle) override
Set line style.
Int_t fGreenDiv
Green value divider.
EDrawMode GetDrawModeW(WinContext_t wctxt) override
Returns window draw mode.
void QueryPointer(Int_t &ix, Int_t &iy) override
Query pointer position.
ULong_t GetPixel(Color_t cindex) override
Return pixel value associated to specified ROOT color number.
TGX11()
Default constructor.
void GetTextExtent(UInt_t &w, UInt_t &h, char *mess) override
Return the size of a character string.
void ClosePixmap() override
Delete current pixmap.
Int_t fRedShift
Bits to left shift red, -1 if no TrueColor visual.
Int_t RequestLocator(Int_t mode, Int_t ctyp, Int_t &x, Int_t &y) override
Request Locator position.
Int_t OpenDisplay(void *display)
Open the display. Return -1 if the opening fails, 0 when ok.
void DrawPolyLine(Int_t n, TPoint *xy) override
Draw a line through all points.
void SetClipRegion(Int_t wid, Int_t x, Int_t y, UInt_t w, UInt_t h) override
Set clipping region for the window wid.
Int_t AddPixmap(ULong_t pixid, UInt_t w, UInt_t h) override
Register pixmap created by gVirtualGL.
void SetRGB(Int_t cindex, Float_t r, Float_t g, Float_t b) override
Set color intensities for given color index.
void FindUsableVisual(RXVisualInfo *vlist, Int_t nitems)
Check if visual is usable, if so set fVisual, fDepth, fColormap, fBlackPixel and fWhitePixel.
EAlign GetTextAlignW(WinContext_t wctxt) const
Return text align value for specified window context.
void DrawLineW(WinContext_t wctxt, Int_t x1, Int_t y1, Int_t x2, Int_t y2) override
Draw a line on specified window.
void GetCharacterUp(Float_t &chupx, Float_t &chupy) override
Return character up vector.
void SetDoubleBuffer(Int_t wid, Int_t mode) override
Set the double buffer on/off on window wid.
void DrawLinesSegmentsW(WinContext_t wctxt, Int_t n, TPoint *xy) override
Draws N segments between provided points on specified windows.
void SetMarkerStyle(Style_t markerstyle) override
Set marker style.
void GetRGB(Int_t index, Float_t &r, Float_t &g, Float_t &b) override
Get rgb values for color "index".
void ClearWindowW(WinContext_t wctxt) override
Clear specified window.
RVisual * fVisual
Pointer to visual used by all windows.
Width_t GetLineWidth() const override
Return current line width.
void DrawLine(Int_t x1, Int_t y1, Int_t x2, Int_t y2) override
Draw a line.
Window_t GetCurrentWindow() const override
Return current window pointer.
void RemoveWindow(ULong_t qwid) override
Remove a window created by Qt (like CloseWindow()).
Int_t RequestString(Int_t x, Int_t y, char *text) override
Request a string.
void SetLineWidth(Width_t width) override
Set line width.
void PutImage(Int_t offset, Int_t itran, Int_t x0, Int_t y0, Int_t nx, Int_t ny, Int_t xmin, Int_t ymin, Int_t xmax, Int_t ymax, UChar_t *image, Drawable_t id)
Draw image.
Int_t GetDoubleBuffer(Int_t wid) override
Query the double buffer value for the window wid.
void FindBestVisual()
Find best visual, i.e.
void SetDrawMode(EDrawMode mode) override
Set the drawing mode.
const char * DisplayName(const char *dpyName=nullptr) override
Return hostname on which the display is opened.
Pixmap_t ReadGIF(Int_t x0, Int_t y0, const char *file, Window_t id=0) override
If id is NULL - loads the specified gif file at position [x0,y0] in the current window.
Int_t AddWindow(ULong_t qwid, UInt_t w, UInt_t h) override
Register a window created by Qt as a ROOT window (like InitWindow()).
Int_t AddWindowHandle()
Add new window handle Only for private usage.
Float_t fCharacterUpY
Character Up vector along Y.
Bool_t fHasTTFonts
True when TrueType fonts are used.
void SelectWindow(Int_t wid) override
Select window to which subsequent output is directed.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Helper class to extract pixel information from XImage for store in the GIF.
TX11GifEncode(XImage *image)
void get_scline(int y, int width, unsigned char *buf) override
std::vector< ULong_t > orgcolors
Double_t ACos(Double_t)
Returns the principal value of the arc cosine of x, expressed in radians.
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Double_t Floor(Double_t x)
Rounds x downward, returning the largest integral value that is not greater than x.
Double_t Sqrt(Double_t x)
Returns the square root of x.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Description of a X11 color.
Bool_t fDefined
true if pixel value is defined
UShort_t fRed
red value in range [0,kBIGGEST_RGB_VALUE]
UShort_t fGreen
green value
ULong_t fPixel
color pixel value
Description of a X11 window.
Int_t fOpen
1 if the window is open, 0 if not
TAttText fAttText
current text attributes
EAlign textAlign
selected text align
Int_t fClip
1 if the clipping is on
Drawable fWindow
X11 window.
std::vector< gint8 > dashList
Gtk array for dashes.
Int_t lineWidth
current line width
Int_t dashOffset
current dash offset
Int_t fillFasi
fasi parameter for fill pattern
Drawable fDrawing
drawing area, equal to window or buffer
Int_t markerLineWidth
line width used for marker
Int_t fDoubleBuffer
1 if the double buffer is on, 0 if not
XFontStruct * textFont
selected text font
UInt_t fHeight
height of the window
Int_t fIsPixmap
1 if pixmap, 0 if not
Int_t fillHollow
Flag if fill style is hollow.
UInt_t fWidth
width of the window
TVirtualX::EDrawMode drawMode
current draw mode
UInt_t fHclip
height of the clipping rectangle
Int_t dashLength
total length of dashes
Bool_t fShared
notify when window is shared
Drawable fBuffer
pixmap used for double buffer
GdkGC * fGClist[kMAXGC]
array of GC objects for concrete window
Int_t markerSize
size of simple markers
GdkLineStyle lineStyle
current line style
TAttLine fAttLine
current line attributes
std::vector< ULong_t > fNewColors
extra image colors created for transparency (after processing)
Int_t markerType
4 differen kinds of marker
TAttMarker fAttMarker
current marker attribute
GdkPixmap * fillPattern
current fill pattern
Int_t fXclip
x coordinate of the clipping rectangle
TAttFill fAttFill
current fill attributes
UInt_t fWclip
width of the clipping rectangle
std::vector< GdkPoint > markerShape
marker shape points
Int_t fYclip
y coordinate of the clipping rectangle