51#include <X11/cursorfont.h>
52#include <X11/keysym.h>
61# include <sys/socket.h>
76 int,
int,
char*,
int);
145 EnterWindowMask | LeaveWindowMask |
146 PointerMotionMask | KeyPressMask |
149 EnterWindowMask | LeaveWindowMask;
1550x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1560x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1570x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
160struct RXGCValues:XGCValues{};
161struct RXColor:XColor{};
162struct RXImage:XImage{};
163struct RXPoint:XPoint{};
164struct RXVisualInfo:XVisualInfo{};
165struct RVisual:Visual{};
285 fWindows[i].fDoubleBuffer =
org.fWindows[i].fDoubleBuffer;
297 fWindows[i].fNewColors =
org.fWindows[i].fNewColors;
308 while (it.Next(key, value)) {
331 while (it.
Next(key, value)) {
368 if (XAllocColor((Display*)
fDisplay, cmap, color))
385 XQueryColors((Display*)
fDisplay, cmap, color, ncolors);
388 for (
Int_t i = 0; i < ncolors; i++) {
398 color[i].flags = DoRed | DoGreen | DoBlue;
410 unsigned int ww, hh, border, depth;
411 XGetGeometry((Display*)
fDisplay, *pix, &root, &xx, &yy, &ww, &hh, &border, &depth);
423 if (!
gCws->fIsPixmap && !
gCws->fDoubleBuffer) {
471 if (
gCws->fNewColors) {
474 delete []
gCws->fNewColors;
475 gCws->fNewColors = 0;
500 gTws->fHeight, xpos, ypos);
511 unsigned int ww, hh, border, depth;
513 XGetGeometry((Display*)
fDisplay, *pix, &root, &xx, &yy, &ww, &hh, &border, &depth);
560 int i, j, icol, ix, iy, w,
h, current_icol;
567 for (i = 0; i < nx; i++) {
569 for (j = 0; j < ny; j++) {
571 if (icol != current_icol) {
590 XPoint *
xy = (XPoint*)xyt;
597 xy,
n, Nonconvex, CoordModeOrigin);
625 XPoint *
xy = (XPoint*)xyt;
627 const Int_t kMaxPoints = 1000001;
629 if (
n > kMaxPoints) {
631 int iend = kMaxPoints - 1;
635 iend += kMaxPoints - 1;
651 for (i = 1; i <
n; i++) {
652 int dx =
xy[i].x -
xy[i-1].x;
653 int dy =
xy[i].y -
xy[i-1].y;
654 if (dx < 0) dx = - dx;
655 if (dy < 0) dy = - dy;
677 XPoint *
xy = (XPoint*)xyt;
680 const int kNMAX = 1000000;
682 for (
int it=0;it<=nt;it++) {
693 for (
m = 0;
m <
n;
m++) {
712 for (i = 0; i <
gMarker.n; i++) {
722 for (i = 0; i <
gMarker.n; i++) {
729 for (i = 0; i <
gMarker.n; i += 2)
784 if (((vis->c_class != TrueColor && vis->c_class != DirectColor) ||
788 static XVisualInfo templates[] = {
790 { 0 , 0 , 0 , 24 , TrueColor , 0 , 0 , 0 , 0 , 0 },
791 { 0 , 0 , 0 , 32 , TrueColor , 0 , 0 , 0 , 0 , 0 },
792 { 0 , 0 , 0 , 16 , TrueColor , 0 , 0 , 0 , 0 , 0 },
793 { 0 , 0 , 0 , 15 , TrueColor , 0 , 0 , 0 , 0 , 0 },
795 { 0 , 0 , 0 , 24 , DirectColor, 0 , 0 , 0 , 0 , 0 },
796 { 0 , 0 , 0 , 32 , DirectColor, 0 , 0 , 0 , 0 , 0 },
797 { 0 , 0 , 0 , 16 , DirectColor, 0 , 0 , 0 , 0 , 0 },
798 { 0 , 0 , 0 , 15 , DirectColor, 0 , 0 , 0 , 0 , 0 },
799 { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },
803 XVisualInfo *vlist = 0;
804 for (
Int_t i = 0; templates[i].depth != 0; i++) {
805 Int_t mask = VisualScreenMask|VisualDepthMask|VisualClassMask;
807 if ((vlist = XGetVisualInfo((Display*)
fDisplay, mask, &(templates[i]), &nitems))) {
829 Printf(
"Selected visual 0x%lx: depth %d, class %d, colormap: %s",
849 Int_t (*oldErrorHandler)(Display *, XErrorEvent *) =
852 XSetWindowAttributes attr;
853 memset(&attr, 0,
sizeof(attr));
857 for (
Int_t i = 0; i < nitems; i++) {
866 attr.colormap = XCreateColormap((Display*)
fDisplay, root, vlist[i].visual, AllocNone);
869 static XColor black_xcol = { 0, 0x0000, 0x0000, 0x0000, DoRed|DoGreen|DoBlue, 0 };
870 static XColor white_xcol = { 0, 0xFFFF, 0xFFFF, 0xFFFF, DoRed|DoGreen|DoBlue, 0 };
871 XAllocColor((Display*)
fDisplay, attr.colormap, &black_xcol);
872 XAllocColor((Display*)
fDisplay, attr.colormap, &white_xcol);
873 attr.border_pixel = black_xcol.pixel;
874 attr.override_redirect =
True;
876 w = XCreateWindow((Display*)
fDisplay, root, -20, -20, 10, 10, 0, vlist[i].depth,
877 CopyFromParent, vlist[i].visual,
878 CWColormap|CWBorderPixel|CWOverrideRedirect, &attr);
879 if (w != None && XGetGeometry((Display*)
fDisplay, w, &wjunk, &junk, &junk,
880 &
width, &height, &ujunk, &ujunk)) {
881 fVisual = (RVisual*)vlist[i].visual;
890 XFreeColormap((Display*)
fDisplay, attr.colormap);
892 XSetErrorHandler(oldErrorHandler);
932 if (which >=
kMAXGC || which < 0) {
933 Error(
"GetGC",
"trying to get illegal GC (which = %d)", which);
948 return gTws->fDoubleBuffer;
971 unsigned int border, depth;
972 unsigned int width, height;
976 &
width, &height, &border, &depth);
978 0, 0, &
x, &
y, &junkwin);
983 if (
width > 0 && height > 0) {
985 gTws->fHeight = height;
997 return XDisplayName(dpyName);
1030 }
else if (index == 1) {
1050 if (strlen(mess)==0)
return;
1082 if (!
gTws->fOpen)
return;
1092 Pixmap pixmp1, pixmp2;
1112 strlcpy(vendor, XServerVendor((Display*)
fDisplay),132);
1115 for (i = 0; i <
kMAXGC; i++)
1119 if (XGetGCValues((Display*)
fDisplay, *
gGCtext, GCForeground|GCBackground, &values)) {
1123 Error(
"OpenDisplay",
"cannot get GC values");
1135 if (strstr(vendor,
"Hewlett"))
1136 echov.function = GXxor;
1138 echov.function = GXinvert;
1141 GCForeground | GCBackground | GCFunction,
1145 static int isdisp = 0;
1151 fontlist = XListFonts((Display*)
fDisplay,
"*courier*", 1, &fontcount);
1152 if (fontlist && fontcount != 0) {
1157 XFreeFontNames(fontlist);
1160 fontlist = XListFonts((Display*)
fDisplay,
"fixed", 1, &fontcount);
1161 if (fontlist && fontcount != 0) {
1166 XFreeFontNames(fontlist);
1168 Warning(
"OpenDisplay",
"no default font loaded");
1205 if (
fVisual->c_class == TrueColor) {
1209 if ((
fVisual->blue_mask >> i) == 1) {
1217 if ((
fVisual->green_mask >> i) == 1) {
1225 if ((
fVisual->red_mask >> i) == 1) {
1245 unsigned int wval, hval;
1247 unsigned int ww, hh, border, depth;
1272 XGetGeometry((Display*)
fDisplay,
gCws->fWindow, &root, &xx, &yy, &ww, &hh, &border, &depth);
1274 for (i = 0; i <
kMAXGC; i++)
1284 gCws->fDoubleBuffer = 0;
1285 gCws->fIsPixmap = 1;
1287 gCws->fWidth = wval;
1288 gCws->fHeight = hval;
1289 gCws->fNewColors = 0;
1302 XSetWindowAttributes attributes;
1306 unsigned int wval, hval, border, depth;
1311 XGetGeometry((Display*)
fDisplay, wind, &root, &xval, &yval, &wval, &hval, &border, &depth);
1337 attr_mask |= CWBackPixel;
1339 attr_mask |= CWBorderPixel;
1340 attributes.event_mask = NoEventMask;
1341 attr_mask |= CWEventMask;
1342 attributes.backing_store = Always;
1343 attr_mask |= CWBackingStore;
1344 attributes.bit_gravity = NorthWestGravity;
1345 attr_mask |= CWBitGravity;
1348 attr_mask |= CWColormap;
1351 gCws->fWindow = XCreateWindow((Display*)
fDisplay, wind,
1352 xval, yval, wval, hval, 0,
fDepth,
1354 attr_mask, &attributes);
1363 gCws->fDoubleBuffer = 0;
1364 gCws->fIsPixmap = 0;
1366 gCws->fWidth = wval;
1367 gCws->fHeight = hval;
1368 gCws->fNewColors = 0;
1402 gCws->fWindow = qwid;
1407 gCws->fDoubleBuffer = 0;
1408 gCws->fIsPixmap = 0;
1412 gCws->fNewColors = 0;
1427 if (
gCws->fNewColors) {
1430 delete []
gCws->fNewColors;
1431 gCws->fNewColors = 0;
1455 Window root_return, child_return;
1456 int win_x_return, win_y_return;
1457 int root_x_return, root_y_return;
1458 unsigned int mask_return;
1460 XQueryPointer((Display*)
fDisplay,
gCws->fWindow, &root_return,
1461 &child_return, &root_x_return, &root_y_return, &win_x_return,
1462 &win_y_return, &mask_return);
1473 XFreePixmap((Display*)
fDisplay,*pix);
1506 static int xloc = 0;
1507 static int yloc = 0;
1508 static int xlocp = 0;
1509 static int ylocp = 0;
1510 static Cursor cursor = 0;
1522 cursor = XCreateFontCursor((Display*)
fDisplay, XC_crosshair);
1523 XDefineCursor((Display*)
fDisplay,
gCws->fWindow, cursor);
1531 while (button_press == 0) {
1540 xloc, 0, xloc,
gCws->fHeight);
1542 0, yloc,
gCws->fWidth, yloc);
1547 (yloc-ylocp)*(yloc-ylocp)));
1549 xlocp-radius, ylocp-radius,
1550 2*radius, 2*radius, 0, 23040);
1555 xlocp, ylocp, xloc, yloc);
1568 while (XEventsQueued( (Display*)
fDisplay, QueuedAlready) > 1) {
1569 XNextEvent((Display*)
fDisplay, &event);
1580 xloc, 0, xloc,
gCws->fHeight);
1582 0, yloc,
gCws->fWidth, yloc);
1587 (yloc-ylocp)*(yloc-ylocp)));
1589 xlocp-radius, ylocp-radius,
1590 2*radius, 2*radius, 0, 23040);
1595 xlocp, ylocp, xloc, yloc);
1608 xloc =
event.xbutton.x;
1609 yloc =
event.xbutton.y;
1611 switch (event.type) {
1616 XNextEvent((Display*)
fDisplay, &event);
1617 if (event.type == EnterNotify)
break;
1625 button_press =
event.xbutton.button ;
1626 xlocp =
event.xbutton.x;
1627 ylocp =
event.xbutton.y;
1632 case ButtonRelease :
1634 button_press = 10+
event.xbutton.button ;
1635 xlocp =
event.xbutton.x;
1636 ylocp =
event.xbutton.y;
1642 button_press =
event.xkey.keycode;
1643 xlocp =
event.xbutton.x;
1644 ylocp =
event.xbutton.y;
1650 button_press = -
event.xkey.keycode;
1651 xlocp =
event.xbutton.x;
1652 ylocp =
event.xbutton.y;
1661 if (button_press == 0)
1666 x =
event.xbutton.x;
1667 y =
event.xbutton.y;
1669 return button_press;
1684 static Cursor cursor = 0;
1685 static int percent = 0;
1691 int len_text = strlen(
text);
1697 XKeyboardState kbstate;
1698 cursor = XCreateFontCursor((Display*)
fDisplay, XC_question_arrow);
1699 XGetKeyboardControl((Display*)
fDisplay, &kbstate);
1700 percent = kbstate.bell_percent;
1703 XDefineCursor((Display*)
fDisplay,
gCws->fWindow, cursor);
1704 for (nt = len_text; nt > 0 &&
text[nt-1] ==
' '; nt--) { }
1706 XGetInputFocus((Display*)
fDisplay, &focuswindow, &focusrevert);
1707 XSetInputFocus((Display*)
fDisplay,
gCws->fWindow, focusrevert, CurrentTime);
1718 x + dx,
y,
pt < len_text ? &
text[
pt] :
" ", 1);
1720 switch (event.type) {
1723 XSetInputFocus((Display*)
fDisplay,
gCws->fWindow, focusrevert, CurrentTime);
1726 XSetInputFocus((Display*)
fDisplay, focuswindow, focusrevert, CurrentTime);
1729 nbytes = XLookupString(&event.xkey, keybuf,
sizeof(keybuf),
1742 if (isascii(keybuf[0]) && isprint(keybuf[0])) {
1746 for (i = nt - 1; i >
pt; i--)
1748 if (
pt < len_text) {
1753 switch (keybuf[0]) {
1760 for (i =
pt; i < nt; i++)
1779 for (i =
pt; i < nt; i++)
1797 for (i =
pt; i < nt; i++)
1818 XBell((Display*)
fDisplay, percent);
1823 XSetInputFocus((Display*)
fDisplay, focuswindow, focusrevert, CurrentTime);
1845 if (!
gTws->fOpen)
return;
1848 if (
gTws->fWidth == w &&
gTws->fHeight ==
h)
return;
1852 if (
gTws->fBuffer) {
1854 if (
gTws->fWidth < w ||
gTws->fHeight <
h) {
1862 if (
gTws->fDoubleBuffer)
gTws->fDrawing =
gTws->fBuffer;
1877 unsigned int wval, hval;
1879 unsigned int ww, hh, border, depth;
1890 if (
gTws->fWidth >= wval-1 &&
gTws->fWidth <= wval+1 &&
1891 gTws->fHeight >= hval-1 &&
gTws->fHeight <= hval+1)
return 0;
1894 if (
gTws->fWidth < wval ||
gTws->fHeight < hval) {
1898 XGetGeometry((Display*)
fDisplay,
gTws->fWindow, &root, &xx, &yy, &ww, &hh, &border, &depth);
1900 for (i = 0; i <
kMAXGC; i++)
1909 gTws->fWidth = wval;
1910 gTws->fHeight = hval;
1923 unsigned int wval=0, hval=0, border=0, depth=0;
1927 win =
gTws->fWindow;
1929 XGetGeometry((Display*)
fDisplay, win, &root,
1930 &xval, &yval, &wval, &hval, &border, &depth);
1931 if (wval >= 65500) wval = 1;
1932 if (hval >= 65500) hval = 1;
1935 if (
gTws->fWidth == wval &&
gTws->fHeight == hval)
return;
1937 XResizeWindow((Display*)
fDisplay,
gTws->fWindow, wval, hval);
1939 if (
gTws->fBuffer) {
1940 if (
gTws->fWidth < wval ||
gTws->fHeight < hval) {
1948 if (
gTws->fDoubleBuffer)
gTws->fDrawing =
gTws->fBuffer;
1950 gTws->fWidth = wval;
1951 gTws->fHeight = hval;
1966 if (
gCws->fClip && !
gCws->fIsPixmap && !
gCws->fDoubleBuffer) {
1967 region.x =
gCws->fXclip;
1968 region.y =
gCws->fYclip;
1969 region.width =
gCws->fWclip;
1970 region.height =
gCws->fHclip;
1971 for (i = 0; i <
kMAXGC; i++)
1972 XSetClipRectangles((Display*)
fDisplay,
gGClist[i], 0, 0, ®ion, 1, YXBanded);
1974 for (i = 0; i <
kMAXGC; i++)
1986 if (chupx == 0 && chupy == 0)
fTextAngle = 0;
1987 else if (chupx == 0 && chupy == 1)
fTextAngle = 0;
1988 else if (chupx == -1 && chupy == 0)
fTextAngle = 90;
1989 else if (chupx == 0 && chupy == -1)
fTextAngle = 180;
1990 else if (chupx == 1 && chupy == 0)
fTextAngle = 270;
2008 for (
int i = 0; i <
kMAXGC; i++)
2028 if (
gTws->fClip && !
gTws->fIsPixmap && !
gTws->fDoubleBuffer) {
2030 region.x =
gTws->fXclip;
2031 region.y =
gTws->fYclip;
2032 region.width =
gTws->fWclip;
2033 region.height =
gTws->fHclip;
2034 for (
int i = 0; i <
kMAXGC; i++)
2035 XSetClipRectangles((Display*)
fDisplay,
gGClist[i], 0, 0, ®ion, 1, YXBanded);
2053 }
else if (!
fColormap && (ci < 0 || ci > 1)) {
2059 XGetGCValues((Display*)
fDisplay, gc, GCBackground, &values);
2060 XSetForeground((Display*)
fDisplay, gc, col.
fPixel ^ values.background);
2066 XGetGCValues((Display*)
fDisplay, gc, GCForeground | GCBackground, &values);
2067 if (values.foreground == values.background)
2108 if (!
gTws->fOpen)
return;
2125 if (!
gTws->fDoubleBuffer)
return;
2126 gTws->fDoubleBuffer = 0;
2135 if (
gTws->fDoubleBuffer ||
gTws->fIsPixmap)
return;
2136 if (!
gTws->fBuffer) {
2144 gTws->fDoubleBuffer = 1;
2206 Int_t fasi = fstyle%1000;
2215 static int current_fasi = 0;
2233 if (fasi != current_fasi) {
2238 int stn = (fasi >= 1 && fasi <=25) ? fasi : 2;
2244 current_fasi = fasi;
2258 XSetWindowAttributes attributes;
2263 attr_mask = CWEventMask;
2264 XChangeWindowAttributes((Display*)
fDisplay,
gCws->fWindow, attr_mask, &attributes);
2266 attributes.event_mask = NoEventMask;
2267 attr_mask = CWEventMask;
2268 XChangeWindowAttributes((Display*)
fDisplay,
gCws->fWindow, attr_mask, &attributes);
2277 if (cindex < 0)
return;
2324 static Int_t dashed[2] = {3,3};
2325 static Int_t dotted[2] = {1,2};
2326 static Int_t dasheddotted[4] = {3,4,1,4};
2332 }
else if (lstyle == 2 ) {
2334 }
else if (lstyle == 3 ) {
2336 }
else if (lstyle == 4 ) {
2344 for (
Int_t j = 0; j<nt; j++) {
2346 sscanf(((
TObjString*)tokens->
At(j))->GetName(),
"%d", &it);
2347 linestyle[j] = (
Int_t)(it/4);
2350 delete [] linestyle;
2382 if (cindex < 0)
return;
2399 if (msize < 0)
return;
2424 for (
int i = 0; i <
gMarker.n; i++) {
2437 static RXPoint shape[30];
2443 if (markerstyle == 1 || markerstyle == 6 || markerstyle == 7) {
2444 XSetLineAttributes((Display*)
fDisplay, *
gGCmark, 0, LineSolid, CapButt, JoinMiter);
2452 if (markerstyle == 2) {
2454 shape[0].x = -im; shape[0].y = 0;
2455 shape[1].x = im; shape[1].y = 0;
2456 shape[2].x = 0 ; shape[2].y = -im;
2457 shape[3].x = 0 ; shape[3].y = im;
2459 }
else if (markerstyle == 3 || markerstyle == 31) {
2461 shape[0].x = -im; shape[0].y = 0;
2462 shape[1].x = im; shape[1].y = 0;
2463 shape[2].x = 0 ; shape[2].y = -im;
2464 shape[3].x = 0 ; shape[3].y = im;
2466 shape[4].x = -im; shape[4].y = -im;
2467 shape[5].x = im; shape[5].y = im;
2468 shape[6].x = -im; shape[6].y = im;
2469 shape[7].x = im; shape[7].y = -im;
2471 }
else if (markerstyle == 4 || markerstyle == 24) {
2474 }
else if (markerstyle == 5) {
2477 shape[0].x = -im; shape[0].y = -im;
2478 shape[1].x = im; shape[1].y = im;
2479 shape[2].x = -im; shape[2].y = im;
2480 shape[3].x = im; shape[3].y = -im;
2482 }
else if (markerstyle == 6) {
2484 shape[0].x = -1 ; shape[0].y = 0;
2485 shape[1].x = 1 ; shape[1].y = 0;
2486 shape[2].x = 0 ; shape[2].y = -1;
2487 shape[3].x = 0 ; shape[3].y = 1;
2489 }
else if (markerstyle == 7) {
2491 shape[0].x = -1 ; shape[0].y = 1;
2492 shape[1].x = 1 ; shape[1].y = 1;
2493 shape[2].x = -1 ; shape[2].y = 0;
2494 shape[3].x = 1 ; shape[3].y = 0;
2495 shape[4].x = -1 ; shape[4].y = -1;
2496 shape[5].x = 1 ; shape[5].y = -1;
2498 }
else if (markerstyle == 8 || markerstyle == 20) {
2501 }
else if (markerstyle == 21) {
2503 shape[0].x = -im; shape[0].y = -im;
2504 shape[1].x = im; shape[1].y = -im;
2505 shape[2].x = im; shape[2].y = im;
2506 shape[3].x = -im; shape[3].y = im;
2507 shape[4].x = -im; shape[4].y = -im;
2509 }
else if (markerstyle == 22) {
2511 shape[0].x = -im; shape[0].y = im;
2512 shape[1].x = im; shape[1].y = im;
2513 shape[2].x = 0; shape[2].y = -im;
2514 shape[3].x = -im; shape[3].y = im;
2516 }
else if (markerstyle == 23) {
2518 shape[0].x = 0; shape[0].y = im;
2519 shape[1].x = im; shape[1].y = -im;
2520 shape[2].x = -im; shape[2].y = -im;
2521 shape[3].x = 0; shape[3].y = im;
2523 }
else if (markerstyle == 25) {
2525 shape[0].x = -im; shape[0].y = -im;
2526 shape[1].x = im; shape[1].y = -im;
2527 shape[2].x = im; shape[2].y = im;
2528 shape[3].x = -im; shape[3].y = im;
2529 shape[4].x = -im; shape[4].y = -im;
2531 }
else if (markerstyle == 26) {
2533 shape[0].x = -im; shape[0].y = im;
2534 shape[1].x = im; shape[1].y = im;
2535 shape[2].x = 0; shape[2].y = -im;
2536 shape[3].x = -im; shape[3].y = im;
2538 }
else if (markerstyle == 27) {
2540 Int_t imx =
Int_t(2.66*MarkerSizeReduced + 0.5);
2541 shape[0].x =-imx; shape[0].y = 0;
2542 shape[1].x = 0; shape[1].y = -im;
2543 shape[2].x = imx; shape[2].y = 0;
2544 shape[3].x = 0; shape[3].y = im;
2545 shape[4].x =-imx; shape[4].y = 0;
2547 }
else if (markerstyle == 28) {
2549 Int_t imx =
Int_t(1.33*MarkerSizeReduced + 0.5);
2550 shape[0].x = -im; shape[0].y =-imx;
2551 shape[1].x =-imx; shape[1].y =-imx;
2552 shape[2].x =-imx; shape[2].y = -im;
2553 shape[3].x = imx; shape[3].y = -im;
2554 shape[4].x = imx; shape[4].y =-imx;
2555 shape[5].x = im; shape[5].y =-imx;
2556 shape[6].x = im; shape[6].y = imx;
2557 shape[7].x = imx; shape[7].y = imx;
2558 shape[8].x = imx; shape[8].y = im;
2559 shape[9].x =-imx; shape[9].y = im;
2560 shape[10].x=-imx; shape[10].y= imx;
2561 shape[11].x= -im; shape[11].y= imx;
2562 shape[12].x= -im; shape[12].y=-imx;
2564 }
else if (markerstyle == 29) {
2566 Int_t im1 =
Int_t(0.66*MarkerSizeReduced + 0.5);
2567 Int_t im2 =
Int_t(2.00*MarkerSizeReduced + 0.5);
2568 Int_t im3 =
Int_t(2.66*MarkerSizeReduced + 0.5);
2569 Int_t im4 =
Int_t(1.33*MarkerSizeReduced + 0.5);
2570 shape[0].x = -im; shape[0].y = im4;
2571 shape[1].x =-im2; shape[1].y =-im1;
2572 shape[2].x =-im3; shape[2].y = -im;
2573 shape[3].x = 0; shape[3].y =-im2;
2574 shape[4].x = im3; shape[4].y = -im;
2575 shape[5].x = im2; shape[5].y =-im1;
2576 shape[6].x = im; shape[6].y = im4;
2577 shape[7].x = im4; shape[7].y = im4;
2578 shape[8].x = 0; shape[8].y = im;
2579 shape[9].x =-im4; shape[9].y = im4;
2580 shape[10].x= -im; shape[10].y= im4;
2582 }
else if (markerstyle == 30) {
2584 Int_t im1 =
Int_t(0.66*MarkerSizeReduced + 0.5);
2585 Int_t im2 =
Int_t(2.00*MarkerSizeReduced + 0.5);
2586 Int_t im3 =
Int_t(2.66*MarkerSizeReduced + 0.5);
2587 Int_t im4 =
Int_t(1.33*MarkerSizeReduced + 0.5);
2588 shape[0].x = -im; shape[0].y = im4;
2589 shape[1].x =-im2; shape[1].y =-im1;
2590 shape[2].x =-im3; shape[2].y = -im;
2591 shape[3].x = 0; shape[3].y =-im2;
2592 shape[4].x = im3; shape[4].y = -im;
2593 shape[5].x = im2; shape[5].y =-im1;
2594 shape[6].x = im; shape[6].y = im4;
2595 shape[7].x = im4; shape[7].y = im4;
2596 shape[8].x = 0; shape[8].y = im;
2597 shape[9].x =-im4; shape[9].y = im4;
2598 shape[10].x= -im; shape[10].y= im4;
2600 }
else if (markerstyle == 32) {
2602 shape[0].x = 0; shape[0].y = im;
2603 shape[1].x = im; shape[1].y = -im;
2604 shape[2].x = -im; shape[2].y = -im;
2605 shape[3].x = 0; shape[3].y = im;
2607 }
else if (markerstyle == 33) {
2609 Int_t imx =
Int_t(2.66*MarkerSizeReduced + 0.5);
2610 shape[0].x =-imx; shape[0].y = 0;
2611 shape[1].x = 0; shape[1].y = -im;
2612 shape[2].x = imx; shape[2].y = 0;
2613 shape[3].x = 0; shape[3].y = im;
2614 shape[4].x =-imx; shape[4].y = 0;
2616 }
else if (markerstyle == 34) {
2618 Int_t imx =
Int_t(1.33*MarkerSizeReduced + 0.5);
2619 shape[0].x = -im; shape[0].y =-imx;
2620 shape[1].x =-imx; shape[1].y =-imx;
2621 shape[2].x =-imx; shape[2].y = -im;
2622 shape[3].x = imx; shape[3].y = -im;
2623 shape[4].x = imx; shape[4].y =-imx;
2624 shape[5].x = im; shape[5].y =-imx;
2625 shape[6].x = im; shape[6].y = imx;
2626 shape[7].x = imx; shape[7].y = imx;
2627 shape[8].x = imx; shape[8].y = im;
2628 shape[9].x =-imx; shape[9].y = im;
2629 shape[10].x=-imx; shape[10].y= imx;
2630 shape[11].x= -im; shape[11].y= imx;
2631 shape[12].x= -im; shape[12].y=-imx;
2633 }
else if (markerstyle == 35) {
2635 shape[0].x =-im; shape[0].y = 0;
2636 shape[1].x = 0; shape[1].y = -im;
2637 shape[2].x = im; shape[2].y = 0;
2638 shape[3].x = 0; shape[3].y = im;
2639 shape[4].x =-im; shape[4].y = 0;
2640 shape[5].x = im; shape[5].y = 0;
2641 shape[6].x = 0; shape[6].y = im;
2642 shape[7].x = 0; shape[7].y =-im;
2644 }
else if (markerstyle == 36) {
2646 shape[0].x = -im; shape[0].y = -im;
2647 shape[1].x = im; shape[1].y = -im;
2648 shape[2].x = im; shape[2].y = im;
2649 shape[3].x = -im; shape[3].y = im;
2650 shape[4].x = -im; shape[4].y = -im;
2651 shape[5].x = im; shape[5].y = im;
2652 shape[6].x = -im; shape[6].y = im;
2653 shape[7].x = im; shape[7].y = -im;
2655 }
else if (markerstyle == 37) {
2657 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
2658 shape[0].x = 0; shape[0].y = 0;
2659 shape[1].x =-im2; shape[1].y = im;
2660 shape[2].x = im2; shape[2].y = im;
2661 shape[3].x = 0; shape[3].y = 0;
2662 shape[4].x =-im2; shape[4].y = -im;
2663 shape[5].x = -im; shape[5].y = 0;
2664 shape[6].x = 0; shape[6].y = 0;
2665 shape[7].x = im; shape[7].y = 0;
2666 shape[8].x = im2; shape[8].y = -im;
2667 shape[9].x = 0; shape[9].y = 0;
2669 }
else if (markerstyle == 38) {
2671 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
2672 shape[0].x = -im; shape[0].y = 0;
2673 shape[1].x = -im; shape[1].y =-im2;
2674 shape[2].x =-im2; shape[2].y = -im;
2675 shape[3].x = im2; shape[3].y = -im;
2676 shape[4].x = im; shape[4].y =-im2;
2677 shape[5].x = im; shape[5].y = im2;
2678 shape[6].x = im2; shape[6].y = im;
2679 shape[7].x =-im2; shape[7].y = im;
2680 shape[8].x = -im; shape[8].y = im2;
2681 shape[9].x = -im; shape[9].y = 0;
2682 shape[10].x = im; shape[10].y = 0;
2683 shape[11].x = 0; shape[11].y = 0;
2684 shape[12].x = 0; shape[12].y = -im;
2685 shape[13].x = 0; shape[13].y = im;
2686 shape[14].x = 0; shape[14].y = 0;
2688 }
else if (markerstyle == 39) {
2690 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
2691 shape[0].x = 0; shape[0].y = 0;
2692 shape[1].x =-im2; shape[1].y = im;
2693 shape[2].x = im2; shape[2].y = im;
2694 shape[3].x = 0; shape[3].y = 0;
2695 shape[4].x =-im2; shape[4].y = -im;
2696 shape[5].x = -im; shape[5].y = 0;
2697 shape[6].x = 0; shape[6].y = 0;
2698 shape[7].x = im; shape[7].y = 0;
2699 shape[8].x = im2; shape[8].y = -im;
2701 }
else if (markerstyle == 40) {
2703 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
2704 shape[0].x = 0; shape[0].y = 0;
2705 shape[1].x = im2; shape[1].y = im;
2706 shape[2].x = im; shape[2].y = im2;
2707 shape[3].x = 0; shape[3].y = 0;
2708 shape[4].x = im; shape[4].y = -im2;
2709 shape[5].x = im2; shape[5].y = -im;
2710 shape[6].x = 0; shape[6].y = 0;
2711 shape[7].x = -im2; shape[7].y = -im;
2712 shape[8].x = -im; shape[8].y = -im2;
2713 shape[9].x = 0; shape[9].y = 0;
2714 shape[10].x = -im; shape[10].y = im2;
2715 shape[11].x = -im2; shape[11].y = im;
2716 shape[12].x = 0; shape[12].y = 0;
2718 }
else if (markerstyle == 41) {
2720 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
2721 shape[0].x = 0; shape[0].y = 0;
2722 shape[1].x = im2; shape[1].y = im;
2723 shape[2].x = im; shape[2].y = im2;
2724 shape[3].x = 0; shape[3].y = 0;
2725 shape[4].x = im; shape[4].y = -im2;
2726 shape[5].x = im2; shape[5].y = -im;
2727 shape[6].x = 0; shape[6].y = 0;
2728 shape[7].x = -im2; shape[7].y = -im;
2729 shape[8].x = -im; shape[8].y = -im2;
2730 shape[9].x = 0; shape[9].y = 0;
2731 shape[10].x = -im; shape[10].y = im2;
2732 shape[11].x = -im2; shape[11].y = im;
2733 shape[12].x = 0; shape[12].y = 0;
2735 }
else if (markerstyle == 42) {
2738 shape[0].x= 0; shape[0].y= im;
2739 shape[1].x= -imx; shape[1].y= imx;
2740 shape[2].x = -im; shape[2].y = 0;
2741 shape[3].x = -imx; shape[3].y = -imx;
2742 shape[4].x = 0; shape[4].y = -im;
2743 shape[5].x = imx; shape[5].y = -imx;
2744 shape[6].x = im; shape[6].y = 0;
2745 shape[7].x= imx; shape[7].y= imx;
2746 shape[8].x= 0; shape[8].y= im;
2748 }
else if (markerstyle == 43) {
2751 shape[0].x = 0; shape[0].y = im;
2752 shape[1].x = -imx; shape[1].y = imx;
2753 shape[2].x = -im; shape[2].y = 0;
2754 shape[3].x = -imx; shape[3].y = -imx;
2755 shape[4].x = 0; shape[4].y = -im;
2756 shape[5].x = imx; shape[5].y = -imx;
2757 shape[6].x = im; shape[6].y = 0;
2758 shape[7].x = imx; shape[7].y = imx;
2759 shape[8].x = 0; shape[8].y = im;
2761 }
else if (markerstyle == 44) {
2763 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
2764 shape[0].x = 0; shape[0].y = 0;
2765 shape[1].x = im2; shape[1].y = im;
2766 shape[2].x = -im2; shape[2].y = im;
2767 shape[3].x = im2; shape[3].y = -im;
2768 shape[4].x = -im2; shape[4].y = -im;
2769 shape[5].x = 0; shape[5].y = 0;
2770 shape[6].x = im; shape[6].y = im2;
2771 shape[7].x = im; shape[7].y = -im2;
2772 shape[8].x = -im; shape[8].y = im2;
2773 shape[9].x = -im; shape[9].y = -im2;
2774 shape[10].x = 0; shape[10].y = 0;
2776 }
else if (markerstyle == 45) {
2778 Int_t im0 =
Int_t(0.4*MarkerSizeReduced + 0.5);
2779 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
2780 shape[0].x = im0; shape[0].y = im0;
2781 shape[1].x = im2; shape[1].y = im;
2782 shape[2].x = -im2; shape[2].y = im;
2783 shape[3].x = -im0; shape[3].y = im0;
2784 shape[4].x = -im; shape[4].y = im2;
2785 shape[5].x = -im; shape[5].y = -im2;
2786 shape[6].x = -im0; shape[6].y = -im0;
2787 shape[7].x = -im2; shape[7].y = -im;
2788 shape[8].x = im2; shape[8].y = -im;
2789 shape[9].x = im0; shape[9].y = -im0;
2790 shape[10].x = im; shape[10].y = -im2;
2791 shape[11].x = im; shape[11].y = im2;
2792 shape[12].x = im0; shape[12].y = im0;
2794 }
else if (markerstyle == 46) {
2796 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
2797 shape[0].x = 0; shape[0].y = im2;
2798 shape[1].x = -im2; shape[1].y = im;
2799 shape[2].x = -im; shape[2].y = im2;
2800 shape[3].x = -im2; shape[3].y = 0;
2801 shape[4].x = -im; shape[4].y = -im2;
2802 shape[5].x = -im2; shape[5].y = -im;
2803 shape[6].x = 0; shape[6].y = -im2;
2804 shape[7].x = im2; shape[7].y = -im;
2805 shape[8].x = im; shape[8].y = -im2;
2806 shape[9].x = im2; shape[9].y = 0;
2807 shape[10].x = im; shape[10].y = im2;
2808 shape[11].x = im2; shape[11].y = im;
2809 shape[12].x = 0; shape[12].y = im2;
2811 }
else if (markerstyle == 47) {
2813 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
2814 shape[0].x = 0; shape[0].y = im2;
2815 shape[1].x = -im2; shape[1].y = im;
2816 shape[2].x = -im; shape[2].y = im2;
2817 shape[3].x = -im2; shape[3].y = 0;
2818 shape[4].x = -im; shape[4].y = -im2;
2819 shape[5].x = -im2; shape[5].y = -im;
2820 shape[6].x = 0; shape[6].y = -im2;
2821 shape[7].x = im2; shape[7].y = -im;
2822 shape[8].x = im; shape[8].y = -im2;
2823 shape[9].x = im2; shape[9].y = 0;
2824 shape[10].x = im; shape[10].y = im2;
2825 shape[11].x = im2; shape[11].y = im;
2826 shape[12].x = 0; shape[12].y = im2;
2828 }
else if (markerstyle == 48) {
2830 Int_t im2 =
Int_t(2.0*MarkerSizeReduced + 0.5);
2831 shape[0].x = 0; shape[0].y = im2*1.005;
2832 shape[1].x = -im2; shape[1].y = im;
2833 shape[2].x = -im; shape[2].y = im2;
2834 shape[3].x = -im2; shape[3].y = 0;
2835 shape[4].x = -im; shape[4].y = -im2;
2836 shape[5].x = -im2; shape[5].y = -im;
2837 shape[6].x = 0; shape[6].y = -im2;
2838 shape[7].x = im2; shape[7].y = -im;
2839 shape[8].x = im; shape[8].y = -im2;
2840 shape[9].x = im2; shape[9].y = 0;
2841 shape[10].x = im; shape[10].y = im2;
2842 shape[11].x = im2; shape[11].y = im;
2843 shape[12].x = 0; shape[12].y = im2*0.995;
2844 shape[13].x = im2*0.995; shape[13].y = 0;
2845 shape[14].x = 0; shape[14].y = -im2*0.995;
2846 shape[15].x = -im2*0.995; shape[15].y = 0;
2847 shape[16].x = 0; shape[16].y = im2*0.995;
2849 }
else if (markerstyle == 49) {
2851 Int_t imx =
Int_t(1.33*MarkerSizeReduced + 0.5);
2852 shape[0].x =-imx; shape[0].y =-imx*1.005;
2853 shape[1].x =-imx; shape[1].y = -im;
2854 shape[2].x = imx; shape[2].y = -im;
2855 shape[3].x = imx; shape[3].y =-imx;
2856 shape[4].x = im; shape[4].y =-imx;
2857 shape[5].x = im; shape[5].y = imx;
2858 shape[6].x = imx; shape[6].y = imx;
2859 shape[7].x = imx; shape[7].y = im;
2860 shape[8].x =-imx; shape[8].y = im;
2861 shape[9].x =-imx; shape[9].y = imx;
2862 shape[10].x = -im; shape[10].y = imx;
2863 shape[11].x = -im; shape[11].y =-imx;
2864 shape[12].x =-imx; shape[12].y =-imx*0.995;
2865 shape[13].x =-imx; shape[13].y = imx;
2866 shape[14].x = imx; shape[14].y = imx;
2867 shape[15].x = imx; shape[15].y =-imx;
2868 shape[16].x =-imx; shape[16].y =-imx*1.005;
2886 if (percent == 0)
return;
2889 ULong_t *orgcolors = 0, *tmpc = 0;
2890 Int_t maxcolors = 0, ncolors = 0, ntmpc = 0;
2893 if (
gCws->fNewColors) {
2894 tmpc =
gCws->fNewColors;
2895 ntmpc =
gCws->fNcolors;
2899 XImage *image = XGetImage((Display*)
fDisplay,
gCws->fDrawing, 0, 0,
gCws->fWidth,
2900 gCws->fHeight, AllPlanes, ZPixmap);
2911 XDestroyImage(image);
2912 ::operator
delete(orgcolors);
2919 if (
gCws->fNewColors) {
2925 XPutPixel(image,
x,
y,
gCws->fNewColors[idx]);
2941 XDestroyImage(image);
2942 ::operator
delete(orgcolors);
2951 if (maxcolors == 0) {
2954 orgcolors = (
ULong_t*) ::operator
new(maxcolors*
sizeof(
ULong_t));
2957 for (
int i = 0; i < ncolors; i++)
2958 if (pixel == orgcolors[i])
return;
2960 if (ncolors >= maxcolors) {
2966 orgcolors[ncolors++] = pixel;
2975 if (ncolors == 0)
return;
2977 RXColor *xcol =
new RXColor[ncolors];
2980 for (i = 0; i < ncolors; i++) {
2981 xcol[i].pixel = orgcolors[i];
2982 xcol[i].red = xcol[i].green = xcol[i].blue = 0;
2983 xcol[i].flags = DoRed | DoGreen | DoBlue;
2990 for (i = 0; i < ncolors; i++) {
2991 val = xcol[i].red + add;
2994 val = xcol[i].green + add;
2997 val = xcol[i].blue + add;
3001 Warning(
"MakeOpaqueColors",
"failed to allocate color %hd, %hd, %hd",
3002 xcol[i].red, xcol[i].green, xcol[i].blue);
3007 gCws->fNcolors = ncolors;
3009 for (i = 0; i < ncolors; i++)
3010 gCws->fNewColors[i] = xcol[i].pixel;
3020 for (
int i = 0; i < ncolors; i++)
3021 if (pixel == orgcolors[i])
return i;
3023 Error(
"FindColor",
"did not find color, should never happen!");
3041 xcol.flags = DoRed | DoGreen | DoBlue;
3045 if (col.
fRed == xcol.red && col.
fGreen == xcol.green &&
3046 col.
fBlue == xcol.blue)
3055 col.
fRed = xcol.red;
3057 col.
fBlue = xcol.blue;
3069 Int_t txalh = talign/10;
3070 Int_t txalv = talign%10;
3126 if (cindex < 0)
return;
3133 if (XGetGCValues((Display*)
fDisplay, *
gGCtext, GCForeground | GCBackground, &values)) {
3137 Error(
"SetTextColor",
"cannot get GC values");
3159 if (mode ==
kLoad) {
3161 if (strcmp(fontname,
gFont[i].
name) == 0) {
3170 fontlist = XListFonts((Display*)
fDisplay, fontname, 1, &fontcount);
3172 if (fontlist && fontcount != 0) {
3173 if (mode ==
kLoad) {
3184 XFreeFontNames(fontlist);
3219 XSynchronize((Display*)
fDisplay,1);
3223 XSynchronize((Display*)
fDisplay,0);
3239 if (
gCws->fDoubleBuffer) {
3266 XWarpPointer((Display*)
fDisplay, None, (
Window)
id, 0, 0, 0, 0, ix, iy);
3279 unsigned int wval, hval;
3284 XWriteBitmapFile((Display*)
fDisplay, pxname,
gTws->fDrawing, wval, hval, -1, -1);
3299 void (*get_scline) (
int,
int,
Byte_t *),
void (*pb)(
Byte_t));
3301 int GIFinfo(
Byte_t *gifArr,
int *Width,
int *Height,
int *Ncols);
3309 for (
int i = 0; i <
width; i++)
3333 Int_t maxcolors = 0, ncolors = 0;
3345 RXColor *xcol =
new RXColor[ncolors];
3348 for (i = 0; i < ncolors; i++) {
3349 xcol[i].pixel = orgcolors[i];
3350 xcol[i].red = xcol[i].green = xcol[i].blue = 0;
3351 xcol[i].flags = DoRed | DoGreen | DoBlue;
3361 for (i = 0; i < ncolors; i++) {
3363 G[i] = xcol[i].green;
3364 B[i] = xcol[i].blue;
3373 XPutPixel(image,
x,
y, idx);
3379 ::operator
delete(orgcolors);
3388 Byte_t scline[2000],
r[256],
b[256],
g[256];
3389 Int_t *red, *green, *blue;
3390 Int_t ncol, maxcol, i;
3399 AllPlanes, ZPixmap);
3405 Error(
"WriteGIF",
"Cannot create GIF of image containing more than 256 colors. Try in batch mode.");
3413 for (i = 0; i < ncol; i++) {
3414 if (maxcol < red[i] ) maxcol = red[i];
3415 if (maxcol < green[i] ) maxcol = green[i];
3416 if (maxcol < blue[i] ) maxcol = blue[i];
3422 for (i = 0; i < ncol; i++) {
3423 r[i] = red[i] * 255/maxcol;
3424 g[i] = green[i] * 255/maxcol;
3425 b[i] = blue[i] * 255/maxcol;
3437 Error(
"WriteGIF",
"cannot write file: %s",
name);
3452 const int maxSegment = 20;
3453 int i,
n,
x,
y, xcur,
x1,
x2, y1, y2;
3454 unsigned char *jimg, *jbase, icol;
3456 XSegment lines[256][maxSegment];
3462 id =
gCws->fDrawing;
3465 for (i = 0; i < 256; i++) nlines[i] = 0;
3469 jbase = image + (
ymin-1)*nx +
xmin;
3471 for (
y = y2;
y >= y1;
y--) {
3472 xcur =
x1; jbase += nx;
3473 for (jimg = jbase, icol = *jimg++,
x =
x1+1;
x <=
x2; jimg++,
x++) {
3474 if (icol != *jimg) {
3475 if (icol != itran) {
3477 lines[icol][
n].x1 = xcur; lines[icol][
n].y1 =
y;
3478 lines[icol][
n].x2 =
x-1; lines[icol][
n].y2 =
y;
3479 if (nlines[icol] == maxSegment) {
3486 icol = *jimg; xcur =
x;
3489 if (icol != itran) {
3491 lines[icol][
n].x1 = xcur; lines[icol][
n].y1 =
y;
3492 lines[icol][
n].x2 =
x-1; lines[icol][
n].y2 =
y;
3493 if (nlines[icol] == maxSegment) {
3502 for (i = 0; i < 256; i++) {
3503 if (nlines[i] != 0) {
3518 unsigned char *gifArr, *pixArr, red[256], green[256], blue[256], *j1, *j2, icol;
3519 int i, j, k,
width, height, ncolor, irep, offset;
3523 fd = fopen(
file,
"r");
3525 Error(
"ReadGIF",
"unable to open GIF file");
3530 long ft = ftell(fd);
3532 Error(
"ReadGIF",
"unable to open GIF file");
3540 if (!(gifArr = (
unsigned char *)
calloc(filesize+256,1))) {
3541 Error(
"ReadGIF",
"unable to allocate array for gif");
3546 if (fread(gifArr, filesize, 1, fd) != 1) {
3547 Error(
"ReadGIF",
"GIF file read failed");
3560 if (!(pixArr = (
unsigned char *)
calloc((
width*height),1))) {
3561 Error(
"ReadGIF",
"unable to allocate array for image");
3566 irep =
GIFdecode(gifArr, pixArr, &
width, &height, &ncolor, red, green, blue);
3577 for (i = 0; i < ncolor; i++) {
3587 for (i = 1; i <= height/2; i++) {
3588 j1 = pixArr + (i-1)*
width;
3589 j2 = pixArr + (height-i)*
width;
3590 for (k = 0; k <
width; k++) {
3591 icol = *j1; *j1++ = *j2; *j2++ = icol;
3595 PutImage(offset,-1,x0,y0,
width,height,0,0,
width-1,height-1,pixArr,pic);
3602 else if (
gCws->fDrawing)
3656 fWindows, newsize *
sizeof(XWindow_t),
3668 gCws->fWindow = pixid;
3671 gCws->fDoubleBuffer = 0;
3672 gCws->fIsPixmap = 1;
3676 gCws->fNewColors = 0;
3693 Int_t major_opcode, first_event, first_error;
3696 return XQueryExtension((Display*)
fDisplay, ext, &major_opcode, &first_event, &first_error);
const unsigned char gStipples[26][32]
static const double x2[5]
static const double x1[5]
const size_t kBitsPerByte
include TDocParser_001 C image html pict1_TDocParser_001 png width
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.
int GIFquantize(UInt_t width, UInt_t height, Int_t *ncol, Byte_t *red, Byte_t *green, Byte_t *blue, Byte_t *outputBuf, Byte_t *outputCmap)
static ULong_t gKeybdMask
void XRotSetMagnification(float)
Set the font magnification factor for all subsequent operations.
static struct @55 gMarker
static void GetPixel(int y, int width, Byte_t *scline)
Get pixels in line y and put in array scline.
static Pixmap gFillPattern
static Cursor gNullCursor
static struct @54 gFont[kMAXFONT]
int GIFdecode(Byte_t *gifArr, Byte_t *pixArr, int *Width, int *Height, int *Ncols, Byte_t *R, Byte_t *G, Byte_t *B)
const char null_cursor_bits[]
int XRotDrawString(Display *, XFontStruct *, float, Drawable, GC, int, int, char *)
A front end to XRotPaintAlignedString: -no alignment, no background.
static char gDashList[10]
const Int_t kBIGGEST_RGB_VALUE
static void PutByte(Byte_t b)
Put byte b in output stream.
long GIFencode(int Width, int Height, Int_t Ncol, Byte_t R[], Byte_t G[], Byte_t B[], Byte_t ScLine[], void(*get_scline)(int, int, Byte_t *), void(*pb)(Byte_t))
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
static GC gGClist[kMAXGC]
static int gMarkerLineWidth
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().
int GIFinfo(Byte_t *gifArr, int *Width, int *Height, int *Ncols)
void Printf(const char *fmt,...)
R__EXTERN TStyle * gStyle
virtual Color_t GetFillColor() const
Return the fill area color.
Style_t fFillStyle
Fill area style.
Color_t fFillColor
Fill area color.
Width_t fLineWidth
Line width.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Style_t fLineStyle
Line style.
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
static Width_t GetMarkerLineWidth(Style_t style)
Internal helper function that returns the line width of the given marker style (0 = filled marker)
Size_t fMarkerSize
Marker size.
Style_t fMarkerStyle
Marker style.
static Style_t GetMarkerStyleBase(Style_t style)
Internal helper function that returns the corresponding marker style with line width 1 for the given ...
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
Float_t fTextAngle
Text angle.
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
Font_t fTextFont
Text font.
Float_t fTextSize
Text size.
The color creation and management class.
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
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 Add(ULong64_t hash, Long64_t key, Long64_t value)
Add an (key,value) pair to the table. The key should be unique.
Long64_t GetValue(ULong64_t hash, Long64_t key)
Return the value belonging to specified key and hash value.
This class is the basic interface to the X11 (Xlib) graphics system.
void * fDisplay
Pointer to display.
void QueryPointer(Int_t &ix, Int_t &iy)
Query pointer position.
void MakeOpaqueColors(Int_t percent, ULong_t *orgcolors, Int_t ncolors)
Get RGB values for orgcolors, add percent neutral to the RGB and allocate fNewColors.
Colormap fColormap
Default colormap, 0 if b/w.
virtual void GetTextExtent(UInt_t &w, UInt_t &h, char *mess)
Return the size of a character string.
Int_t fScreenNumber
Screen number.
void SetDoubleBufferOFF()
Turn double buffer mode off.
void SetTextColor(Color_t cindex)
Set color index for text.
void SelectWindow(Int_t wid)
Select window to which subsequent output is directed.
void DrawPolyLine(Int_t n, TPoint *xy)
Draw a line through all points.
void SetLineType(Int_t n, Int_t *dash)
Set line type.
void CollectImageColors(ULong_t pixel, ULong_t *&orgcolors, Int_t &ncolors, Int_t &maxcolors)
Collect in orgcolors all different original image colors.
Pixmap_t CreatePixmap(Drawable_t id, UInt_t w, UInt_t h)
Creates a pixmap of the width and height you specified and returns a pixmap ID that identifies it.
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.
Int_t fTextAlignV
Text Alignment Vertical.
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 ClosePixmap()
Delete current pixmap.
void SetDoubleBufferON()
Turn double buffer mode on.
void GetCharacterUp(Float_t &chupx, Float_t &chupy)
Return character up vector.
void Warp(Int_t ix, Int_t iy, Window_t id=0)
Set pointer position.
void SetTextAlign(Short_t talign=11)
Set text alignment.
void RescaleWindow(Int_t wid, UInt_t w, UInt_t h)
Rescale the window wid.
Window_t GetWindowID(Int_t wid)
Return the X11 window identifier.
Int_t AddWindow(ULong_t qwid, UInt_t w, UInt_t h)
Register a window created by Qt as a ROOT window (like InitWindow()).
void SetCursor(Int_t win, ECursor cursor)
Set the cursor.
void Sync(Int_t mode)
Set synchronisation on or off.
void * GetGC(Int_t which) const
Return desired Graphics Context ("which" maps directly on gGCList[]).
void MoveWindow(Int_t wid, Int_t x, Int_t y)
Move the window wid.
unsigned char * GetColorBits(Drawable_t wid, Int_t x=0, Int_t y=0, UInt_t w=0, UInt_t h=0)
Returns an array of pixels created from a part of drawable (defined by x, y, w, h) in format: b1,...
void SetMarkerSize(Float_t markersize)
Set marker size index.
void SetDrawMode(EDrawMode mode)
Set the drawing mode.
Int_t AddPixmap(ULong_t pixid, UInt_t w, UInt_t h)
Register pixmap created by gVirtualGL.
Bool_t fHasXft
True when XftFonts are used.
void WritePixmap(Int_t wid, UInt_t w, UInt_t h, char *pxname)
Write the pixmap wid in the bitmap file pxname.
void DrawBox(Int_t x1, Int_t y1, Int_t x2, Int_t y2, EBoxMode mode)
Draw a box.
void ClearPixmap(Drawable *pix)
Clear the pixmap pix.
Float_t fTextMagnitude
Text Magnitude.
void SetCharacterUp(Float_t chupx, Float_t chupy)
Set character up vector.
Drawable fRootWin
Root window used as parent of all windows.
void SetMarkerStyle(Style_t markerstyle)
Set marker style.
virtual ~TGX11()
Destructor.
void DrawFillArea(Int_t n, TPoint *xy)
Fill area described by polygon.
void SetInput(Int_t inp)
Set input on or off.
void RemoveWindow(ULong_t qwid)
Remove a window created by Qt (like CloseWindow1()).
void SetClipRegion(Int_t wid, Int_t x, Int_t y, UInt_t w, UInt_t h)
Set clipping region for the window wid.
Int_t fTextAlignH
Text Alignment Horizontal.
void * fXEvent
Current native (X11) event.
ULong_t GetPixel(Color_t cindex)
Return pixel value associated to specified ROOT color number.
Int_t fGreenShift
Bits to left shift green.
void GetGeometry(Int_t wid, Int_t &x, Int_t &y, UInt_t &w, UInt_t &h)
Return position and size of window wid.
void SetOpacity(Int_t percent)
Set opacity of a window.
void SetFillColor(Color_t cindex)
Set color index for fill areas.
Pixmap_t CreatePixmapFromData(unsigned char *bits, UInt_t width, UInt_t height)
create pixmap from RGB data.
Int_t InitWindow(ULong_t window)
Open window and return window number.
void ClearWindow()
Clear current window.
Int_t WriteGIF(char *name)
Writes the current window into GIF file.
XColor_t & GetColor(Int_t cid)
Return reference to internal color structure associated to color index cid.
Int_t fBlueDiv
Blue value divider.
void CopyWindowtoPixmap(Drawable *pix, Int_t xpos, Int_t ypos)
Copy area of current window in the pixmap pix.
void SetLineStyle(Style_t linestyle)
Set line style.
Drawable fVisRootWin
Root window with fVisual to be used to create GC's and XImages.
void GetPlanes(Int_t &nplanes)
Get maximum number of planes.
void SetMarkerColor(Color_t cindex)
Set color index for markers.
TExMap * fColors
Hash list of colors.
Int_t fTextAlign
Text alignment (set in SetTextAlign)
Window_t GetCurrentWindow() const
Return current window pointer. Protected method used by TGX11TTF.
void SetMarkerType(Int_t type, Int_t n, RXPoint *xy)
Set marker type.
Int_t fRedDiv
Red value divider, -1 if no TrueColor visual.
Int_t fDepth
Number of color planes.
void ResizeWindow(Int_t wid)
Resize the current window if necessary.
void CloseWindow()
Delete current window.
void CloseWindow1()
Delete current window.
Int_t SupportsExtension(const char *ext) const
Returns 1 if window system server supports extension given by the argument, returns 0 in case extensi...
ULong_t fBlackPixel
Value of black pixel in colormap.
const char * DisplayName(const char *dpyName=0)
Return hostname on which the display is opened.
Float_t fCharacterUpX
Character Up vector along X.
Int_t fGreenDiv
Green value divider.
Int_t RequestLocator(Int_t mode, Int_t ctyp, Int_t &x, Int_t &y)
Request Locator position.
void UpdateWindow(Int_t mode)
Update display.
virtual void DrawText(Int_t x, Int_t y, Float_t angle, Float_t mgn, const char *text, ETextMode mode)
Draw a text string using current font.
TGX11()
Default constructor.
Bool_t Init(void *display)
Initialize X11 system. Returns kFALSE in case of failure.
void DrawLine(Int_t x1, Int_t y1, Int_t x2, Int_t y2)
Draw a line.
Int_t OpenPixmap(UInt_t w, UInt_t h)
Open a new pixmap.
Int_t fRedShift
Bits to left shift red, -1 if no TrueColor visual.
virtual void SetTextSize(Float_t textsize)
Set current text size.
Int_t OpenDisplay(void *display)
Open the display. Return -1 if the opening fails, 0 when ok.
Int_t ResizePixmap(Int_t wid, UInt_t w, UInt_t h)
Resize a pixmap.
void CopyPixmap(Int_t wid, Int_t xpos, Int_t ypos)
Copy the pixmap wid at the position xpos, ypos in the current window.
void RemovePixmap(Drawable *pix)
Remove the pixmap pix.
void FindUsableVisual(RXVisualInfo *vlist, Int_t nitems)
Check if visual is usable, if so set fVisual, fDepth, fColormap, fBlackPixel and fWhitePixel.
Pixmap_t ReadGIF(Int_t x0, Int_t y0, const char *file, Window_t id=0)
If id is NULL - loads the specified gif file at position [x0,y0] in the current window.
Int_t fMaxNumberOfWindows
Maximum number of windows.
void ImgPickPalette(RXImage *image, Int_t &ncol, Int_t *&R, Int_t *&G, Int_t *&B)
Returns in R G B the ncol colors of the palette used by the image.
void DrawCellArray(Int_t x1, Int_t y1, Int_t x2, Int_t y2, Int_t nx, Int_t ny, Int_t *ic)
Draw a cell array.
Int_t FindColor(ULong_t pixel, ULong_t *orgcolors, Int_t ncolors)
Returns index in orgcolors (and fNewColors) for pixel.
void SetFillStyleIndex(Int_t style, Int_t fasi)
Set fill area style index.
RVisual * fVisual
Pointer to visual used by all windows.
void SetClipOFF(Int_t wid)
Turn off the clipping for the window wid.
virtual Int_t SetTextFont(char *fontname, ETextSetMode mode)
Set text font to specified name.
void SetFillStyle(Style_t style)
Set fill area style.
void SetLineWidth(Width_t width)
Set line width.
XWindow_t * fWindows
List of windows.
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.
void FindBestVisual()
Find best visual, i.e.
void SetRGB(Int_t cindex, Float_t r, Float_t g, Float_t b)
Set color intensities for given color index.
void SetColor(void *gc, Int_t ci)
Set the foreground color in GC.
void SetDoubleBuffer(Int_t wid, Int_t mode)
Set the double buffer on/off on window wid.
void SetLineColor(Color_t cindex)
Set color index for lines.
void GetRGB(Int_t index, Float_t &r, Float_t &g, Float_t &b)
Get rgb values for color "index".
Int_t GetDoubleBuffer(Int_t wid)
Query the double buffer value for the window wid.
Float_t fCharacterUpY
Character Up vector along Y.
Bool_t fHasTTFonts
True when TrueType fonts are used.
void DrawPolyMarker(Int_t n, TPoint *xy)
Draw n markers with the current attributes at position x, y.
Int_t RequestString(Int_t x, Int_t y, char *text)
Request a string.
Int_t GetEntries() const
Return the number of objects in array (i.e.
TObject * At(Int_t idx) const
Collectable string class.
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.
static void * Alloc(size_t size)
Allocate a block of memory, that later can be resized using TStorage::ReAlloc().
static void * ReAlloc(void *vp, size_t size)
Reallocate (i.e.
static void Dealloc(void *ptr)
De-allocate block of memory, that was allocated via TStorage::Alloc().
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
const char * GetLineStyleString(Int_t i=1) const
Return line style string (used by PostScript).
Semi-Abstract base class defining a generic interface to the underlying, low level,...
static constexpr double L
Short_t Max(Short_t a, Short_t b)
Double_t Floor(Double_t x)
Double_t Sqrt(Double_t x)
Short_t Min(Short_t a, Short_t b)
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
#define org(otri, vertexptr)