49 #include <visp/vpConfig.h>
59 #include <visp/vpDisplay.h>
60 #include <visp/vpDisplayX.h>
63 #include <visp/vpDebug.h>
64 #include <visp/vpDisplayException.h>
67 #include <visp/vpMath.h>
86 init ( I, x, y, title ) ;
106 init ( I, x, y, title ) ;
136 this->x_color = NULL;
139 title_ = std::string(title);
141 title_ = std::string(
" ");
143 ximage_data_init =
false;
170 ximage_data_init =
false;
194 if (x_color == NULL) {
206 title_ = std::string(title);
208 title_ = std::string(
" ");
217 hints.flags = USPosition;
225 display = XOpenDisplay ( NULL );
226 if ( display == NULL )
228 vpERROR_TRACE (
"Can't connect display on server %s.\n", XDisplayName ( NULL ) );
230 "Can't connect display on server." ) ) ;
233 screen = DefaultScreen ( display );
234 lut = DefaultColormap ( display, screen );
235 screen_depth = (
unsigned int)DefaultDepth ( display, screen );
238 XCreateSimpleWindow ( display, RootWindow ( display, screen ),
240 BlackPixel ( display, screen ),
241 WhitePixel ( display, screen ) ) ) == 0 )
245 "Can't create window." ) ) ;
251 if ( screen_depth == 8 )
253 lut = XCreateColormap ( display, window,
254 DefaultVisual ( display, screen ), AllocAll ) ;
255 xcolor.flags = DoRed | DoGreen | DoBlue ;
257 for (
unsigned int i = 0 ; i < 256 ; i++ )
260 xcolor.red = 256 * i;
261 xcolor.green = 256 * i;
262 xcolor.blue = 256 * i;
263 XStoreColor ( display, lut, &xcolor );
266 XSetWindowColormap ( display, window, lut ) ;
267 XInstallColormap ( display, lut ) ;
270 else if ( screen_depth == 16 )
272 for (
unsigned int i = 0; i < 256; i ++ )
275 xcolor.red = xcolor.green = xcolor.blue = 256 * i;
276 if ( XAllocColor ( display, lut, &xcolor ) == 0 )
278 vpERROR_TRACE (
"Can't allocate 256 colors. Only %d allocated.", i );
280 "Can't allocate 256 colors." ) ) ;
282 colortable[i] = xcolor.pixel;
285 XSetWindowColormap ( display, window, lut ) ;
286 XInstallColormap ( display, lut ) ;
293 switch ( screen_depth )
301 xcolor.red = 256 * 192;
302 xcolor.green = 256 * 192;
303 xcolor.blue = 256 * 192;
304 XStoreColor ( display, lut, &xcolor );
309 xcolor.red = 256 * 128;
310 xcolor.green = 256 * 128;
311 xcolor.blue = 256 * 128;
312 XStoreColor ( display, lut, &xcolor );
317 xcolor.red = 256 * 64;
318 xcolor.green = 256 * 64;
319 xcolor.blue = 256 * 64;
320 XStoreColor ( display, lut, &xcolor );
325 xcolor.red = 256 * 255;
326 xcolor.green = 256 * 140;
327 xcolor.blue = 256 * 140;
328 XStoreColor ( display, lut, &xcolor );
333 xcolor.red = 256 * 255;
336 XStoreColor ( display, lut, &xcolor );
341 xcolor.red = 256 * 128;
344 XStoreColor ( display, lut, &xcolor );
349 xcolor.red = 256 * 140;
350 xcolor.green = 256 * 255;
351 xcolor.blue = 256 * 140;
352 XStoreColor ( display, lut, &xcolor );
358 xcolor.green = 256 * 255;
360 XStoreColor ( display, lut, &xcolor );
366 xcolor.green = 256 * 128;
368 XStoreColor ( display, lut, &xcolor );
373 xcolor.red = 256 * 140;
374 xcolor.green = 256 * 140;
375 xcolor.blue = 256 * 255;
376 XStoreColor ( display, lut, &xcolor );
383 xcolor.blue = 256 * 255;
384 XStoreColor ( display, lut, &xcolor );
391 xcolor.blue = 256 * 128;
392 XStoreColor ( display, lut, &xcolor );
397 xcolor.red = 256 * 255;
398 xcolor.green = 256 * 255;
400 XStoreColor ( display, lut, &xcolor );
405 xcolor.red = 256 * 255;
406 xcolor.green = 256 * 165;
408 XStoreColor ( display, lut, &xcolor );
414 xcolor.green = 256 * 255;
415 xcolor.blue = 256 * 255;
416 XStoreColor ( display, lut, &xcolor );
421 xcolor.red = 256 * 128;
423 xcolor.blue = 256 * 128;
424 XStoreColor ( display, lut, &xcolor );
431 xcolor.flags = DoRed | DoGreen | DoBlue ;
438 XAllocColor ( display, lut, &xcolor );
443 xcolor.red = 256* 255;
444 xcolor.green = 256* 255;
445 xcolor.blue = 256* 255;
446 XAllocColor ( display, lut, &xcolor );
451 xcolor.red = 256 * 192;
452 xcolor.green = 256 * 192;
453 xcolor.blue = 256 * 192;
454 XAllocColor ( display, lut, &xcolor );
459 xcolor.red = 256 * 128;
460 xcolor.green = 256 * 128;
461 xcolor.blue = 256 * 128;
462 XAllocColor ( display, lut, &xcolor );
467 xcolor.red = 256 * 64;
468 xcolor.green = 256 * 64;
469 xcolor.blue = 256 * 64;
470 XAllocColor ( display, lut, &xcolor );
475 xcolor.red = 256 * 255;
476 xcolor.green = 256 * 140;
477 xcolor.blue = 256 * 140;
478 XAllocColor ( display, lut, &xcolor );
483 xcolor.red = 256* 255;
486 XAllocColor ( display, lut, &xcolor );
491 xcolor.red = 256* 128;
494 XAllocColor ( display, lut, &xcolor );
499 xcolor.red = 256 * 140;
500 xcolor.green = 256 * 255;
501 xcolor.blue = 256 * 140;
502 XAllocColor ( display, lut, &xcolor );
508 xcolor.green = 256*255;
510 XAllocColor ( display, lut, &xcolor );
516 xcolor.green = 256* 128;
518 XAllocColor ( display, lut, &xcolor );
523 xcolor.red = 256 * 140;
524 xcolor.green = 256 * 140;
525 xcolor.blue = 256 * 255;
526 XAllocColor ( display, lut, &xcolor );
533 xcolor.blue = 256* 255;
534 XAllocColor ( display, lut, &xcolor );
541 xcolor.blue = 256* 128;
542 XAllocColor ( display, lut, &xcolor );
547 xcolor.red = 256 * 255;
548 xcolor.green = 256 * 255;
550 XAllocColor ( display, lut, &xcolor );
555 xcolor.red = 256 * 255;
556 xcolor.green = 256 * 165;
558 XAllocColor ( display, lut, &xcolor );
564 xcolor.green = 256 * 255;
565 xcolor.blue = 256 * 255;
566 XAllocColor ( display, lut, &xcolor );
571 xcolor.red = 256 * 128;
573 xcolor.blue = 256 * 128;
574 XAllocColor ( display, lut, &xcolor );
580 XSetStandardProperties ( display, window, this->
title_.c_str(), this->
title_.c_str(), None, 0, 0, &hints );
581 XMapWindow ( display, window ) ;
583 XSelectInput ( display, window,
585 ButtonPressMask | ButtonReleaseMask |
586 KeyPressMask | KeyReleaseMask |
587 StructureNotifyMask |
591 values.plane_mask = AllPlanes;
592 values.fill_style = FillSolid;
593 values.foreground = WhitePixel ( display, screen );
594 values.background = BlackPixel ( display, screen );
595 context = XCreateGC ( display, window,
596 GCPlaneMask | GCFillStyle | GCForeground | GCBackground,
599 if ( context == NULL )
603 "Can't create graphics context" ) ) ;
608 pixmap = XCreatePixmap ( display, window,
width,
height, screen_depth );
611 XNextEvent ( display, &event );
612 while ( event.xany.type != Expose );
615 Ximage = XCreateImage ( display, DefaultVisual ( display, screen ),
616 screen_depth, ZPixmap, 0, NULL,
619 Ximage->data = (
char * ) malloc ( I.
getWidth() * I.
getHeight() * (
unsigned int)Ximage->bits_per_pixel / 8 );
620 ximage_data_init =
true;
625 XStoreName ( display, window,
title_.c_str() );
627 XSync ( display, 1 );
651 if (x_color == NULL) {
657 title_ = std::string(title);
659 title_ = std::string(
" ");
668 hints.flags = USPosition;
677 if ( ( display = XOpenDisplay ( NULL ) ) == NULL )
679 vpERROR_TRACE (
"Can't connect display on server %s.\n", XDisplayName ( NULL ) );
681 "Can't connect display on server." ) ) ;
684 screen = DefaultScreen ( display );
685 lut = DefaultColormap ( display, screen );
686 screen_depth = (
unsigned int)DefaultDepth ( display, screen );
690 if ( ( window = XCreateSimpleWindow ( display, RootWindow ( display, screen ),
693 BlackPixel ( display, screen ),
694 WhitePixel ( display, screen ) ) ) == 0 )
698 "Can't create window." ) ) ;
704 if ( screen_depth == 8 )
706 lut = XCreateColormap ( display, window,
707 DefaultVisual ( display, screen ), AllocAll ) ;
708 xcolor.flags = DoRed | DoGreen | DoBlue ;
710 for (
unsigned int i = 0 ; i < 256 ; i++ )
713 xcolor.red = 256 * i;
714 xcolor.green = 256 * i;
715 xcolor.blue = 256 * i;
716 XStoreColor ( display, lut, &xcolor );
719 XSetWindowColormap ( display, window, lut ) ;
720 XInstallColormap ( display, lut ) ;
723 else if ( screen_depth == 16 )
725 for (
unsigned int i = 0; i < 256; i ++ )
728 xcolor.red = xcolor.green = xcolor.blue = 256 * i;
729 if ( XAllocColor ( display, lut, &xcolor ) == 0 )
731 vpERROR_TRACE (
"Can't allocate 256 colors. Only %d allocated.", i );
733 "Can't allocate 256 colors." ) ) ;
735 colortable[i] = xcolor.pixel;
738 XSetWindowColormap ( display, window, lut ) ;
739 XInstallColormap ( display, lut ) ;
747 switch ( screen_depth )
756 xcolor.red = 256 * 192;
757 xcolor.green = 256 * 192;
758 xcolor.blue = 256 * 192;
759 XStoreColor ( display, lut, &xcolor );
764 xcolor.red = 256 * 128;
765 xcolor.green = 256 * 128;
766 xcolor.blue = 256 * 128;
767 XStoreColor ( display, lut, &xcolor );
772 xcolor.red = 256 * 64;
773 xcolor.green = 256 * 64;
774 xcolor.blue = 256 * 64;
775 XStoreColor ( display, lut, &xcolor );
780 xcolor.red = 256 * 255;
781 xcolor.green = 256 * 140;
782 xcolor.blue = 256 * 140;
783 XStoreColor ( display, lut, &xcolor );
788 xcolor.red = 256 * 255;
791 XStoreColor ( display, lut, &xcolor );
796 xcolor.red = 256 * 128;
799 XStoreColor ( display, lut, &xcolor );
804 xcolor.red = 256 * 140;
805 xcolor.green = 256 * 255;
806 xcolor.blue = 256 * 140;
807 XStoreColor ( display, lut, &xcolor );
813 xcolor.green = 256 * 255;
815 XStoreColor ( display, lut, &xcolor );
821 xcolor.green = 256 * 128;
823 XStoreColor ( display, lut, &xcolor );
828 xcolor.red = 256 * 140;
829 xcolor.green = 256 * 140;
830 xcolor.blue = 256 * 255;
831 XStoreColor ( display, lut, &xcolor );
838 xcolor.blue = 256 * 255;
839 XStoreColor ( display, lut, &xcolor );
846 xcolor.blue = 256 * 128;
847 XStoreColor ( display, lut, &xcolor );
852 xcolor.red = 256 * 255;
853 xcolor.green = 256 * 255;
855 XStoreColor ( display, lut, &xcolor );
860 xcolor.red = 256 * 255;
861 xcolor.green = 256 * 165;
863 XStoreColor ( display, lut, &xcolor );
869 xcolor.green = 256 * 255;
870 xcolor.blue = 256 * 255;
871 XStoreColor ( display, lut, &xcolor );
876 xcolor.red = 256 * 128;
878 xcolor.blue = 256 * 128;
879 XStoreColor ( display, lut, &xcolor );
886 xcolor.flags = DoRed | DoGreen | DoBlue ;
893 XAllocColor ( display, lut, &xcolor );
898 xcolor.red = 256* 255;
899 xcolor.green = 256* 255;
900 xcolor.blue = 256* 255;
901 XAllocColor ( display, lut, &xcolor );
906 xcolor.red = 256 * 192;
907 xcolor.green = 256 * 192;
908 xcolor.blue = 256 * 192;
909 XAllocColor ( display, lut, &xcolor );
914 xcolor.red = 256 * 128;
915 xcolor.green = 256 * 128;
916 xcolor.blue = 256 * 128;
917 XAllocColor ( display, lut, &xcolor );
922 xcolor.red = 256 * 64;
923 xcolor.green = 256 * 64;
924 xcolor.blue = 256 * 64;
925 XAllocColor ( display, lut, &xcolor );
930 xcolor.red = 256 * 255;
931 xcolor.green = 256 * 140;
932 xcolor.blue = 256 * 140;
933 XAllocColor ( display, lut, &xcolor );
938 xcolor.red = 256* 255;
941 XAllocColor ( display, lut, &xcolor );
946 xcolor.red = 256* 128;
949 XAllocColor ( display, lut, &xcolor );
954 xcolor.red = 256 * 140;
955 xcolor.green = 256 * 255;
956 xcolor.blue = 256 * 140;
957 XAllocColor ( display, lut, &xcolor );
963 xcolor.green = 256*255;
965 XAllocColor ( display, lut, &xcolor );
971 xcolor.green = 256* 128;
973 XAllocColor ( display, lut, &xcolor );
978 xcolor.red = 256 * 140;
979 xcolor.green = 256 * 140;
980 xcolor.blue = 256 * 255;
981 XAllocColor ( display, lut, &xcolor );
988 xcolor.blue = 256* 255;
989 XAllocColor ( display, lut, &xcolor );
996 xcolor.blue = 256* 128;
997 XAllocColor ( display, lut, &xcolor );
1002 xcolor.red = 256 * 255;
1003 xcolor.green = 256 * 255;
1005 XAllocColor ( display, lut, &xcolor );
1010 xcolor.red = 256 * 255;
1011 xcolor.green = 256 * 165;
1013 XAllocColor ( display, lut, &xcolor );
1019 xcolor.green = 256 * 255;
1020 xcolor.blue = 256 * 255;
1021 XAllocColor ( display, lut, &xcolor );
1026 xcolor.red = 256 * 128;
1028 xcolor.blue = 256 * 128;
1029 XAllocColor ( display, lut, &xcolor );
1035 XSetStandardProperties ( display, window, this->
title_.c_str(), this->
title_.c_str(), None, 0, 0, &hints );
1036 XMapWindow ( display, window ) ;
1038 XSelectInput ( display, window,
1040 ButtonPressMask | ButtonReleaseMask |
1041 KeyPressMask | KeyReleaseMask |
1042 StructureNotifyMask |
1046 values.plane_mask = AllPlanes;
1047 values.fill_style = FillSolid;
1048 values.foreground = WhitePixel ( display, screen );
1049 values.background = BlackPixel ( display, screen );
1050 context = XCreateGC ( display, window,
1051 GCPlaneMask | GCFillStyle | GCForeground | GCBackground,
1054 if ( context == NULL )
1058 "Can't create graphics context" ) ) ;
1062 pixmap = XCreatePixmap ( display, window,
width,
height, screen_depth );
1065 XNextEvent ( display, &event );
1066 while ( event.xany.type != Expose );
1070 Ximage = XCreateImage ( display, DefaultVisual ( display, screen ),
1071 screen_depth, ZPixmap, 0, NULL,
1076 * (
unsigned int)Ximage->bits_per_pixel / 8 );
1077 ximage_data_init =
true;
1082 XSync ( display,
true );
1084 XStoreName ( display, window,
title_.c_str() );
1116 hints.flags = USPosition;
1122 title_ = std::string(title);
1124 title_ = std::string(
" ");
1126 if ( ( display = XOpenDisplay ( NULL ) ) == NULL )
1128 vpERROR_TRACE (
"Can't connect display on server %s.\n", XDisplayName ( NULL ) );
1130 "Can't connect display on server." ) ) ;
1133 screen = DefaultScreen ( display );
1134 lut = DefaultColormap ( display, screen );
1135 screen_depth = (
unsigned int)DefaultDepth ( display, screen );
1137 vpTRACE (
"Screen depth: %d\n", screen_depth );
1139 if ( ( window = XCreateSimpleWindow ( display, RootWindow ( display, screen ),
1142 BlackPixel ( display, screen ),
1143 WhitePixel ( display, screen ) ) ) == 0 )
1147 "Can't create window." ) ) ;
1154 if ( screen_depth == 8 )
1156 lut = XCreateColormap ( display, window,
1157 DefaultVisual ( display, screen ), AllocAll ) ;
1158 xcolor.flags = DoRed | DoGreen | DoBlue ;
1160 for (
unsigned int i = 0 ; i < 256 ; i++ )
1163 xcolor.red = 256 * i;
1164 xcolor.green = 256 * i;
1165 xcolor.blue = 256 * i;
1166 XStoreColor ( display, lut, &xcolor );
1169 XSetWindowColormap ( display, window, lut ) ;
1170 XInstallColormap ( display, lut ) ;
1173 else if ( screen_depth == 16 )
1175 for (
unsigned int i = 0; i < 256; i ++ )
1178 xcolor.red = xcolor.green = xcolor.blue = 256 * i;
1179 if ( XAllocColor ( display, lut, &xcolor ) == 0 )
1181 vpERROR_TRACE (
"Can't allocate 256 colors. Only %d allocated.", i );
1183 "Can't allocate 256 colors." ) ) ;
1185 colortable[i] = xcolor.pixel;
1188 XSetWindowColormap ( display, window, lut ) ;
1189 XInstallColormap ( display, lut ) ;
1198 switch ( screen_depth )
1208 xcolor.pixel = 254 ;
1209 xcolor.red = 256 * pcolor.
R;
1210 xcolor.green = 256 * pcolor.
G;
1211 xcolor.blue = 256 * pcolor.
B;
1212 XStoreColor ( display, lut, &xcolor );
1216 xcolor.pixel = 253 ;
1217 xcolor.red = 256 * pcolor.
R;
1218 xcolor.green = 256 * pcolor.
G;
1219 xcolor.blue = 256 * pcolor.
B;
1220 XStoreColor ( display, lut, &xcolor );
1224 xcolor.pixel = 252 ;
1225 xcolor.red = 256 * pcolor.
R;
1226 xcolor.green = 256 * pcolor.
G;
1227 xcolor.blue = 256 * pcolor.
B;
1228 XStoreColor ( display, lut, &xcolor );
1232 xcolor.pixel = 251 ;
1233 xcolor.red = 256 * pcolor.
R;
1234 xcolor.green = 256 * pcolor.
G;
1235 xcolor.blue = 256 * pcolor.
B;
1236 XStoreColor ( display, lut, &xcolor );
1240 xcolor.pixel = 250 ;
1241 xcolor.red = 256 * pcolor.
R;
1242 xcolor.green = 256 * pcolor.
G;
1243 xcolor.blue = 256 * pcolor.
B;
1244 XStoreColor ( display, lut, &xcolor );
1248 xcolor.pixel = 249 ;
1249 xcolor.red = 256 * pcolor.
R;
1250 xcolor.green = 256 * pcolor.
G;
1251 xcolor.blue = 256 * pcolor.
B;
1252 XStoreColor ( display, lut, &xcolor );
1256 xcolor.pixel = 248 ;
1257 xcolor.red = 256 * pcolor.
R;
1258 xcolor.green = 256 * pcolor.
G;
1259 xcolor.blue = 256 * pcolor.
B;
1260 XStoreColor ( display, lut, &xcolor );
1265 xcolor.red = 256 * pcolor.
R;
1266 xcolor.green = 256 * pcolor.
G;
1267 xcolor.blue = 256 * pcolor.
B;
1268 XStoreColor ( display, lut, &xcolor );
1272 xcolor.pixel = 246 ;
1273 xcolor.red = 256 * pcolor.
R;
1274 xcolor.green = 256 * pcolor.
G;
1275 xcolor.blue = 256 * pcolor.
B;
1276 XStoreColor ( display, lut, &xcolor );
1280 xcolor.pixel = 245 ;
1281 xcolor.red = 256 * pcolor.
R;
1282 xcolor.green = 256 * pcolor.
G;
1283 xcolor.blue = 256 * pcolor.
B;
1284 XStoreColor ( display, lut, &xcolor );
1289 xcolor.red = 256 * pcolor.
R;
1290 xcolor.green = 256 * pcolor.
G;
1291 xcolor.blue = 256 * pcolor.
B;
1292 XStoreColor ( display, lut, &xcolor );
1296 xcolor.pixel = 243 ;
1297 xcolor.red = 256 * pcolor.
R;
1298 xcolor.green = 256 * pcolor.
G;
1299 xcolor.blue = 256 * pcolor.
B;
1300 XStoreColor ( display, lut, &xcolor );
1305 xcolor.red = 256 * pcolor.
R;
1306 xcolor.green = 256 * pcolor.
G;
1307 xcolor.blue = 256 * pcolor.
B;
1308 XStoreColor ( display, lut, &xcolor );
1313 xcolor.red = 256 * pcolor.
R;
1314 xcolor.green = 256 * pcolor.
G;
1315 xcolor.blue = 256 * pcolor.
B;
1316 XStoreColor ( display, lut, &xcolor );
1321 xcolor.red = 256 * pcolor.
R;
1322 xcolor.green = 256 * pcolor.
G;
1323 xcolor.blue = 256 * pcolor.
B;
1324 XStoreColor ( display, lut, &xcolor );
1329 xcolor.red = 256 * pcolor.
R;
1330 xcolor.green = 256 * pcolor.
G;
1331 xcolor.blue = 256 * pcolor.
B;
1332 XStoreColor ( display, lut, &xcolor );
1339 xcolor.flags = DoRed | DoGreen | DoBlue ;
1344 xcolor.red = 256 * pcolor.
R;
1345 xcolor.green = 256 * pcolor.
G;
1346 xcolor.blue = 256 * pcolor.
B;
1347 XAllocColor ( display, lut, &xcolor );
1353 xcolor.red = 256 * pcolor.
R;
1354 xcolor.green = 256 * pcolor.
G;
1355 xcolor.blue = 256 * pcolor.
B;
1356 XAllocColor ( display, lut, &xcolor );
1362 xcolor.red = 256 * pcolor.
R;
1363 xcolor.green = 256 * pcolor.
G;
1364 xcolor.blue = 256 * pcolor.
B;
1365 XAllocColor ( display, lut, &xcolor );
1371 xcolor.red = 256 * pcolor.
R;
1372 xcolor.green = 256 * pcolor.
G;
1373 xcolor.blue = 256 * pcolor.
B;
1374 XAllocColor ( display, lut, &xcolor );
1380 xcolor.red = 256 * pcolor.
R;
1381 xcolor.green = 256 * pcolor.
G;
1382 xcolor.blue = 256 * pcolor.
B;
1383 XAllocColor ( display, lut, &xcolor );
1389 xcolor.red = 256 * pcolor.
R;
1390 xcolor.green = 256 * pcolor.
G;
1391 xcolor.blue = 256 * pcolor.
B;
1392 XAllocColor ( display, lut, &xcolor );
1398 xcolor.red = 256 * pcolor.
R;
1399 xcolor.green = 256 * pcolor.
G;
1400 xcolor.blue = 256 * pcolor.
B;
1401 XAllocColor ( display, lut, &xcolor );
1407 xcolor.red = 256 * pcolor.
R;
1408 xcolor.green = 256 * pcolor.
G;
1409 xcolor.blue = 256 * pcolor.
B;
1410 XAllocColor ( display, lut, &xcolor );
1416 xcolor.red = 256 * pcolor.
R;
1417 xcolor.green = 256 * pcolor.
G;
1418 xcolor.blue = 256 * pcolor.
B;
1419 XAllocColor ( display, lut, &xcolor );
1425 xcolor.red = 256 * pcolor.
R;
1426 xcolor.green = 256 * pcolor.
G;
1427 xcolor.blue = 256 * pcolor.
B;
1428 XAllocColor ( display, lut, &xcolor );
1434 xcolor.red = 256 * pcolor.
R;
1435 xcolor.green = 256 * pcolor.
G;
1436 xcolor.blue = 256 * pcolor.
B;
1437 XAllocColor ( display, lut, &xcolor );
1443 xcolor.red = 256 * pcolor.
R;
1444 xcolor.green = 256 * pcolor.
G;
1445 xcolor.blue = 256 * pcolor.
B;
1446 XAllocColor ( display, lut, &xcolor );
1452 xcolor.red = 256 * pcolor.
R;
1453 xcolor.green = 256 * pcolor.
G;
1454 xcolor.blue = 256 * pcolor.
B;
1455 XAllocColor ( display, lut, &xcolor );
1461 xcolor.red = 256 * pcolor.
R;
1462 xcolor.green = 256 * pcolor.
G;
1463 xcolor.blue = 256 * pcolor.
B;
1464 XAllocColor ( display, lut, &xcolor );
1470 xcolor.red = 256 * pcolor.
R;
1471 xcolor.green = 256 * pcolor.
G;
1472 xcolor.blue = 256 * pcolor.
B;
1473 XAllocColor ( display, lut, &xcolor );
1479 xcolor.red = 256 * pcolor.
R;
1480 xcolor.green = 256 * pcolor.
G;
1481 xcolor.blue = 256 * pcolor.
B;
1482 XAllocColor ( display, lut, &xcolor );
1488 xcolor.red = 256 * pcolor.
R;
1489 xcolor.green = 256 * pcolor.
G;
1490 xcolor.blue = 256 * pcolor.
B;
1491 XAllocColor ( display, lut, &xcolor );
1497 xcolor.red = 256 * pcolor.
R;
1498 xcolor.green = 256 * pcolor.
G;
1499 xcolor.blue = 256 * pcolor.
B;
1500 XAllocColor ( display, lut, &xcolor );
1506 XSetStandardProperties ( display, window, this->
title_.c_str(), this->
title_.c_str(), None, 0, 0, &hints );
1507 XMapWindow ( display, window ) ;
1509 XSelectInput ( display, window,
1511 ButtonPressMask | ButtonReleaseMask |
1512 KeyPressMask | KeyReleaseMask |
1513 StructureNotifyMask |
1517 values.plane_mask = AllPlanes;
1518 values.fill_style = FillSolid;
1519 values.foreground = WhitePixel ( display, screen );
1520 values.background = BlackPixel ( display, screen );
1521 context = XCreateGC ( display, window,
1522 GCPlaneMask | GCFillStyle | GCForeground | GCBackground,
1525 if ( context == NULL )
1529 "Can't create graphics context" ) ) ;
1533 pixmap = XCreatePixmap ( display, window,
width,
height, screen_depth );
1536 XNextEvent ( display, &event );
1537 while ( event.xany.type != Expose );
1540 Ximage = XCreateImage ( display, DefaultVisual ( display, screen ),
1541 screen_depth, ZPixmap, 0, NULL,
1545 * (
unsigned int)Ximage->bits_per_pixel / 8 );
1546 ximage_data_init =
true;
1550 XSync ( display,
true );
1552 XStoreName ( display, window,
title_.c_str() );
1578 stringfont = XLoadFont (display, font) ;
1579 XSetFont (display, context, stringfont);
1592 "X not initialized" ) ) ;
1606 title_ = std::string(title);
1608 title_ = std::string(
" ");
1609 XStoreName ( display, window,
title_.c_str() );
1615 "X not initialized" ) ) ;
1630 XMoveWindow(display, window, winx, winy);
1636 "X not initialized" ) ) ;
1656 switch ( screen_depth )
1660 unsigned char *src_8 = NULL;
1661 unsigned char *dst_8 = NULL;
1662 src_8 = (
unsigned char * ) I.
bitmap;
1663 dst_8 = (
unsigned char * ) Ximage->data;
1669 unsigned char nivGris;
1674 nivGris = src_8[i] ;
1675 if ( nivGris > nivGrisMax )
1684 XPutImage ( display, pixmap, context, Ximage, 0, 0, 0, 0,
width,
height );
1685 XSetWindowBackgroundPixmap ( display, window, pixmap );
1692 unsigned short *dst_16 = NULL;
1693 dst_16 = (
unsigned short* ) Ximage->data;
1695 for (
unsigned int i = 0; i <
height ; i++ )
1697 for (
unsigned int j=0 ; j <
width; j++ )
1699 * ( dst_16+ ( i*width+j ) ) = (
unsigned short ) colortable[I[i][j]] ;
1704 XPutImage ( display, pixmap, context, Ximage, 0, 0, 0, 0,
width, height );
1705 XSetWindowBackgroundPixmap ( display, window, pixmap );
1714 unsigned char *dst_32 = NULL;
1716 dst_32 = (
unsigned char* ) Ximage->data;
1717 unsigned char *bitmap = I.
bitmap ;
1718 unsigned char *n = I.
bitmap + size_;
1720 while ( bitmap < n )
1722 unsigned char val = * ( bitmap++ );
1723 * ( dst_32 ++ ) = val;
1724 * ( dst_32 ++ ) = val;
1725 * ( dst_32 ++ ) = val;
1726 * ( dst_32 ++ ) = val;
1730 XPutImage ( display, pixmap, context, Ximage, 0, 0, 0, 0,
width, height );
1731 XSetWindowBackgroundPixmap ( display, window, pixmap );
1742 "X not initialized" ) ) ;
1762 switch ( screen_depth )
1771 unsigned char *dst_32 = NULL;
1772 dst_32 = (
unsigned char* ) Ximage->data;
1777 for (
unsigned int i = 0; i < sizeI ; i++ )
1779 *(dst_32++) = bitmap->A;
1780 *(dst_32++) = bitmap->R;
1781 *(dst_32++) = bitmap->G;
1782 *(dst_32++) = bitmap->B;
1786 for (
unsigned int i = 0; i < sizeI; i++ )
1788 *(dst_32++) = bitmap->B;
1789 *(dst_32++) = bitmap->G;
1790 *(dst_32++) = bitmap->R;
1791 *(dst_32++) = bitmap->A;
1796 XPutImage ( display, pixmap, context, Ximage, 0, 0, 0, 0,
width,
height );
1797 XSetWindowBackgroundPixmap ( display, window, pixmap );
1804 vpERROR_TRACE (
"Unsupported depth (%d bpp) for color display",
1807 "Unsupported depth for color display" ) ) ;
1814 "X not initialized" ) ) ;
1831 unsigned char *dst_32 = NULL;
1836 dst_32 = (
unsigned char* ) Ximage->data;
1838 for (
unsigned int i = 0; i <
width *
height; i++ )
1840 * ( dst_32 ++ ) = *I;
1841 * ( dst_32 ++ ) = *I;
1842 * ( dst_32 ++ ) = *I;
1843 * ( dst_32 ++ ) = *I;
1848 XPutImage ( display, pixmap, context, Ximage, 0, 0, 0, 0,
width, height );
1849 XSetWindowBackgroundPixmap ( display, window, pixmap );
1857 "X not initialized" ) ) ;
1878 const unsigned int w,
const unsigned int h )
1882 switch ( screen_depth )
1886 unsigned char *src_8 = NULL;
1887 unsigned char *dst_8 = NULL;
1888 src_8 = (
unsigned char * ) I.
bitmap;
1889 dst_8 = (
unsigned char * ) Ximage->data;
1894 unsigned char nivGris;
1898 unsigned int iwidth = I.
getWidth();
1900 src_8 = src_8 + (int)(iP.
get_i()*iwidth+ iP.
get_j());
1909 nivGris = *(src_8+j);
1910 if ( nivGris > nivGrisMax )
1913 *(dst_8+j) = nivGris;
1916 src_8 = src_8 + iwidth;
1917 dst_8 = dst_8 + this->
height;
1923 XPutImage ( display, pixmap, context, Ximage, iP.
get_u(), iP.
get_v(), iP.
get_u(), iP.
get_v(), w, h );
1924 XSetWindowBackgroundPixmap ( display, window, pixmap );
1931 unsigned short *dst_16 = NULL;
1932 dst_16 = (
unsigned short* ) Ximage->data;
1933 unsigned char *src_8 = NULL;
1934 src_8 = (
unsigned char * ) I.
bitmap;
1936 unsigned int iwidth = I.
getWidth();
1938 src_8 = src_8 + (int)(iP.
get_i()*iwidth+ iP.
get_j());
1947 *(dst_16+j) = (
unsigned short ) colortable[*(src_8+j)];
1950 src_8 = src_8 + iwidth;
1951 dst_16 = dst_16 + this->
height;
1956 XPutImage ( display, pixmap, context, Ximage, iP.
get_u(), iP.
get_v(), iP.
get_u(), iP.
get_v(), w, h );
1957 XSetWindowBackgroundPixmap ( display, window, pixmap );
1966 unsigned char *dst_32 = NULL;
1968 dst_32 = (
unsigned char* ) Ximage->data;
1969 unsigned char *src_8 = I.
bitmap ;
1972 unsigned int iwidth = I.
getWidth();
1974 src_8 = src_8 + (int)(iP.
get_i()*iwidth+ iP.
get_j());
1983 unsigned char val = *(src_8+j);
1984 *(dst_32+4*j) = val;
1985 *(dst_32+4*j+1) = val;
1986 *(dst_32+4*j+2) = val;
1987 *(dst_32+4*j+3) = val;
1990 src_8 = src_8 + iwidth;
1991 dst_32 = dst_32 + 4*this->
width;
1996 XPutImage ( display, pixmap, context, Ximage, iP.
get_u(), iP.
get_v(), iP.
get_u(), iP.
get_v(), w, h );
1997 XSetWindowBackgroundPixmap ( display, window, pixmap );
2008 "X not initialized" ) ) ;
2029 const unsigned int w,
const unsigned int h )
2034 switch ( screen_depth )
2043 unsigned char *dst_32 = NULL;
2044 dst_32 = (
unsigned char* ) Ximage->data;
2048 unsigned int iwidth = I.
getWidth();
2050 src_32 = src_32 + (int)(iP.
get_i()*iwidth+ iP.
get_j());
2060 *(dst_32+4*j) = (src_32+j)->A;
2061 *(dst_32+4*j+1) = (src_32+j)->R;
2062 *(dst_32+4*j+2) = (src_32+j)->G;
2063 *(dst_32+4*j+3) = (src_32+j)->B;
2065 *(dst_32+4*j) = (src_32+j)->B;
2066 *(dst_32+4*j+1) = (src_32+j)->G;
2067 *(dst_32+4*j+2) = (src_32+j)->R;
2068 *(dst_32+4*j+3) = (src_32+j)->A;
2072 src_32 = src_32 + iwidth;
2073 dst_32 = dst_32 + 4*this->
width;
2078 XPutImage ( display, pixmap, context, Ximage, iP.
get_u(), iP.
get_v(), iP.
get_u(), iP.
get_v(), w, h );
2079 XSetWindowBackgroundPixmap ( display, window, pixmap );
2086 vpERROR_TRACE (
"Unsupported depth (%d bpp) for color display",
2089 "Unsupported depth for color display" ) ) ;
2096 "X not initialized" ) ) ;
2111 if ( ximage_data_init ==
true )
2112 free ( Ximage->data );
2114 Ximage->data = NULL;
2115 XDestroyImage ( Ximage );
2117 XFreePixmap ( display, pixmap );
2119 XFreeGC ( display, context );
2120 XDestroyWindow ( display, window );
2121 XCloseDisplay ( display );
2125 if (x_color != NULL) {
2142 XClearWindow ( display, window );
2150 "X not initialized" ) ) ;
2166 XClearArea ( display, window,iP.
get_u(),iP.
get_v(),w,h,0 );
2173 "X not initialized" ) ) ;
2188 XSetWindowBackground ( display, window, x_color[color.
id] );
2191 xcolor.red = 256 * color.
R;
2192 xcolor.green = 256 * color.
G;
2193 xcolor.blue = 256 * color.
B;
2194 XAllocColor ( display, lut, &xcolor );
2195 XSetForeground ( display, context, xcolor.pixel );
2198 XClearWindow ( display, window );
2200 XFreePixmap ( display, pixmap );
2202 pixmap = XCreatePixmap ( display, window,
width,
height, screen_depth );
2208 "X not initialized" ) ) ;
2222 unsigned int w,
unsigned int h,
2223 unsigned int thickness)
2234 if ((std::fabs(a) <= std::numeric_limits<double>::epsilon() )&&(std::fabs(b) <= std::numeric_limits<double>::epsilon()) )
2270 "X not initialized" ) ) ;
2292 XSetForeground ( display, context, x_color[color.
id] );
2295 xcolor.red = 256 * color.
R;
2296 xcolor.green = 256 * color.
G;
2297 xcolor.blue = 256 * color.
B;
2298 XAllocColor ( display, lut, &xcolor );
2299 XSetForeground ( display, context, xcolor.pixel );
2301 XDrawString ( display, pixmap, context,
2303 text, (int)strlen ( text ) );
2309 "X not initialized" ) ) ;
2323 unsigned int radius,
2326 unsigned int thickness )
2330 if ( thickness == 1 ) thickness = 0;
2332 XSetForeground ( display, context, x_color[color.
id] );
2335 xcolor.red = 256 * color.
R;
2336 xcolor.green = 256 * color.
G;
2337 xcolor.blue = 256 * color.
B;
2338 XAllocColor ( display, lut, &xcolor );
2339 XSetForeground ( display, context, xcolor.pixel );
2342 XSetLineAttributes ( display, context, thickness,
2343 LineSolid, CapButt, JoinBevel );
2345 if ( fill ==
false )
2347 XDrawArc ( display, pixmap, context,
2350 radius*2, radius*2, 0, 23040 );
2354 XFillArc ( display, pixmap, context,
2357 radius*2, radius*2, 0, 23040 );
2364 "X not initialized" ) ) ;
2376 unsigned int cross_size,
2378 unsigned int thickness)
2384 double i = ip.
get_i();
2385 double j = ip.
get_j();
2388 ip1.
set_i( i-cross_size/2 );
2390 ip2.
set_i( i+cross_size/2 );
2395 ip1.
set_j( j-cross_size/2 );
2397 ip2.
set_j( j+cross_size/2 );
2412 "X not initialized" ) ) ;
2425 unsigned int thickness )
2430 if ( thickness == 1 ) thickness = 0;
2433 XSetForeground ( display, context, x_color[color.
id] );
2436 xcolor.red = 256 * color.
R;
2437 xcolor.green = 256 * color.
G;
2438 xcolor.blue = 256 * color.
B;
2439 XAllocColor ( display, lut, &xcolor );
2440 XSetForeground ( display, context, xcolor.pixel );
2443 XSetLineAttributes ( display, context, thickness,
2444 LineOnOffDash, CapButt, JoinBevel );
2446 XDrawLine ( display, pixmap, context,
2456 "X not initialized" ) ) ;
2469 unsigned int thickness )
2473 if ( thickness == 1 ) thickness = 0;
2476 XSetForeground ( display, context, x_color[color.
id] );
2479 xcolor.red = 256 * color.
R;
2480 xcolor.green = 256 * color.
G;
2481 xcolor.blue = 256 * color.
B;
2482 XAllocColor ( display, lut, &xcolor );
2483 XSetForeground ( display, context, xcolor.pixel );
2486 XSetLineAttributes ( display, context, thickness,
2487 LineSolid, CapButt, JoinBevel );
2489 XDrawLine ( display, pixmap, context,
2499 "X not initialized" ) ) ;
2514 XSetForeground ( display, context, x_color[color.
id] );
2517 xcolor.red = 256 * color.
R;
2518 xcolor.green = 256 * color.
G;
2519 xcolor.blue = 256 * color.
B;
2520 XAllocColor ( display, lut, &xcolor );
2521 XSetForeground ( display, context, xcolor.pixel );
2524 XDrawPoint ( display, pixmap, context,
2532 "X not initialized" ) ) ;
2551 unsigned int w,
unsigned int h,
2552 const vpColor &color,
bool fill,
2553 unsigned int thickness )
2557 if ( thickness == 1 ) thickness = 0;
2559 XSetForeground ( display, context, x_color[color.
id] );
2562 xcolor.red = 256 * color.
R;
2563 xcolor.green = 256 * color.
G;
2564 xcolor.blue = 256 * color.
B;
2565 XAllocColor ( display, lut, &xcolor );
2566 XSetForeground ( display, context, xcolor.pixel );
2568 XSetLineAttributes ( display, context, thickness,
2569 LineSolid, CapButt, JoinBevel );
2570 if ( fill ==
false )
2572 XDrawRectangle ( display, pixmap, context,
2579 XFillRectangle ( display, pixmap, context,
2589 "X not initialized" ) ) ;
2608 const vpColor &color,
bool fill,
2609 unsigned int thickness )
2613 if ( thickness == 1 ) thickness = 0;
2615 XSetForeground ( display, context, x_color[color.
id] );
2618 xcolor.red = 256 * color.
R;
2619 xcolor.green = 256 * color.
G;
2620 xcolor.blue = 256 * color.
B;
2621 XAllocColor ( display, lut, &xcolor );
2622 XSetForeground ( display, context, xcolor.pixel );
2625 XSetLineAttributes ( display, context, thickness,
2626 LineSolid, CapButt, JoinBevel );
2630 if ( fill ==
false )
2633 XDrawRectangle ( display, pixmap, context,
2636 w > 0 ? w-1 : 1, h > 0 ? h : 1 );
2640 XFillRectangle ( display, pixmap, context,
2650 "X not initialized" ) ) ;
2668 const vpColor &color,
bool fill,
2669 unsigned int thickness )
2673 if ( thickness == 1 ) thickness = 0;
2675 XSetForeground ( display, context, x_color[color.
id] );
2678 xcolor.red = 256 * color.
R;
2679 xcolor.green = 256 * color.
G;
2680 xcolor.blue = 256 * color.
B;
2681 XAllocColor ( display, lut, &xcolor );
2682 XSetForeground ( display, context, xcolor.pixel );
2685 XSetLineAttributes ( display, context, thickness,
2686 LineSolid, CapButt, JoinBevel );
2688 if ( fill ==
false )
2690 XDrawRectangle ( display, pixmap, context,
2698 XFillRectangle ( display, pixmap, context,
2710 "X not initialized" ) ) ;
2737 Window rootwin, childwin ;
2738 int root_x, root_y, win_x, win_y ;
2739 unsigned int modifier ;
2743 XCheckMaskEvent(display , ButtonPressMask, &event);
2744 XCheckMaskEvent(display , ButtonReleaseMask, &event);
2745 XMaskEvent ( display, ButtonPressMask ,&event );
2749 ret = XCheckMaskEvent(display , ButtonPressMask, &event);
2754 if ( XQueryPointer ( display,
2756 &rootwin, &childwin,
2765 "X not initialized" ) ) ;
2793 Window rootwin, childwin ;
2794 int root_x, root_y, win_x, win_y ;
2795 unsigned int modifier ;
2798 XCheckMaskEvent(display , ButtonPressMask, &event);
2799 XCheckMaskEvent(display , ButtonReleaseMask, &event);
2800 XMaskEvent ( display, ButtonPressMask ,&event );
2804 ret = XCheckMaskEvent(display , ButtonPressMask, &event);
2809 if ( XQueryPointer ( display,
2811 &rootwin, &childwin,
2815 ip.
set_u( (
double)event.xbutton.x );
2816 ip.
set_v( (
double)event.xbutton.y );
2823 "X not initialized" ) ) ;
2856 Window rootwin, childwin ;
2857 int root_x, root_y, win_x, win_y ;
2858 unsigned int modifier ;
2862 XCheckMaskEvent(display , ButtonPressMask, &event);
2863 XCheckMaskEvent(display , ButtonReleaseMask, &event);
2864 XMaskEvent ( display, ButtonPressMask ,&event );
2868 ret = XCheckMaskEvent(display , ButtonPressMask, &event);
2873 if ( XQueryPointer ( display,
2875 &rootwin, &childwin,
2879 ip.
set_u( (
double)event.xbutton.x );
2880 ip.
set_v( (
double)event.xbutton.y );
2881 switch ( event.xbutton.button ) {
2892 "X not initialized" ) ) ;
2928 Window rootwin, childwin ;
2929 int root_x, root_y, win_x, win_y ;
2930 unsigned int modifier ;
2934 XCheckMaskEvent(display , ButtonPressMask, &event);
2935 XCheckMaskEvent(display , ButtonReleaseMask, &event);
2936 XMaskEvent ( display, ButtonReleaseMask ,&event );
2940 ret = XCheckMaskEvent(display , ButtonReleaseMask, &event);
2945 if ( XQueryPointer ( display,
2947 &rootwin, &childwin,
2951 ip.
set_u( (
double)event.xbutton.x );
2952 ip.
set_v( (
double)event.xbutton.y );
2953 switch ( event.xbutton.button ) {
2964 "X not initialized" ) ) ;
2986 XCopyArea (display,window, pixmap, context,
2990 AllPlanes, ZPixmap ) ;
3002 unsigned char *src_32 = NULL;
3003 src_32 = (
unsigned char* ) xi->data;
3010 I.
bitmap[i].
R = src_32[i*4 + 1] ;
3011 I.
bitmap[i].
G = src_32[i*4 + 2] ;
3012 I.
bitmap[i].
B = src_32[i*4 + 3] ;
3018 I.
bitmap[i].
G = src_32[i*4 + 1] ;
3019 I.
bitmap[i].
R = src_32[i*4 + 2] ;
3020 I.
bitmap[i].
A = src_32[i*4 + 3] ;
3025 XDestroyImage ( xi ) ;
3032 "X not initialized" ) ) ;
3045 if ( ( display_ = XOpenDisplay ( NULL ) ) == NULL )
3048 XDisplayName ( NULL ) );
3050 "Can't connect display on server." ) ) ;
3052 screen_ = DefaultScreen ( display_ );
3053 depth = (
unsigned int)DefaultDepth ( display_, screen_ );
3055 XCloseDisplay ( display_ );
3069 if ( ( display_ = XOpenDisplay ( NULL ) ) == NULL )
3072 XDisplayName ( NULL ) );
3074 "Can't connect display on server." ) ) ;
3076 screen_ = DefaultScreen ( display_ );
3077 w = (
unsigned int)DisplayWidth ( display_, screen_ );
3078 h = (
unsigned int)DisplayHeight ( display_, screen_ );
3080 XCloseDisplay ( display_ );
3111 XMaskEvent ( display, KeyPressMask ,&event );
3115 ret = XCheckMaskEvent(display , KeyPressMask, &event);
3121 "X not initialized" ) ) ;
3155 XComposeStatus compose_status;
3161 XMaskEvent ( display, KeyPressMask ,&event );
3162 XLookupString ((XKeyEvent *)&event, &buffer, 1,
3163 &keysym, &compose_status);
3165 sprintf(
string,
"%c", buffer);
3169 ret = XCheckMaskEvent(display , KeyPressMask, &event);
3171 XLookupString ((XKeyEvent *)&event, &buffer, 1,
3172 &keysym, &compose_status);
3173 sprintf(
string,
"%c", buffer);
3180 "X not initialized" ) ) ;
3203 Window rootwin, childwin ;
3204 int root_x, root_y, win_x, win_y ;
3205 unsigned int modifier ;
3207 ret = XCheckMaskEvent(display , PointerMotionMask, &event);
3211 if ( XQueryPointer ( display,
3213 &rootwin, &childwin,
3217 ip.
set_u( (
double)event.xbutton.x );
3218 ip.
set_v( (
double)event.xbutton.y );
3225 "X not initialized" ) ) ;
3247 Window rootwin, childwin ;
3248 int root_x, root_y, win_x, win_y ;
3249 unsigned int modifier ;
3255 if ( XQueryPointer ( display,
3257 &rootwin, &childwin,
3261 ip.
set_u( (
double)win_x );
3262 ip.
set_v( (
double)win_y );
3269 "X not initialized" ) ) ;
void clearDisplay(const vpColor &color=vpColor::white)
unsigned int getScreenDepth()
void displayCross(const vpImagePoint &ip, unsigned int size, const vpColor &color, unsigned int thickness=1)
void setFont(const char *font)
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 int getWidth() const
void displayImage(const vpImage< vpRGBa > &I)
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
static const vpColor darkBlue
bool displayHasBeenInitialized
display has been initialized
unsigned char G
Green component.
static const vpColor green
unsigned int getHeight() const
static int round(const double x)
static const vpColor lightRed
Class that defines a RGB 32 bits structure.
bool getPointerPosition(vpImagePoint &ip)
static const vpColor orange
bool getClick(bool blocking=true)
void set_i(const double ii)
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 set_u(const double u)
static double sqr(double x)
void displayCharString(const vpImagePoint &ip, const char *text, const vpColor &color=vpColor::green)
void getScreenSize(unsigned int &width, unsigned int &height)
void set_v(const double v)
unsigned char A
Additionnal component.
bool getKeyboardEvent(bool blocking=true)
void resize(const unsigned int h, const unsigned int w)
set the size of the image
static const vpColor gray
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 setTitle(const char *title)
void set_j(const double jj)
Error that can be emited by the vpDisplay class and its derivates.
void displayPoint(const vpImagePoint &ip, const vpColor &color)
int windowXPosition
display position
unsigned char R
Red component.
unsigned int getWidth() const
unsigned int getHeight() const
Defines a rectangle in the plane.
static const vpColor darkGreen
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
void init(vpImage< unsigned char > &I, int winx=-1, int winy=-1, const char *title=NULL)
static const vpColor yellow
static const vpColor lightBlue
int windowYPosition
display position
static const vpColor purple
static const vpColor white
void displayCircle(const vpImagePoint ¢er, unsigned int radius, const vpColor &color, bool fill=false, unsigned int thickness=1)
bool getPointerMotionEvent(vpImagePoint &ip)
void getImage(vpImage< vpRGBa > &I)
get the window pixmap and put it in vpRGBa image
static const vpColor blue
void displayDotLine(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)