45 #include <visp3/core/vpConfig.h> 55 #include <visp3/core/vpDisplay.h> 56 #include <visp3/gui/vpDisplayX.h> 59 #include <visp3/core/vpDebug.h> 60 #include <visp3/core/vpDisplayException.h> 63 #include <visp3/core/vpMath.h> 87 :
display(NULL),
window(), Ximage(NULL), lut(), context(), screen(0), event(), pixmap(), x_color(NULL),
88 screen_depth(8), xcolor(), values(), ximage_data_init(false), RMask(0), GMask(0), BMask(0), RShift(0), GShift(0),
120 :
display(NULL),
window(), Ximage(NULL), lut(), context(), screen(0), event(), pixmap(), x_color(NULL),
121 screen_depth(8), xcolor(), values(), ximage_data_init(false), RMask(0), GMask(0), BMask(0), RShift(0), GShift(0),
125 init(I, x, y, title);
148 :
display(NULL),
window(), Ximage(NULL), lut(), context(), screen(0), event(), pixmap(), x_color(NULL),
149 screen_depth(8), xcolor(), values(), ximage_data_init(false), RMask(0), GMask(0), BMask(0), RShift(0), GShift(0),
178 :
display(NULL),
window(), Ximage(NULL), lut(), context(), screen(0), event(), pixmap(), x_color(NULL),
179 screen_depth(8), xcolor(), values(), ximage_data_init(false), RMask(0), GMask(0), BMask(0), RShift(0), GShift(0),
183 init(I, x, y, title);
209 :
display(NULL),
window(), Ximage(NULL), lut(), context(), screen(0), event(), pixmap(), x_color(NULL),
210 screen_depth(8), xcolor(), values(), ximage_data_init(false), RMask(0), GMask(0), BMask(0), RShift(0), GShift(0),
239 :
display(NULL),
window(), Ximage(NULL), lut(), context(), screen(0), event(), pixmap(), x_color(NULL),
240 screen_depth(8), xcolor(), values(), ximage_data_init(false), RMask(0), GMask(0), BMask(0), RShift(0), GShift(0),
262 if (x_color == NULL) {
280 hints.flags = USPosition;
290 vpERROR_TRACE(
"Can't connect display on server %s.\n", XDisplayName(NULL));
294 screen = DefaultScreen(
display);
295 lut = DefaultColormap(
display, screen);
296 screen_depth = (
unsigned int)DefaultDepth(
display, screen);
307 if (screen_depth == 8) {
309 xcolor.flags = DoRed | DoGreen | DoBlue;
311 for (
unsigned int i = 0; i < 256; i++) {
313 xcolor.red = 256 * i;
314 xcolor.green = 256 * i;
315 xcolor.blue = 256 * i;
316 XStoreColor(
display, lut, &xcolor);
320 XInstallColormap(
display, lut);
323 else if (screen_depth == 16) {
324 for (
unsigned int i = 0; i < 256; i++) {
326 xcolor.red = xcolor.green = xcolor.blue = 256 * i;
327 if (XAllocColor(
display, lut, &xcolor) == 0) {
328 vpERROR_TRACE(
"Can't allocate 256 colors. Only %d allocated.", i);
331 colortable[i] = xcolor.pixel;
335 XInstallColormap(
display, lut);
337 Visual *visual = DefaultVisual(
display, screen);
338 RMask = visual->red_mask;
339 GMask = visual->green_mask;
340 BMask = visual->blue_mask;
342 RShift = 15 -
getMsb(RMask);
343 GShift = 15 -
getMsb(GMask);
344 BShift = 15 -
getMsb(BMask);
350 switch (screen_depth) {
357 xcolor.red = 256 * 192;
358 xcolor.green = 256 * 192;
359 xcolor.blue = 256 * 192;
360 XStoreColor(
display, lut, &xcolor);
365 xcolor.red = 256 * 128;
366 xcolor.green = 256 * 128;
367 xcolor.blue = 256 * 128;
368 XStoreColor(
display, lut, &xcolor);
373 xcolor.red = 256 * 64;
374 xcolor.green = 256 * 64;
375 xcolor.blue = 256 * 64;
376 XStoreColor(
display, lut, &xcolor);
381 xcolor.red = 256 * 255;
382 xcolor.green = 256 * 140;
383 xcolor.blue = 256 * 140;
384 XStoreColor(
display, lut, &xcolor);
389 xcolor.red = 256 * 255;
392 XStoreColor(
display, lut, &xcolor);
397 xcolor.red = 256 * 128;
400 XStoreColor(
display, lut, &xcolor);
405 xcolor.red = 256 * 140;
406 xcolor.green = 256 * 255;
407 xcolor.blue = 256 * 140;
408 XStoreColor(
display, lut, &xcolor);
414 xcolor.green = 256 * 255;
416 XStoreColor(
display, lut, &xcolor);
422 xcolor.green = 256 * 128;
424 XStoreColor(
display, lut, &xcolor);
429 xcolor.red = 256 * 140;
430 xcolor.green = 256 * 140;
431 xcolor.blue = 256 * 255;
432 XStoreColor(
display, lut, &xcolor);
439 xcolor.blue = 256 * 255;
440 XStoreColor(
display, lut, &xcolor);
447 xcolor.blue = 256 * 128;
448 XStoreColor(
display, lut, &xcolor);
453 xcolor.red = 256 * 255;
454 xcolor.green = 256 * 255;
456 XStoreColor(
display, lut, &xcolor);
461 xcolor.red = 256 * 255;
462 xcolor.green = 256 * 165;
464 XStoreColor(
display, lut, &xcolor);
470 xcolor.green = 256 * 255;
471 xcolor.blue = 256 * 255;
472 XStoreColor(
display, lut, &xcolor);
477 xcolor.red = 256 * 128;
479 xcolor.blue = 256 * 128;
480 XStoreColor(
display, lut, &xcolor);
486 xcolor.flags = DoRed | DoGreen | DoBlue;
493 XAllocColor(
display, lut, &xcolor);
498 xcolor.red = 256 * 255;
499 xcolor.green = 256 * 255;
500 xcolor.blue = 256 * 255;
501 XAllocColor(
display, lut, &xcolor);
506 xcolor.red = 256 * 192;
507 xcolor.green = 256 * 192;
508 xcolor.blue = 256 * 192;
509 XAllocColor(
display, lut, &xcolor);
514 xcolor.red = 256 * 128;
515 xcolor.green = 256 * 128;
516 xcolor.blue = 256 * 128;
517 XAllocColor(
display, lut, &xcolor);
522 xcolor.red = 256 * 64;
523 xcolor.green = 256 * 64;
524 xcolor.blue = 256 * 64;
525 XAllocColor(
display, lut, &xcolor);
530 xcolor.red = 256 * 255;
531 xcolor.green = 256 * 140;
532 xcolor.blue = 256 * 140;
533 XAllocColor(
display, lut, &xcolor);
538 xcolor.red = 256 * 255;
541 XAllocColor(
display, lut, &xcolor);
546 xcolor.red = 256 * 128;
549 XAllocColor(
display, lut, &xcolor);
554 xcolor.red = 256 * 140;
555 xcolor.green = 256 * 255;
556 xcolor.blue = 256 * 140;
557 XAllocColor(
display, lut, &xcolor);
563 xcolor.green = 256 * 255;
565 XAllocColor(
display, lut, &xcolor);
571 xcolor.green = 256 * 128;
573 XAllocColor(
display, lut, &xcolor);
578 xcolor.red = 256 * 140;
579 xcolor.green = 256 * 140;
580 xcolor.blue = 256 * 255;
581 XAllocColor(
display, lut, &xcolor);
588 xcolor.blue = 256 * 255;
589 XAllocColor(
display, lut, &xcolor);
596 xcolor.blue = 256 * 128;
597 XAllocColor(
display, lut, &xcolor);
602 xcolor.red = 256 * 255;
603 xcolor.green = 256 * 255;
605 XAllocColor(
display, lut, &xcolor);
610 xcolor.red = 256 * 255;
611 xcolor.green = 256 * 165;
613 XAllocColor(
display, lut, &xcolor);
619 xcolor.green = 256 * 255;
620 xcolor.blue = 256 * 255;
621 XAllocColor(
display, lut, &xcolor);
626 xcolor.red = 256 * 128;
628 xcolor.blue = 256 * 128;
629 XAllocColor(
display, lut, &xcolor);
639 ExposureMask | ButtonPressMask | ButtonReleaseMask | KeyPressMask | KeyReleaseMask |
640 StructureNotifyMask | PointerMotionMask);
643 values.plane_mask = AllPlanes;
644 values.fill_style = FillSolid;
645 values.foreground = WhitePixel(
display, screen);
646 values.background = BlackPixel(
display, screen);
647 context = XCreateGC(
display,
window, GCPlaneMask | GCFillStyle | GCForeground | GCBackground, &values);
649 if (context == NULL) {
666 Ximage->data = (
char *)malloc(
m_height * (
unsigned int)Ximage->bytes_per_line);
667 ximage_data_init =
true;
697 if (x_color == NULL) {
709 hints.flags = USPosition;
718 if ((
display = XOpenDisplay(NULL)) == NULL) {
719 vpERROR_TRACE(
"Can't connect display on server %s.\n", XDisplayName(NULL));
723 screen = DefaultScreen(
display);
724 lut = DefaultColormap(
display, screen);
725 screen_depth = (
unsigned int)DefaultDepth(
display, screen);
738 if (screen_depth == 8) {
740 xcolor.flags = DoRed | DoGreen | DoBlue;
742 for (
unsigned int i = 0; i < 256; i++) {
744 xcolor.red = 256 * i;
745 xcolor.green = 256 * i;
746 xcolor.blue = 256 * i;
747 XStoreColor(
display, lut, &xcolor);
751 XInstallColormap(
display, lut);
754 else if (screen_depth == 16) {
755 for (
unsigned int i = 0; i < 256; i++) {
757 xcolor.red = xcolor.green = xcolor.blue = 256 * i;
758 if (XAllocColor(
display, lut, &xcolor) == 0) {
759 vpERROR_TRACE(
"Can't allocate 256 colors. Only %d allocated.", i);
762 colortable[i] = xcolor.pixel;
765 Visual *visual = DefaultVisual(
display, screen);
766 RMask = visual->red_mask;
767 GMask = visual->green_mask;
768 BMask = visual->blue_mask;
770 RShift = 15 -
getMsb(RMask);
771 GShift = 15 -
getMsb(GMask);
772 BShift = 15 -
getMsb(BMask);
775 XInstallColormap(
display, lut);
781 switch (screen_depth) {
789 xcolor.red = 256 * 192;
790 xcolor.green = 256 * 192;
791 xcolor.blue = 256 * 192;
792 XStoreColor(
display, lut, &xcolor);
797 xcolor.red = 256 * 128;
798 xcolor.green = 256 * 128;
799 xcolor.blue = 256 * 128;
800 XStoreColor(
display, lut, &xcolor);
805 xcolor.red = 256 * 64;
806 xcolor.green = 256 * 64;
807 xcolor.blue = 256 * 64;
808 XStoreColor(
display, lut, &xcolor);
813 xcolor.red = 256 * 255;
814 xcolor.green = 256 * 140;
815 xcolor.blue = 256 * 140;
816 XStoreColor(
display, lut, &xcolor);
821 xcolor.red = 256 * 255;
824 XStoreColor(
display, lut, &xcolor);
829 xcolor.red = 256 * 128;
832 XStoreColor(
display, lut, &xcolor);
837 xcolor.red = 256 * 140;
838 xcolor.green = 256 * 255;
839 xcolor.blue = 256 * 140;
840 XStoreColor(
display, lut, &xcolor);
846 xcolor.green = 256 * 255;
848 XStoreColor(
display, lut, &xcolor);
854 xcolor.green = 256 * 128;
856 XStoreColor(
display, lut, &xcolor);
861 xcolor.red = 256 * 140;
862 xcolor.green = 256 * 140;
863 xcolor.blue = 256 * 255;
864 XStoreColor(
display, lut, &xcolor);
871 xcolor.blue = 256 * 255;
872 XStoreColor(
display, lut, &xcolor);
879 xcolor.blue = 256 * 128;
880 XStoreColor(
display, lut, &xcolor);
885 xcolor.red = 256 * 255;
886 xcolor.green = 256 * 255;
888 XStoreColor(
display, lut, &xcolor);
893 xcolor.red = 256 * 255;
894 xcolor.green = 256 * 165;
896 XStoreColor(
display, lut, &xcolor);
902 xcolor.green = 256 * 255;
903 xcolor.blue = 256 * 255;
904 XStoreColor(
display, lut, &xcolor);
909 xcolor.red = 256 * 128;
911 xcolor.blue = 256 * 128;
912 XStoreColor(
display, lut, &xcolor);
918 xcolor.flags = DoRed | DoGreen | DoBlue;
925 XAllocColor(
display, lut, &xcolor);
930 xcolor.red = 256 * 255;
931 xcolor.green = 256 * 255;
932 xcolor.blue = 256 * 255;
933 XAllocColor(
display, lut, &xcolor);
938 xcolor.red = 256 * 192;
939 xcolor.green = 256 * 192;
940 xcolor.blue = 256 * 192;
941 XAllocColor(
display, lut, &xcolor);
946 xcolor.red = 256 * 128;
947 xcolor.green = 256 * 128;
948 xcolor.blue = 256 * 128;
949 XAllocColor(
display, lut, &xcolor);
954 xcolor.red = 256 * 64;
955 xcolor.green = 256 * 64;
956 xcolor.blue = 256 * 64;
957 XAllocColor(
display, lut, &xcolor);
962 xcolor.red = 256 * 255;
963 xcolor.green = 256 * 140;
964 xcolor.blue = 256 * 140;
965 XAllocColor(
display, lut, &xcolor);
970 xcolor.red = 256 * 255;
973 XAllocColor(
display, lut, &xcolor);
978 xcolor.red = 256 * 128;
981 XAllocColor(
display, lut, &xcolor);
986 xcolor.red = 256 * 140;
987 xcolor.green = 256 * 255;
988 xcolor.blue = 256 * 140;
989 XAllocColor(
display, lut, &xcolor);
995 xcolor.green = 256 * 255;
997 XAllocColor(
display, lut, &xcolor);
1003 xcolor.green = 256 * 128;
1005 XAllocColor(
display, lut, &xcolor);
1010 xcolor.red = 256 * 140;
1011 xcolor.green = 256 * 140;
1012 xcolor.blue = 256 * 255;
1013 XAllocColor(
display, lut, &xcolor);
1020 xcolor.blue = 256 * 255;
1021 XAllocColor(
display, lut, &xcolor);
1028 xcolor.blue = 256 * 128;
1029 XAllocColor(
display, lut, &xcolor);
1034 xcolor.red = 256 * 255;
1035 xcolor.green = 256 * 255;
1037 XAllocColor(
display, lut, &xcolor);
1042 xcolor.red = 256 * 255;
1043 xcolor.green = 256 * 165;
1045 XAllocColor(
display, lut, &xcolor);
1051 xcolor.green = 256 * 255;
1052 xcolor.blue = 256 * 255;
1053 XAllocColor(
display, lut, &xcolor);
1058 xcolor.red = 256 * 128;
1060 xcolor.blue = 256 * 128;
1061 XAllocColor(
display, lut, &xcolor);
1071 ExposureMask | ButtonPressMask | ButtonReleaseMask | KeyPressMask | KeyReleaseMask |
1072 StructureNotifyMask | PointerMotionMask);
1075 values.plane_mask = AllPlanes;
1076 values.fill_style = FillSolid;
1077 values.foreground = WhitePixel(
display, screen);
1078 values.background = BlackPixel(
display, screen);
1079 context = XCreateGC(
display,
window, GCPlaneMask | GCFillStyle | GCForeground | GCBackground, &values);
1081 if (context == NULL) {
1098 Ximage->data = (
char *)malloc(
m_height * (
unsigned int)Ximage->bytes_per_line);
1099 ximage_data_init =
true;
1121 if (x_color == NULL) {
1140 hints.flags = USPosition;
1147 if ((
display = XOpenDisplay(NULL)) == NULL) {
1148 vpERROR_TRACE(
"Can't connect display on server %s.\n", XDisplayName(NULL));
1152 screen = DefaultScreen(
display);
1153 lut = DefaultColormap(
display, screen);
1154 screen_depth = (
unsigned int)DefaultDepth(
display, screen);
1156 vpTRACE(
"Screen depth: %d\n", screen_depth);
1167 if (screen_depth == 8) {
1169 xcolor.flags = DoRed | DoGreen | DoBlue;
1171 for (
unsigned int i = 0; i < 256; i++) {
1173 xcolor.red = 256 * i;
1174 xcolor.green = 256 * i;
1175 xcolor.blue = 256 * i;
1176 XStoreColor(
display, lut, &xcolor);
1180 XInstallColormap(
display, lut);
1183 else if (screen_depth == 16) {
1184 for (
unsigned int i = 0; i < 256; i++) {
1186 xcolor.red = xcolor.green = xcolor.blue = 256 * i;
1187 if (XAllocColor(
display, lut, &xcolor) == 0) {
1188 vpERROR_TRACE(
"Can't allocate 256 colors. Only %d allocated.", i);
1191 colortable[i] = xcolor.pixel;
1195 XInstallColormap(
display, lut);
1197 Visual *visual = DefaultVisual(
display, screen);
1198 RMask = visual->red_mask;
1199 GMask = visual->green_mask;
1200 BMask = visual->blue_mask;
1202 RShift = 15 -
getMsb(RMask);
1203 GShift = 15 -
getMsb(GMask);
1204 BShift = 15 -
getMsb(BMask);
1212 switch (screen_depth) {
1222 xcolor.red = 256 * pcolor.
R;
1223 xcolor.green = 256 * pcolor.
G;
1224 xcolor.blue = 256 * pcolor.
B;
1225 XStoreColor(
display, lut, &xcolor);
1230 xcolor.red = 256 * pcolor.
R;
1231 xcolor.green = 256 * pcolor.
G;
1232 xcolor.blue = 256 * pcolor.
B;
1233 XStoreColor(
display, lut, &xcolor);
1238 xcolor.red = 256 * pcolor.
R;
1239 xcolor.green = 256 * pcolor.
G;
1240 xcolor.blue = 256 * pcolor.
B;
1241 XStoreColor(
display, lut, &xcolor);
1246 xcolor.red = 256 * pcolor.
R;
1247 xcolor.green = 256 * pcolor.
G;
1248 xcolor.blue = 256 * pcolor.
B;
1249 XStoreColor(
display, lut, &xcolor);
1254 xcolor.red = 256 * pcolor.
R;
1255 xcolor.green = 256 * pcolor.
G;
1256 xcolor.blue = 256 * pcolor.
B;
1257 XStoreColor(
display, lut, &xcolor);
1262 xcolor.red = 256 * pcolor.
R;
1263 xcolor.green = 256 * pcolor.
G;
1264 xcolor.blue = 256 * pcolor.
B;
1265 XStoreColor(
display, lut, &xcolor);
1270 xcolor.red = 256 * pcolor.
R;
1271 xcolor.green = 256 * pcolor.
G;
1272 xcolor.blue = 256 * pcolor.
B;
1273 XStoreColor(
display, lut, &xcolor);
1278 xcolor.red = 256 * pcolor.
R;
1279 xcolor.green = 256 * pcolor.
G;
1280 xcolor.blue = 256 * pcolor.
B;
1281 XStoreColor(
display, lut, &xcolor);
1286 xcolor.red = 256 * pcolor.
R;
1287 xcolor.green = 256 * pcolor.
G;
1288 xcolor.blue = 256 * pcolor.
B;
1289 XStoreColor(
display, lut, &xcolor);
1294 xcolor.red = 256 * pcolor.
R;
1295 xcolor.green = 256 * pcolor.
G;
1296 xcolor.blue = 256 * pcolor.
B;
1297 XStoreColor(
display, lut, &xcolor);
1302 xcolor.red = 256 * pcolor.
R;
1303 xcolor.green = 256 * pcolor.
G;
1304 xcolor.blue = 256 * pcolor.
B;
1305 XStoreColor(
display, lut, &xcolor);
1310 xcolor.red = 256 * pcolor.
R;
1311 xcolor.green = 256 * pcolor.
G;
1312 xcolor.blue = 256 * pcolor.
B;
1313 XStoreColor(
display, lut, &xcolor);
1318 xcolor.red = 256 * pcolor.
R;
1319 xcolor.green = 256 * pcolor.
G;
1320 xcolor.blue = 256 * pcolor.
B;
1321 XStoreColor(
display, lut, &xcolor);
1326 xcolor.red = 256 * pcolor.
R;
1327 xcolor.green = 256 * pcolor.
G;
1328 xcolor.blue = 256 * pcolor.
B;
1329 XStoreColor(
display, lut, &xcolor);
1334 xcolor.red = 256 * pcolor.
R;
1335 xcolor.green = 256 * pcolor.
G;
1336 xcolor.blue = 256 * pcolor.
B;
1337 XStoreColor(
display, lut, &xcolor);
1342 xcolor.red = 256 * pcolor.
R;
1343 xcolor.green = 256 * pcolor.
G;
1344 xcolor.blue = 256 * pcolor.
B;
1345 XStoreColor(
display, lut, &xcolor);
1351 xcolor.flags = DoRed | DoGreen | DoBlue;
1356 xcolor.red = 256 * pcolor.
R;
1357 xcolor.green = 256 * pcolor.
G;
1358 xcolor.blue = 256 * pcolor.
B;
1359 XAllocColor(
display, lut, &xcolor);
1365 xcolor.red = 256 * pcolor.
R;
1366 xcolor.green = 256 * pcolor.
G;
1367 xcolor.blue = 256 * pcolor.
B;
1368 XAllocColor(
display, lut, &xcolor);
1374 xcolor.red = 256 * pcolor.
R;
1375 xcolor.green = 256 * pcolor.
G;
1376 xcolor.blue = 256 * pcolor.
B;
1377 XAllocColor(
display, lut, &xcolor);
1383 xcolor.red = 256 * pcolor.
R;
1384 xcolor.green = 256 * pcolor.
G;
1385 xcolor.blue = 256 * pcolor.
B;
1386 XAllocColor(
display, lut, &xcolor);
1392 xcolor.red = 256 * pcolor.
R;
1393 xcolor.green = 256 * pcolor.
G;
1394 xcolor.blue = 256 * pcolor.
B;
1395 XAllocColor(
display, lut, &xcolor);
1401 xcolor.red = 256 * pcolor.
R;
1402 xcolor.green = 256 * pcolor.
G;
1403 xcolor.blue = 256 * pcolor.
B;
1404 XAllocColor(
display, lut, &xcolor);
1410 xcolor.red = 256 * pcolor.
R;
1411 xcolor.green = 256 * pcolor.
G;
1412 xcolor.blue = 256 * pcolor.
B;
1413 XAllocColor(
display, lut, &xcolor);
1419 xcolor.red = 256 * pcolor.
R;
1420 xcolor.green = 256 * pcolor.
G;
1421 xcolor.blue = 256 * pcolor.
B;
1422 XAllocColor(
display, lut, &xcolor);
1428 xcolor.red = 256 * pcolor.
R;
1429 xcolor.green = 256 * pcolor.
G;
1430 xcolor.blue = 256 * pcolor.
B;
1431 XAllocColor(
display, lut, &xcolor);
1437 xcolor.red = 256 * pcolor.
R;
1438 xcolor.green = 256 * pcolor.
G;
1439 xcolor.blue = 256 * pcolor.
B;
1440 XAllocColor(
display, lut, &xcolor);
1446 xcolor.red = 256 * pcolor.
R;
1447 xcolor.green = 256 * pcolor.
G;
1448 xcolor.blue = 256 * pcolor.
B;
1449 XAllocColor(
display, lut, &xcolor);
1455 xcolor.red = 256 * pcolor.
R;
1456 xcolor.green = 256 * pcolor.
G;
1457 xcolor.blue = 256 * pcolor.
B;
1458 XAllocColor(
display, lut, &xcolor);
1464 xcolor.red = 256 * pcolor.
R;
1465 xcolor.green = 256 * pcolor.
G;
1466 xcolor.blue = 256 * pcolor.
B;
1467 XAllocColor(
display, lut, &xcolor);
1473 xcolor.red = 256 * pcolor.
R;
1474 xcolor.green = 256 * pcolor.
G;
1475 xcolor.blue = 256 * pcolor.
B;
1476 XAllocColor(
display, lut, &xcolor);
1482 xcolor.red = 256 * pcolor.
R;
1483 xcolor.green = 256 * pcolor.
G;
1484 xcolor.blue = 256 * pcolor.
B;
1485 XAllocColor(
display, lut, &xcolor);
1491 xcolor.red = 256 * pcolor.
R;
1492 xcolor.green = 256 * pcolor.
G;
1493 xcolor.blue = 256 * pcolor.
B;
1494 XAllocColor(
display, lut, &xcolor);
1500 xcolor.red = 256 * pcolor.
R;
1501 xcolor.green = 256 * pcolor.
G;
1502 xcolor.blue = 256 * pcolor.
B;
1503 XAllocColor(
display, lut, &xcolor);
1509 xcolor.red = 256 * pcolor.
R;
1510 xcolor.green = 256 * pcolor.
G;
1511 xcolor.blue = 256 * pcolor.
B;
1512 XAllocColor(
display, lut, &xcolor);
1522 ExposureMask | ButtonPressMask | ButtonReleaseMask | KeyPressMask | KeyReleaseMask |
1523 StructureNotifyMask | PointerMotionMask);
1526 values.plane_mask = AllPlanes;
1527 values.fill_style = FillSolid;
1528 values.foreground = WhitePixel(
display, screen);
1529 values.background = BlackPixel(
display, screen);
1530 context = XCreateGC(
display,
window, GCPlaneMask | GCFillStyle | GCForeground | GCBackground, &values);
1532 if (context == NULL) {
1549 Ximage->data = (
char *)malloc(
m_height * (
unsigned int)Ximage->bytes_per_line);
1550 ximage_data_init =
true;
1576 if (!font.empty()) {
1579 stringfont = XLoadFont(
display, font.c_str());
1580 XSetFont(
display, context, stringfont);
1637 switch (screen_depth) {
1643 unsigned char *src_8 = (
unsigned char *)I.
bitmap;
1644 unsigned char *dst_8 = (
unsigned char *)Ximage->data;
1649 unsigned char nivGris = src_8[i];
1650 if (nivGris > nivGrisMax)
1659 unsigned char *dst_8 = (
unsigned char *)Ximage->data;
1661 for (
unsigned int i = 0; i <
m_height; i++) {
1662 for (
unsigned int j = 0; j <
m_width; j++) {
1664 if (nivGris > nivGrisMax)
1667 dst_8[k++] = nivGris;
1678 unsigned int bytes_per_line = (
unsigned int)Ximage->bytes_per_line;
1680 for (
unsigned int i = 0; i <
m_height; i++) {
1681 unsigned char *dst_8 = (
unsigned char *)Ximage->data + i * bytes_per_line;
1682 unsigned short *dst_16 = (
unsigned short *)dst_8;
1683 for (
unsigned int j = 0; j <
m_width; j++) {
1684 *(dst_16 + j) = (
unsigned short)colortable[I[i][j]];
1688 for (
unsigned int i = 0; i <
m_height; i++) {
1689 unsigned char *dst_8 = (
unsigned char *)Ximage->data + i * bytes_per_line;
1690 unsigned short *dst_16 = (
unsigned short *)dst_8;
1691 for (
unsigned int j = 0; j <
m_width; j++) {
1692 *(dst_16 + j) = (
unsigned short)colortable[I[i *
m_scale][j *
m_scale]];
1705 unsigned char *dst_32 = (
unsigned char *)Ximage->data;
1708 unsigned char *bitmap = I.
bitmap;
1709 unsigned char *n = I.
bitmap + size_;
1712 if (XImageByteOrder(
display) == 1) {
1714 while (bitmap < n) {
1715 unsigned char val = *(bitmap++);
1723 while (bitmap < n) {
1724 unsigned char val = *(bitmap++);
1732 if (XImageByteOrder(
display) == 1) {
1734 for (
unsigned int i = 0; i <
m_height; i++) {
1735 for (
unsigned int j = 0; j <
m_width; j++) {
1745 for (
unsigned int i = 0; i <
m_height; i++) {
1746 for (
unsigned int j = 0; j <
m_width; j++) {
1781 switch (screen_depth) {
1784 unsigned int r, g, b;
1785 unsigned int bytes_per_line = (
unsigned int)Ximage->bytes_per_line;
1788 for (
unsigned int i = 0; i <
m_height; i++) {
1789 unsigned char *dst_8 = (
unsigned char *)Ximage->data + i * bytes_per_line;
1790 unsigned short *dst_16 = (
unsigned short *)dst_8;
1791 for (
unsigned int j = 0; j <
m_width; j++) {
1796 (((r << 8) >> RShift) & RMask) | (((g << 8) >> GShift) & GMask) | (((b << 8) >> BShift) & BMask);
1801 for (
unsigned int i = 0; i <
m_height; i++) {
1802 unsigned char *dst_8 = (
unsigned char *)Ximage->data + i * bytes_per_line;
1803 unsigned short *dst_16 = (
unsigned short *)dst_8;
1804 for (
unsigned int j = 0; j <
m_width; j++) {
1810 (((r << 8) >> RShift) & RMask) | (((g << 8) >> GShift) & GMask) | (((b << 8) >> BShift) & BMask);
1826 unsigned char *dst_32 = NULL;
1827 dst_32 = (
unsigned char *)Ximage->data;
1831 if (XImageByteOrder(
display) == 1) {
1833 for (
unsigned int i = 0; i < sizeI; i++) {
1834 *(dst_32++) = bitmap->
A;
1835 *(dst_32++) = bitmap->
R;
1836 *(dst_32++) = bitmap->
G;
1837 *(dst_32++) = bitmap->
B;
1842 for (
unsigned int i = 0; i < sizeI; i++) {
1843 *(dst_32++) = bitmap->
B;
1844 *(dst_32++) = bitmap->
G;
1845 *(dst_32++) = bitmap->
R;
1846 *(dst_32++) = bitmap->
A;
1851 if (XImageByteOrder(
display) == 1) {
1853 for (
unsigned int i = 0; i <
m_height; i++) {
1854 for (
unsigned int j = 0; j <
m_width; j++) {
1856 *(dst_32++) = val.
A;
1857 *(dst_32++) = val.
R;
1858 *(dst_32++) = val.
G;
1859 *(dst_32++) = val.
B;
1864 for (
unsigned int i = 0; i <
m_height; i++) {
1865 for (
unsigned int j = 0; j <
m_width; j++) {
1867 *(dst_32++) = val.
B;
1868 *(dst_32++) = val.
G;
1869 *(dst_32++) = val.
R;
1870 *(dst_32++) = val.
A;
1883 "Unsupported depth (%d bpp) for color display", screen_depth));
1905 unsigned char *dst_32 = (
unsigned char *)Ximage->data;
1907 *(dst_32++) = *bitmap;
1908 *(dst_32++) = *bitmap;
1909 *(dst_32++) = *bitmap;
1910 *(dst_32++) = *bitmap;
1915 XPutImage(
display, pixmap, context, Ximage, 0, 0, 0, 0,
m_width, m_height);
1938 const unsigned int h)
1941 switch (screen_depth) {
1947 unsigned char *src_8 = (
unsigned char *)I.
bitmap;
1948 unsigned char *dst_8 = (
unsigned char *)Ximage->data;
1949 unsigned int iwidth = I.
getWidth();
1951 src_8 = src_8 + (int)(iP.
get_i() * iwidth + iP.
get_j());
1958 unsigned char nivGris = *(src_8 + j);
1959 if (nivGris > nivGrisMax)
1962 *(dst_8 + j) = nivGris;
1965 src_8 = src_8 + iwidth;
1975 int i_min = (std::max)((
int)ceil(iP.
get_i() /
m_scale), 0);
1976 int j_min = (std::max)((
int)ceil(iP.
get_j() /
m_scale), 0);
1980 unsigned int i_min_ = (
unsigned int)i_min;
1981 unsigned int i_max_ = (
unsigned int)i_max;
1982 unsigned int j_min_ = (
unsigned int)j_min;
1983 unsigned int j_max_ = (
unsigned int)j_max;
1985 for (
unsigned int i = i_min_; i < i_max_; i++) {
1986 unsigned char *dst_8 = (
unsigned char *)Ximage->data + i *
m_width;
1987 for (
unsigned int j = j_min_; j < j_max_; j++) {
1989 if (nivGris > nivGrisMax)
1995 XPutImage(
display, pixmap, context, Ximage, j_min, i_min, j_min, i_min, j_max_ - j_min_, i_max_ - i_min_);
2003 unsigned int bytes_per_line = (
unsigned int)Ximage->bytes_per_line;
2005 for (
unsigned int i = (
unsigned int)iP.
get_i(); i < (
unsigned int)(iP.
get_i() + h); i++) {
2006 unsigned char *dst_8 = (
unsigned char *)Ximage->data + i * bytes_per_line;
2007 unsigned short *dst_16 = (
unsigned short *)dst_8;
2008 for (
unsigned int j = (
unsigned int)iP.
get_j(); j < (
unsigned int)(iP.
get_j() + w); j++) {
2009 *(dst_16 + j) = (
unsigned short)colortable[I[i][j]];
2016 int i_min = (std::max)((
int)ceil(iP.
get_i() /
m_scale), 0);
2017 int j_min = (std::max)((
int)ceil(iP.
get_j() /
m_scale), 0);
2021 unsigned int i_min_ = (
unsigned int)i_min;
2022 unsigned int i_max_ = (
unsigned int)i_max;
2023 unsigned int j_min_ = (
unsigned int)j_min;
2024 unsigned int j_max_ = (
unsigned int)j_max;
2026 for (
unsigned int i = i_min_; i < i_max_; i++) {
2027 unsigned char *dst_8 = (
unsigned char *)Ximage->data + i * bytes_per_line;
2028 unsigned short *dst_16 = (
unsigned short *)dst_8;
2029 for (
unsigned int j = j_min_; j < j_max_; j++) {
2030 *(dst_16 + j) = (
unsigned short)colortable[I[i *
m_scale][j *
m_scale]];
2034 XPutImage(
display, pixmap, context, Ximage, j_min, i_min, j_min, i_min, j_max_ - j_min_, i_max_ - i_min_);
2044 unsigned int iwidth = I.
getWidth();
2046 unsigned char *dst_32 = (
unsigned char *)Ximage->data + (
int)(iP.
get_i() * 4 *
m_width + iP.
get_j() * 4);
2048 if (XImageByteOrder(
display) == 1) {
2054 unsigned char val = *(src_8 + j);
2056 *(dst_32 + 4 * j + 1) = val;
2057 *(dst_32 + 4 * j + 2) = val;
2058 *(dst_32 + 4 * j + 3) = val;
2061 src_8 = src_8 + iwidth;
2062 dst_32 = dst_32 + 4 *
m_width;
2071 unsigned char val = *(src_8 + j);
2072 *(dst_32 + 4 * j) = val;
2073 *(dst_32 + 4 * j + 1) = val;
2074 *(dst_32 + 4 * j + 2) = val;
2078 src_8 = src_8 + iwidth;
2079 dst_32 = dst_32 + 4 *
m_width;
2087 int i_min = (std::max)((
int)ceil(iP.
get_i() /
m_scale), 0);
2088 int j_min = (std::max)((
int)ceil(iP.
get_j() /
m_scale), 0);
2092 unsigned int i_min_ = (
unsigned int)i_min;
2093 unsigned int i_max_ = (
unsigned int)i_max;
2094 unsigned int j_min_ = (
unsigned int)j_min;
2095 unsigned int j_max_ = (
unsigned int)j_max;
2097 if (XImageByteOrder(
display) == 1) {
2099 for (
unsigned int i = i_min_; i < i_max_; i++) {
2100 unsigned char *dst_32 = (
unsigned char *)Ximage->data + (
int)(i * 4 *
m_width + j_min_ * 4);
2101 for (
unsigned int j = j_min_; j < j_max_; j++) {
2111 for (
unsigned int i = i_min_; i < i_max_; i++) {
2112 unsigned char *dst_32 = (
unsigned char *)Ximage->data + (
int)(i * 4 *
m_width + j_min_ * 4);
2113 for (
unsigned int j = j_min_; j < j_max_; j++) {
2123 XPutImage(
display, pixmap, context, Ximage, j_min, i_min, j_min, i_min, j_max_ - j_min_, i_max_ - i_min_);
2151 const unsigned int h)
2154 switch (screen_depth) {
2157 unsigned int bytes_per_line = (
unsigned int)Ximage->bytes_per_line;
2158 for (
unsigned int i = (
unsigned int)iP.
get_i(); i < (
unsigned int)(iP.
get_i() + h); i++) {
2159 unsigned char *dst_8 = (
unsigned char *)Ximage->data + i * bytes_per_line;
2160 unsigned short *dst_16 = (
unsigned short *)dst_8;
2161 for (
unsigned int j = (
unsigned int)iP.
get_j(); j < (
unsigned int)(iP.
get_j() + w); j++) {
2163 unsigned int r = val.
R;
2164 unsigned int g = val.
G;
2165 unsigned int b = val.
B;
2167 (((r << 8) >> RShift) & RMask) | (((g << 8) >> GShift) & GMask) | (((b << 8) >> BShift) & BMask);
2173 unsigned int bytes_per_line = (
unsigned int)Ximage->bytes_per_line;
2174 int i_min = (std::max)((int)ceil(iP.
get_i() /
m_scale), 0);
2175 int j_min = (std::max)((
int)ceil(iP.
get_j() /
m_scale), 0);
2179 unsigned int i_min_ = (
unsigned int)i_min;
2180 unsigned int i_max_ = (
unsigned int)i_max;
2181 unsigned int j_min_ = (
unsigned int)j_min;
2182 unsigned int j_max_ = (
unsigned int)j_max;
2184 for (
unsigned int i = i_min_; i < i_max_; i++) {
2185 unsigned char *dst_8 = (
unsigned char *)Ximage->data + i * bytes_per_line;
2186 unsigned short *dst_16 = (
unsigned short *)dst_8;
2187 for (
unsigned int j = j_min_; j < j_max_; j++) {
2189 unsigned int r = val.
R;
2190 unsigned int g = val.
G;
2191 unsigned int b = val.
B;
2193 (((r << 8) >> RShift) & RMask) | (((g << 8) >> GShift) & GMask) | (((b << 8) >> BShift) & BMask);
2196 XPutImage(
display, pixmap, context, Ximage, j_min, i_min, j_min, i_min, j_max_ - j_min_, i_max_ - i_min_);
2210 unsigned char *dst_32 = (
unsigned char *)Ximage->data;
2213 unsigned int iwidth = I.
getWidth();
2215 src_32 = src_32 + (int)(iP.
get_i() * iwidth + iP.
get_j());
2220 if (XImageByteOrder(
display) == 1) {
2225 *(dst_32 + 4 * j) = (src_32 + j)->A;
2226 *(dst_32 + 4 * j + 1) = (src_32 + j)->R;
2227 *(dst_32 + 4 * j + 2) = (src_32 + j)->G;
2228 *(dst_32 + 4 * j + 3) = (src_32 + j)->B;
2232 src_32 = src_32 + iwidth;
2233 dst_32 = dst_32 + 4 *
m_width;
2242 *(dst_32 + 4 * j) = (src_32 + j)->B;
2243 *(dst_32 + 4 * j + 1) = (src_32 + j)->G;
2244 *(dst_32 + 4 * j + 2) = (src_32 + j)->R;
2245 *(dst_32 + 4 * j + 3) = (src_32 + j)->A;
2249 src_32 = src_32 + iwidth;
2250 dst_32 = dst_32 + 4 *
m_width;
2258 int i_min = (std::max)((
int)ceil(iP.
get_i() /
m_scale), 0);
2259 int j_min = (std::max)((
int)ceil(iP.
get_j() /
m_scale), 0);
2263 unsigned int i_min_ = (
unsigned int)i_min;
2264 unsigned int i_max_ = (
unsigned int)i_max;
2265 unsigned int j_min_ = (
unsigned int)j_min;
2266 unsigned int j_max_ = (
unsigned int)j_max;
2268 if (XImageByteOrder(
display) == 1) {
2270 for (
unsigned int i = i_min_; i < i_max_; i++) {
2271 unsigned char *dst_32 = (
unsigned char *)Ximage->data + (
int)(i * 4 *
m_width + j_min_ * 4);
2272 for (
unsigned int j = j_min_; j < j_max_; j++) {
2274 *(dst_32++) = val.
A;
2275 *(dst_32++) = val.
R;
2276 *(dst_32++) = val.
G;
2277 *(dst_32++) = val.
B;
2282 for (
unsigned int i = i_min_; i < i_max_; i++) {
2283 unsigned char *dst_32 = (
unsigned char *)Ximage->data + (
int)(i * 4 *
m_width + j_min_ * 4);
2284 for (
unsigned int j = j_min_; j < j_max_; j++) {
2286 *(dst_32++) = val.
B;
2287 *(dst_32++) = val.
G;
2288 *(dst_32++) = val.
R;
2289 *(dst_32++) = val.
A;
2293 XPutImage(
display, pixmap, context, Ximage, j_min, i_min, j_min, i_min, j_max_ - j_min_, i_max_ - i_min_);
2301 "Unsupported depth (%d bpp) for color display", screen_depth));
2318 if (ximage_data_init ==
true)
2321 Ximage->data = NULL;
2322 XDestroyImage(Ximage);
2332 if (x_color != NULL) {
2383 xcolor.red = 256 * color.
R;
2384 xcolor.green = 256 * color.
G;
2385 xcolor.blue = 256 * color.
B;
2386 XAllocColor(
display, lut, &xcolor);
2387 XSetForeground(
display, context, xcolor.pixel);
2408 unsigned int h,
unsigned int thickness)
2416 if ((std::fabs(a) <= std::numeric_limits<double>::epsilon()) &&
2417 (std::fabs(b) <= std::numeric_limits<double>::epsilon())) {
2462 XSetForeground(
display, context, x_color[color.
id]);
2465 xcolor.red = 256 * color.
R;
2466 xcolor.green = 256 * color.
G;
2467 xcolor.blue = 256 * color.
B;
2468 XAllocColor(
display, lut, &xcolor);
2469 XSetForeground(
display, context, xcolor.pixel);
2488 unsigned int thickness)
2494 XSetForeground(
display, context, x_color[color.
id]);
2497 xcolor.red = 256 * color.
R;
2498 xcolor.green = 256 * color.
G;
2499 xcolor.blue = 256 * color.
B;
2500 XAllocColor(
display, lut, &xcolor);
2501 XSetForeground(
display, context, xcolor.pixel);
2504 XSetLineAttributes(
display, context, thickness, LineSolid, CapButt, JoinBevel);
2506 if (fill ==
false) {
2528 unsigned int thickness)
2531 double i = ip.
get_i();
2532 double j = ip.
get_j();
2535 ip1.
set_i(i - cross_size / 2);
2537 ip2.
set_i(i + cross_size / 2);
2542 ip1.
set_j(j - cross_size / 2);
2544 ip2.
set_j(j + cross_size / 2);
2558 unsigned int thickness)
2565 XSetForeground(
display, context, x_color[color.
id]);
2568 xcolor.red = 256 * color.
R;
2569 xcolor.green = 256 * color.
G;
2570 xcolor.blue = 256 * color.
B;
2571 XAllocColor(
display, lut, &xcolor);
2572 XSetForeground(
display, context, xcolor.pixel);
2575 XSetLineAttributes(
display, context, thickness, LineOnOffDash, CapButt, JoinBevel);
2591 unsigned int thickness)
2598 XSetForeground(
display, context, x_color[color.
id]);
2601 xcolor.red = 256 * color.
R;
2602 xcolor.green = 256 * color.
G;
2603 xcolor.blue = 256 * color.
B;
2604 XAllocColor(
display, lut, &xcolor);
2605 XSetForeground(
display, context, xcolor.pixel);
2608 XSetLineAttributes(
display, context, thickness, LineSolid, CapButt, JoinBevel);
2627 XSetForeground(
display, context, x_color[color.
id]);
2630 xcolor.red = 256 * color.
R;
2631 xcolor.green = 256 * color.
G;
2632 xcolor.blue = 256 * color.
B;
2633 XAllocColor(
display, lut, &xcolor);
2634 XSetForeground(
display, context, xcolor.pixel);
2637 if (thickness == 1) {
2641 thickness, thickness);
2663 bool fill,
unsigned int thickness)
2669 XSetForeground(
display, context, x_color[color.
id]);
2672 xcolor.red = 256 * color.
R;
2673 xcolor.green = 256 * color.
G;
2674 xcolor.blue = 256 * color.
B;
2675 XAllocColor(
display, lut, &xcolor);
2676 XSetForeground(
display, context, xcolor.pixel);
2678 XSetLineAttributes(
display, context, thickness, LineSolid, CapButt, JoinBevel);
2679 if (fill ==
false) {
2704 bool fill,
unsigned int thickness)
2710 XSetForeground(
display, context, x_color[color.
id]);
2713 xcolor.red = 256 * color.
R;
2714 xcolor.green = 256 * color.
G;
2715 xcolor.blue = 256 * color.
B;
2716 XAllocColor(
display, lut, &xcolor);
2717 XSetForeground(
display, context, xcolor.pixel);
2720 XSetLineAttributes(
display, context, thickness, LineSolid, CapButt, JoinBevel);
2726 if (fill ==
false) {
2728 XDrawRectangle(
display, pixmap, context,
2731 w > 0 ? w : 1, h > 0 ? h : 1);
2733 XFillRectangle(
display, pixmap, context,
2761 XSetForeground(
display, context, x_color[color.
id]);
2764 xcolor.red = 256 * color.
R;
2765 xcolor.green = 256 * color.
G;
2766 xcolor.blue = 256 * color.
B;
2767 XAllocColor(
display, lut, &xcolor);
2768 XSetForeground(
display, context, xcolor.pixel);
2771 XSetLineAttributes(
display, context, thickness, LineSolid, CapButt, JoinBevel);
2773 if (fill ==
false) {
2812 Window rootwin, childwin;
2813 int root_x, root_y, win_x, win_y;
2814 unsigned int modifier;
2818 XCheckMaskEvent(
display, ButtonPressMask, &event);
2819 XCheckMaskEvent(
display, ButtonReleaseMask, &event);
2820 XMaskEvent(
display, ButtonPressMask, &event);
2823 ret = XCheckMaskEvent(
display, ButtonPressMask, &event);
2828 if (XQueryPointer(
display,
window, &rootwin, &childwin, &root_x, &root_y, &win_x, &win_y, &modifier)) {
2859 Window rootwin, childwin;
2860 int root_x, root_y, win_x, win_y;
2861 unsigned int modifier;
2864 XCheckMaskEvent(
display, ButtonPressMask, &event);
2865 XCheckMaskEvent(
display, ButtonReleaseMask, &event);
2866 XMaskEvent(
display, ButtonPressMask, &event);
2869 ret = XCheckMaskEvent(
display, ButtonPressMask, &event);
2874 if (XQueryPointer(
display,
window, &rootwin, &childwin, &root_x, &root_y, &win_x, &win_y, &modifier)) {
2876 ip.
set_v((
double)event.xbutton.y * m_scale);
2910 Window rootwin, childwin;
2911 int root_x, root_y, win_x, win_y;
2912 unsigned int modifier;
2916 XCheckMaskEvent(
display, ButtonPressMask, &event);
2917 XCheckMaskEvent(
display, ButtonReleaseMask, &event);
2918 XMaskEvent(
display, ButtonPressMask, &event);
2921 ret = XCheckMaskEvent(
display, ButtonPressMask, &event);
2926 if (XQueryPointer(
display,
window, &rootwin, &childwin, &root_x, &root_y, &win_x, &win_y, &modifier)) {
2928 ip.
set_v((
double)event.xbutton.y * m_scale);
2929 switch (event.xbutton.button) {
2976 Window rootwin, childwin;
2977 int root_x, root_y, win_x, win_y;
2978 unsigned int modifier;
2982 XCheckMaskEvent(
display, ButtonPressMask, &event);
2983 XCheckMaskEvent(
display, ButtonReleaseMask, &event);
2984 XMaskEvent(
display, ButtonReleaseMask, &event);
2987 ret = XCheckMaskEvent(
display, ButtonReleaseMask, &event);
2992 if (XQueryPointer(
display,
window, &rootwin, &childwin, &root_x, &root_y, &win_x, &win_y, &modifier)) {
2994 ip.
set_v((
double)event.xbutton.y * m_scale);
2995 switch (event.xbutton.button) {
3032 unsigned char *src_32 = NULL;
3033 src_32 = (
unsigned char *)xi->data;
3035 if (screen_depth == 16) {
3036 for (
unsigned int i = 0; i < I.
getHeight(); i++) {
3038 for (
unsigned int j = 0; j <
m_height; j++) {
3039 size_t ij_ = i_ + j;
3040 unsigned long pixel = XGetPixel(xi, (
int)j, (
int)i);
3041 I.
bitmap[ij_].
R = (((pixel & RMask) << RShift) >> 8);
3042 I.
bitmap[ij_].
G = (((pixel & GMask) << GShift) >> 8);
3043 I.
bitmap[ij_].
B = (((pixel & BMask) << BShift) >> 8);
3052 if (XImageByteOrder(
display) == 1) {
3059 I.
bitmap[i].
R = src_32[i * 4 + 1];
3060 I.
bitmap[i].
G = src_32[i * 4 + 2];
3061 I.
bitmap[i].
B = src_32[i * 4 + 3];
3066 I.
bitmap[i].
B = src_32[i * 4];
3067 I.
bitmap[i].
G = src_32[i * 4 + 1];
3068 I.
bitmap[i].
R = src_32[i * 4 + 2];
3091 if ((display_ = XOpenDisplay(NULL)) == NULL) {
3093 XDisplayName(NULL)));
3095 screen_ = DefaultScreen(display_);
3096 depth = (
unsigned int)DefaultDepth(display_, screen_);
3098 XCloseDisplay(display_);
3112 if ((display_ = XOpenDisplay(NULL)) == NULL) {
3114 XDisplayName(NULL)));
3116 screen_ = DefaultScreen(display_);
3117 w = (
unsigned int)DisplayWidth(display_, screen_);
3118 h = (
unsigned int)DisplayHeight(display_, screen_);
3120 XCloseDisplay(display_);
3128 unsigned int width, height;
3138 unsigned int width, height;
3171 XMaskEvent(
display, KeyPressMask, &event);
3174 ret = XCheckMaskEvent(
display, KeyPressMask, &event);
3210 XComposeStatus compose_status;
3216 XMaskEvent(
display, KeyPressMask, &event);
3217 XLookupString((XKeyEvent *)&event, &buffer, 1, &keysym, &compose_status);
3221 ret = XCheckMaskEvent(
display, KeyPressMask, &event);
3223 XLookupString((XKeyEvent *)&event, &buffer, 1, &keysym, &compose_status);
3250 Window rootwin, childwin;
3251 int root_x, root_y, win_x, win_y;
3252 unsigned int modifier;
3254 ret = XCheckMaskEvent(
display, PointerMotionMask, &event);
3258 if (XQueryPointer(
display,
window, &rootwin, &childwin, &root_x, &root_y, &win_x, &win_y, &modifier)) {
3260 ip.
set_v((
double)event.xbutton.y * m_scale);
3285 Window rootwin, childwin;
3286 int root_x, root_y, win_x, win_y;
3287 unsigned int modifier;
3293 if (XQueryPointer(
display,
window, &rootwin, &childwin, &root_x, &root_y, &win_x, &win_y, &modifier)) {
3295 ip.
set_v((
double)win_y * m_scale);
3311 for (i = 31; i >= 0; --i) {
3312 if (u32val & 0x80000000L)
3319 #elif !defined(VISP_BUILD_SHARED_LIBS) 3322 void dummy_vpDisplayX(){};
void clearDisplay(const vpColor &color=vpColor::white)
void init(vpImage< unsigned char > &I, int winx=-1, int winy=-1, const std::string &title="")
int m_windowYPosition
display position
unsigned int getScreenDepth()
void displayCross(const vpImagePoint &ip, unsigned int size, const vpColor &color, unsigned int thickness=1)
void displayRectangle(const vpImagePoint &topLeft, unsigned int width, unsigned int height, const vpColor &color, bool fill=false, unsigned int thickness=1)
bool getClickUp(vpImagePoint &ip, vpMouseButton::vpMouseButtonType &button, bool blocking=true)
unsigned char B
Blue component.
Type * bitmap
points toward the bitmap
static const vpColor black
static const vpColor darkRed
Class to define colors available for display functionnalities.
static const vpColor lightGray
void displayImage(const vpImage< unsigned char > &I)
static const vpColor darkBlue
unsigned char G
Green component.
bool m_displayHasBeenInitialized
display has been initialized
static const vpColor green
static int round(const double x)
static const vpColor lightRed
bool getPointerPosition(vpImagePoint &ip)
vpWin32Window window
The window.
static const vpColor orange
unsigned int getScreenWidth()
bool getClick(bool blocking=true)
void set_i(const double ii)
int m_windowXPosition
display position
void displayImageROI(const vpImage< unsigned char > &I, const vpImagePoint &iP, const unsigned int width, const unsigned int height)
static const vpColor cyan
static const vpColor lightGreen
void setScale(vpScaleType scaleType, unsigned int width, unsigned int height)
void set_u(const double u)
static double sqr(double x)
void displayCharString(const vpImagePoint &ip, const char *text, const vpColor &color=vpColor::green)
static void display(const vpImage< unsigned char > &I)
void getScreenSize(unsigned int &width, unsigned int &height)
void set_v(const double v)
unsigned char A
Additionnal component.
int getMsb(unsigned int u32val)
bool getKeyboardEvent(bool blocking=true)
void resize(const unsigned int h, const unsigned int w)
resize the image : Image initialization
static const vpColor gray
void displayPoint(const vpImagePoint &ip, const vpColor &color, unsigned int thickness=1)
void flushDisplayROI(const vpImagePoint &iP, const unsigned int width, const unsigned int height)
void setWindowPosition(int winx, int winy)
static const vpColor darkGray
void displayLine(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)
void displayArrow(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color=vpColor::white, unsigned int w=4, unsigned int h=2, unsigned int thickness=1)
void set_j(const double jj)
Error that can be emited by the vpDisplay class and its derivates.
unsigned int getHeight() const
unsigned char R
Red component.
void setTitle(const std::string &title)
Defines a rectangle in the plane.
void setFont(const std::string &font)
static const vpColor darkGreen
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
static const vpColor yellow
static const vpColor lightBlue
static const vpColor purple
static const vpColor white
unsigned int getWidth() const
void displayCircle(const vpImagePoint ¢er, unsigned int radius, const vpColor &color, bool fill=false, unsigned int thickness=1)
bool getPointerMotionEvent(vpImagePoint &ip)
static double distance(const vpImagePoint &iP1, const vpImagePoint &iP2)
void getImage(vpImage< vpRGBa > &I)
get the window pixmap and put it in vpRGBa image
unsigned int getScreenHeight()
static const vpColor blue
void displayDotLine(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)