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>
80 screen(0), event(), pixmap(), x_color(NULL),
81 screen_depth(8), xcolor(), values(), ximage_data_init(false),
82 RMask(0), GMask(0), BMask(0), RShift(0), GShift(0), BShift(0)
84 init ( I, x, y, title ) ;
102 screen(0), event(), pixmap(), x_color(NULL),
103 screen_depth(8), xcolor(), values(), ximage_data_init(false),
104 RMask(0), GMask(0), BMask(0), RShift(0), GShift(0), BShift(0)
106 init ( I, x, y, title ) ;
133 screen(0), event(), pixmap(), x_color(NULL),
134 screen_depth(8), xcolor(), values(), ximage_data_init(false),
135 RMask(0), GMask(0), BMask(0), RShift(0), GShift(0), BShift(0)
141 title_ = std::string(title);
143 title_ = std::string(
" ");
167 screen(0), event(), pixmap(), x_color(NULL),
168 screen_depth(8), xcolor(), values(), ximage_data_init(false),
169 RMask(0), GMask(0), BMask(0), RShift(0), GShift(0), BShift(0)
193 if (x_color == NULL) {
205 title_ = std::string(title);
207 title_ = std::string(
" ");
216 hints.flags = USPosition;
224 display = XOpenDisplay ( NULL );
227 vpERROR_TRACE (
"Can't connect display on server %s.\n", XDisplayName ( NULL ) );
229 "Can't connect display on server." ) ) ;
232 screen = DefaultScreen (
display );
233 lut = DefaultColormap (
display, screen );
234 screen_depth = (
unsigned int)DefaultDepth (
display, screen );
238 BlackPixel (
display, screen ),
239 WhitePixel (
display, screen ) ) ) == 0 )
243 "Can't create window." ) ) ;
249 if ( screen_depth == 8 )
252 DefaultVisual (
display, screen ), AllocAll ) ;
253 xcolor.flags = DoRed | DoGreen | DoBlue ;
255 for (
unsigned int i = 0 ; i < 256 ; i++ )
258 xcolor.red = 256 * i;
259 xcolor.green = 256 * i;
260 xcolor.blue = 256 * i;
261 XStoreColor (
display, lut, &xcolor );
265 XInstallColormap (
display, lut ) ;
268 else if ( screen_depth == 16 )
270 for (
unsigned int i = 0; i < 256; i ++ )
273 xcolor.red = xcolor.green = xcolor.blue = 256 * i;
274 if ( XAllocColor (
display, lut, &xcolor ) == 0 )
276 vpERROR_TRACE (
"Can't allocate 256 colors. Only %d allocated.", i );
278 "Can't allocate 256 colors." ) ) ;
280 colortable[i] = xcolor.pixel;
284 XInstallColormap (
display, lut ) ;
286 Visual *visual = DefaultVisual (
display, screen);
287 RMask = visual->red_mask;
288 GMask = visual->green_mask;
289 BMask = visual->blue_mask;
291 RShift = 15 -
getMsb(RMask);
292 GShift = 15 -
getMsb(GMask);
293 BShift = 15 -
getMsb(BMask);
299 switch ( screen_depth )
307 xcolor.red = 256 * 192;
308 xcolor.green = 256 * 192;
309 xcolor.blue = 256 * 192;
310 XStoreColor (
display, lut, &xcolor );
315 xcolor.red = 256 * 128;
316 xcolor.green = 256 * 128;
317 xcolor.blue = 256 * 128;
318 XStoreColor (
display, lut, &xcolor );
323 xcolor.red = 256 * 64;
324 xcolor.green = 256 * 64;
325 xcolor.blue = 256 * 64;
326 XStoreColor (
display, lut, &xcolor );
331 xcolor.red = 256 * 255;
332 xcolor.green = 256 * 140;
333 xcolor.blue = 256 * 140;
334 XStoreColor (
display, lut, &xcolor );
339 xcolor.red = 256 * 255;
342 XStoreColor (
display, lut, &xcolor );
347 xcolor.red = 256 * 128;
350 XStoreColor (
display, lut, &xcolor );
355 xcolor.red = 256 * 140;
356 xcolor.green = 256 * 255;
357 xcolor.blue = 256 * 140;
358 XStoreColor (
display, lut, &xcolor );
364 xcolor.green = 256 * 255;
366 XStoreColor (
display, lut, &xcolor );
372 xcolor.green = 256 * 128;
374 XStoreColor (
display, lut, &xcolor );
379 xcolor.red = 256 * 140;
380 xcolor.green = 256 * 140;
381 xcolor.blue = 256 * 255;
382 XStoreColor (
display, lut, &xcolor );
389 xcolor.blue = 256 * 255;
390 XStoreColor (
display, lut, &xcolor );
397 xcolor.blue = 256 * 128;
398 XStoreColor (
display, lut, &xcolor );
403 xcolor.red = 256 * 255;
404 xcolor.green = 256 * 255;
406 XStoreColor (
display, lut, &xcolor );
411 xcolor.red = 256 * 255;
412 xcolor.green = 256 * 165;
414 XStoreColor (
display, lut, &xcolor );
420 xcolor.green = 256 * 255;
421 xcolor.blue = 256 * 255;
422 XStoreColor (
display, lut, &xcolor );
427 xcolor.red = 256 * 128;
429 xcolor.blue = 256 * 128;
430 XStoreColor (
display, lut, &xcolor );
437 xcolor.flags = DoRed | DoGreen | DoBlue ;
444 XAllocColor (
display, lut, &xcolor );
449 xcolor.red = 256* 255;
450 xcolor.green = 256* 255;
451 xcolor.blue = 256* 255;
452 XAllocColor (
display, lut, &xcolor );
457 xcolor.red = 256 * 192;
458 xcolor.green = 256 * 192;
459 xcolor.blue = 256 * 192;
460 XAllocColor (
display, lut, &xcolor );
465 xcolor.red = 256 * 128;
466 xcolor.green = 256 * 128;
467 xcolor.blue = 256 * 128;
468 XAllocColor (
display, lut, &xcolor );
473 xcolor.red = 256 * 64;
474 xcolor.green = 256 * 64;
475 xcolor.blue = 256 * 64;
476 XAllocColor (
display, lut, &xcolor );
481 xcolor.red = 256 * 255;
482 xcolor.green = 256 * 140;
483 xcolor.blue = 256 * 140;
484 XAllocColor (
display, lut, &xcolor );
489 xcolor.red = 256* 255;
492 XAllocColor (
display, lut, &xcolor );
497 xcolor.red = 256* 128;
500 XAllocColor (
display, lut, &xcolor );
505 xcolor.red = 256 * 140;
506 xcolor.green = 256 * 255;
507 xcolor.blue = 256 * 140;
508 XAllocColor (
display, lut, &xcolor );
514 xcolor.green = 256*255;
516 XAllocColor (
display, lut, &xcolor );
522 xcolor.green = 256* 128;
524 XAllocColor (
display, lut, &xcolor );
529 xcolor.red = 256 * 140;
530 xcolor.green = 256 * 140;
531 xcolor.blue = 256 * 255;
532 XAllocColor (
display, lut, &xcolor );
539 xcolor.blue = 256* 255;
540 XAllocColor (
display, lut, &xcolor );
547 xcolor.blue = 256* 128;
548 XAllocColor (
display, lut, &xcolor );
553 xcolor.red = 256 * 255;
554 xcolor.green = 256 * 255;
556 XAllocColor (
display, lut, &xcolor );
561 xcolor.red = 256 * 255;
562 xcolor.green = 256 * 165;
564 XAllocColor (
display, lut, &xcolor );
570 xcolor.green = 256 * 255;
571 xcolor.blue = 256 * 255;
572 XAllocColor (
display, lut, &xcolor );
577 xcolor.red = 256 * 128;
579 xcolor.blue = 256 * 128;
580 XAllocColor (
display, lut, &xcolor );
591 ButtonPressMask | ButtonReleaseMask |
592 KeyPressMask | KeyReleaseMask |
593 StructureNotifyMask |
597 values.plane_mask = AllPlanes;
598 values.fill_style = FillSolid;
599 values.foreground = WhitePixel (
display, screen );
600 values.background = BlackPixel (
display, screen );
602 GCPlaneMask | GCFillStyle | GCForeground | GCBackground,
605 if ( context == NULL )
609 "Can't create graphics context" ) ) ;
622 Ximage = XCreateImage (
display, DefaultVisual (
display, screen ),
623 screen_depth, ZPixmap, 0, NULL,
626 Ximage->data = (
char * ) malloc ( I.
getHeight() * (
unsigned int)Ximage->bytes_per_line );
627 ximage_data_init =
true;
658 if (x_color == NULL) {
664 title_ = std::string(title);
666 title_ = std::string(
" ");
675 hints.flags = USPosition;
684 if ( (
display = XOpenDisplay ( NULL ) ) == NULL )
686 vpERROR_TRACE (
"Can't connect display on server %s.\n", XDisplayName ( NULL ) );
688 "Can't connect display on server." ) ) ;
691 screen = DefaultScreen (
display );
692 lut = DefaultColormap (
display, screen );
693 screen_depth = (
unsigned int)DefaultDepth (
display, screen );
700 BlackPixel (
display, screen ),
701 WhitePixel (
display, screen ) ) ) == 0 )
705 "Can't create window." ) ) ;
711 if ( screen_depth == 8 )
714 DefaultVisual (
display, screen ), AllocAll ) ;
715 xcolor.flags = DoRed | DoGreen | DoBlue ;
717 for (
unsigned int i = 0 ; i < 256 ; i++ )
720 xcolor.red = 256 * i;
721 xcolor.green = 256 * i;
722 xcolor.blue = 256 * i;
723 XStoreColor (
display, lut, &xcolor );
727 XInstallColormap (
display, lut ) ;
730 else if ( screen_depth == 16 )
732 for (
unsigned int i = 0; i < 256; i ++ )
735 xcolor.red = xcolor.green = xcolor.blue = 256 * i;
736 if ( XAllocColor (
display, lut, &xcolor ) == 0 )
738 vpERROR_TRACE (
"Can't allocate 256 colors. Only %d allocated.", i );
740 "Can't allocate 256 colors." ) ) ;
742 colortable[i] = xcolor.pixel;
745 Visual *visual = DefaultVisual (
display, screen);
746 RMask = visual->red_mask;
747 GMask = visual->green_mask;
748 BMask = visual->blue_mask;
750 RShift = 15 -
getMsb(RMask);
751 GShift = 15 -
getMsb(GMask);
752 BShift = 15 -
getMsb(BMask);
755 XInstallColormap (
display, lut ) ;
762 switch ( screen_depth )
771 xcolor.red = 256 * 192;
772 xcolor.green = 256 * 192;
773 xcolor.blue = 256 * 192;
774 XStoreColor (
display, lut, &xcolor );
779 xcolor.red = 256 * 128;
780 xcolor.green = 256 * 128;
781 xcolor.blue = 256 * 128;
782 XStoreColor (
display, lut, &xcolor );
787 xcolor.red = 256 * 64;
788 xcolor.green = 256 * 64;
789 xcolor.blue = 256 * 64;
790 XStoreColor (
display, lut, &xcolor );
795 xcolor.red = 256 * 255;
796 xcolor.green = 256 * 140;
797 xcolor.blue = 256 * 140;
798 XStoreColor (
display, lut, &xcolor );
803 xcolor.red = 256 * 255;
806 XStoreColor (
display, lut, &xcolor );
811 xcolor.red = 256 * 128;
814 XStoreColor (
display, lut, &xcolor );
819 xcolor.red = 256 * 140;
820 xcolor.green = 256 * 255;
821 xcolor.blue = 256 * 140;
822 XStoreColor (
display, lut, &xcolor );
828 xcolor.green = 256 * 255;
830 XStoreColor (
display, lut, &xcolor );
836 xcolor.green = 256 * 128;
838 XStoreColor (
display, lut, &xcolor );
843 xcolor.red = 256 * 140;
844 xcolor.green = 256 * 140;
845 xcolor.blue = 256 * 255;
846 XStoreColor (
display, lut, &xcolor );
853 xcolor.blue = 256 * 255;
854 XStoreColor (
display, lut, &xcolor );
861 xcolor.blue = 256 * 128;
862 XStoreColor (
display, lut, &xcolor );
867 xcolor.red = 256 * 255;
868 xcolor.green = 256 * 255;
870 XStoreColor (
display, lut, &xcolor );
875 xcolor.red = 256 * 255;
876 xcolor.green = 256 * 165;
878 XStoreColor (
display, lut, &xcolor );
884 xcolor.green = 256 * 255;
885 xcolor.blue = 256 * 255;
886 XStoreColor (
display, lut, &xcolor );
891 xcolor.red = 256 * 128;
893 xcolor.blue = 256 * 128;
894 XStoreColor (
display, lut, &xcolor );
901 xcolor.flags = DoRed | DoGreen | DoBlue ;
908 XAllocColor (
display, lut, &xcolor );
913 xcolor.red = 256* 255;
914 xcolor.green = 256* 255;
915 xcolor.blue = 256* 255;
916 XAllocColor (
display, lut, &xcolor );
921 xcolor.red = 256 * 192;
922 xcolor.green = 256 * 192;
923 xcolor.blue = 256 * 192;
924 XAllocColor (
display, lut, &xcolor );
929 xcolor.red = 256 * 128;
930 xcolor.green = 256 * 128;
931 xcolor.blue = 256 * 128;
932 XAllocColor (
display, lut, &xcolor );
937 xcolor.red = 256 * 64;
938 xcolor.green = 256 * 64;
939 xcolor.blue = 256 * 64;
940 XAllocColor (
display, lut, &xcolor );
945 xcolor.red = 256 * 255;
946 xcolor.green = 256 * 140;
947 xcolor.blue = 256 * 140;
948 XAllocColor (
display, lut, &xcolor );
953 xcolor.red = 256* 255;
956 XAllocColor (
display, lut, &xcolor );
961 xcolor.red = 256* 128;
964 XAllocColor (
display, lut, &xcolor );
969 xcolor.red = 256 * 140;
970 xcolor.green = 256 * 255;
971 xcolor.blue = 256 * 140;
972 XAllocColor (
display, lut, &xcolor );
978 xcolor.green = 256*255;
980 XAllocColor (
display, lut, &xcolor );
986 xcolor.green = 256* 128;
988 XAllocColor (
display, lut, &xcolor );
993 xcolor.red = 256 * 140;
994 xcolor.green = 256 * 140;
995 xcolor.blue = 256 * 255;
996 XAllocColor (
display, lut, &xcolor );
1003 xcolor.blue = 256* 255;
1004 XAllocColor (
display, lut, &xcolor );
1011 xcolor.blue = 256* 128;
1012 XAllocColor (
display, lut, &xcolor );
1017 xcolor.red = 256 * 255;
1018 xcolor.green = 256 * 255;
1020 XAllocColor (
display, lut, &xcolor );
1025 xcolor.red = 256 * 255;
1026 xcolor.green = 256 * 165;
1028 XAllocColor (
display, lut, &xcolor );
1034 xcolor.green = 256 * 255;
1035 xcolor.blue = 256 * 255;
1036 XAllocColor (
display, lut, &xcolor );
1041 xcolor.red = 256 * 128;
1043 xcolor.blue = 256 * 128;
1044 XAllocColor (
display, lut, &xcolor );
1055 ButtonPressMask | ButtonReleaseMask |
1056 KeyPressMask | KeyReleaseMask |
1057 StructureNotifyMask |
1061 values.plane_mask = AllPlanes;
1062 values.fill_style = FillSolid;
1063 values.foreground = WhitePixel (
display, screen );
1064 values.background = BlackPixel (
display, screen );
1066 GCPlaneMask | GCFillStyle | GCForeground | GCBackground,
1069 if ( context == NULL )
1073 "Can't create graphics context" ) ) ;
1085 Ximage = XCreateImage (
display, DefaultVisual (
display, screen ),
1086 screen_depth, ZPixmap, 0, NULL,
1090 Ximage->data = (
char * ) malloc ( I.
getHeight() * (
unsigned int)Ximage->bytes_per_line );
1091 ximage_data_init =
true;
1113 if (x_color == NULL) {
1134 hints.flags = USPosition;
1140 title_ = std::string(title);
1142 title_ = std::string(
" ");
1144 if ( (
display = XOpenDisplay ( NULL ) ) == NULL )
1146 vpERROR_TRACE (
"Can't connect display on server %s.\n", XDisplayName ( NULL ) );
1148 "Can't connect display on server." ) ) ;
1151 screen = DefaultScreen (
display );
1152 lut = DefaultColormap (
display, screen );
1153 screen_depth = (
unsigned int)DefaultDepth (
display, screen );
1155 vpTRACE (
"Screen depth: %d\n", screen_depth );
1160 BlackPixel (
display, screen ),
1161 WhitePixel (
display, screen ) ) ) == 0 )
1165 "Can't create window." ) ) ;
1172 if ( screen_depth == 8 )
1175 DefaultVisual (
display, screen ), AllocAll ) ;
1176 xcolor.flags = DoRed | DoGreen | DoBlue ;
1178 for (
unsigned int i = 0 ; i < 256 ; i++ )
1181 xcolor.red = 256 * i;
1182 xcolor.green = 256 * i;
1183 xcolor.blue = 256 * i;
1184 XStoreColor (
display, lut, &xcolor );
1188 XInstallColormap (
display, lut ) ;
1191 else if ( screen_depth == 16 )
1193 for (
unsigned int i = 0; i < 256; i ++ )
1196 xcolor.red = xcolor.green = xcolor.blue = 256 * i;
1197 if ( XAllocColor (
display, lut, &xcolor ) == 0 )
1199 vpERROR_TRACE (
"Can't allocate 256 colors. Only %d allocated.", i );
1201 "Can't allocate 256 colors." ) ) ;
1203 colortable[i] = xcolor.pixel;
1207 XInstallColormap (
display, lut ) ;
1209 Visual *visual = DefaultVisual (
display, screen);
1210 RMask = visual->red_mask;
1211 GMask = visual->green_mask;
1212 BMask = visual->blue_mask;
1214 RShift = 15 -
getMsb(RMask);
1215 GShift = 15 -
getMsb(GMask);
1216 BShift = 15 -
getMsb(BMask);
1224 switch ( screen_depth )
1234 xcolor.pixel = 254 ;
1235 xcolor.red = 256 * pcolor.
R;
1236 xcolor.green = 256 * pcolor.
G;
1237 xcolor.blue = 256 * pcolor.
B;
1238 XStoreColor (
display, lut, &xcolor );
1242 xcolor.pixel = 253 ;
1243 xcolor.red = 256 * pcolor.
R;
1244 xcolor.green = 256 * pcolor.
G;
1245 xcolor.blue = 256 * pcolor.
B;
1246 XStoreColor (
display, lut, &xcolor );
1250 xcolor.pixel = 252 ;
1251 xcolor.red = 256 * pcolor.
R;
1252 xcolor.green = 256 * pcolor.
G;
1253 xcolor.blue = 256 * pcolor.
B;
1254 XStoreColor (
display, lut, &xcolor );
1258 xcolor.pixel = 251 ;
1259 xcolor.red = 256 * pcolor.
R;
1260 xcolor.green = 256 * pcolor.
G;
1261 xcolor.blue = 256 * pcolor.
B;
1262 XStoreColor (
display, lut, &xcolor );
1266 xcolor.pixel = 250 ;
1267 xcolor.red = 256 * pcolor.
R;
1268 xcolor.green = 256 * pcolor.
G;
1269 xcolor.blue = 256 * pcolor.
B;
1270 XStoreColor (
display, lut, &xcolor );
1274 xcolor.pixel = 249 ;
1275 xcolor.red = 256 * pcolor.
R;
1276 xcolor.green = 256 * pcolor.
G;
1277 xcolor.blue = 256 * pcolor.
B;
1278 XStoreColor (
display, lut, &xcolor );
1282 xcolor.pixel = 248 ;
1283 xcolor.red = 256 * pcolor.
R;
1284 xcolor.green = 256 * pcolor.
G;
1285 xcolor.blue = 256 * pcolor.
B;
1286 XStoreColor (
display, lut, &xcolor );
1291 xcolor.red = 256 * pcolor.
R;
1292 xcolor.green = 256 * pcolor.
G;
1293 xcolor.blue = 256 * pcolor.
B;
1294 XStoreColor (
display, lut, &xcolor );
1298 xcolor.pixel = 246 ;
1299 xcolor.red = 256 * pcolor.
R;
1300 xcolor.green = 256 * pcolor.
G;
1301 xcolor.blue = 256 * pcolor.
B;
1302 XStoreColor (
display, lut, &xcolor );
1306 xcolor.pixel = 245 ;
1307 xcolor.red = 256 * pcolor.
R;
1308 xcolor.green = 256 * pcolor.
G;
1309 xcolor.blue = 256 * pcolor.
B;
1310 XStoreColor (
display, lut, &xcolor );
1315 xcolor.red = 256 * pcolor.
R;
1316 xcolor.green = 256 * pcolor.
G;
1317 xcolor.blue = 256 * pcolor.
B;
1318 XStoreColor (
display, lut, &xcolor );
1322 xcolor.pixel = 243 ;
1323 xcolor.red = 256 * pcolor.
R;
1324 xcolor.green = 256 * pcolor.
G;
1325 xcolor.blue = 256 * pcolor.
B;
1326 XStoreColor (
display, lut, &xcolor );
1331 xcolor.red = 256 * pcolor.
R;
1332 xcolor.green = 256 * pcolor.
G;
1333 xcolor.blue = 256 * pcolor.
B;
1334 XStoreColor (
display, lut, &xcolor );
1339 xcolor.red = 256 * pcolor.
R;
1340 xcolor.green = 256 * pcolor.
G;
1341 xcolor.blue = 256 * pcolor.
B;
1342 XStoreColor (
display, lut, &xcolor );
1347 xcolor.red = 256 * pcolor.
R;
1348 xcolor.green = 256 * pcolor.
G;
1349 xcolor.blue = 256 * pcolor.
B;
1350 XStoreColor (
display, lut, &xcolor );
1355 xcolor.red = 256 * pcolor.
R;
1356 xcolor.green = 256 * pcolor.
G;
1357 xcolor.blue = 256 * pcolor.
B;
1358 XStoreColor (
display, lut, &xcolor );
1365 xcolor.flags = DoRed | DoGreen | DoBlue ;
1370 xcolor.red = 256 * pcolor.
R;
1371 xcolor.green = 256 * pcolor.
G;
1372 xcolor.blue = 256 * pcolor.
B;
1373 XAllocColor (
display, lut, &xcolor );
1379 xcolor.red = 256 * pcolor.
R;
1380 xcolor.green = 256 * pcolor.
G;
1381 xcolor.blue = 256 * pcolor.
B;
1382 XAllocColor (
display, lut, &xcolor );
1388 xcolor.red = 256 * pcolor.
R;
1389 xcolor.green = 256 * pcolor.
G;
1390 xcolor.blue = 256 * pcolor.
B;
1391 XAllocColor (
display, lut, &xcolor );
1397 xcolor.red = 256 * pcolor.
R;
1398 xcolor.green = 256 * pcolor.
G;
1399 xcolor.blue = 256 * pcolor.
B;
1400 XAllocColor (
display, lut, &xcolor );
1406 xcolor.red = 256 * pcolor.
R;
1407 xcolor.green = 256 * pcolor.
G;
1408 xcolor.blue = 256 * pcolor.
B;
1409 XAllocColor (
display, lut, &xcolor );
1415 xcolor.red = 256 * pcolor.
R;
1416 xcolor.green = 256 * pcolor.
G;
1417 xcolor.blue = 256 * pcolor.
B;
1418 XAllocColor (
display, lut, &xcolor );
1424 xcolor.red = 256 * pcolor.
R;
1425 xcolor.green = 256 * pcolor.
G;
1426 xcolor.blue = 256 * pcolor.
B;
1427 XAllocColor (
display, lut, &xcolor );
1433 xcolor.red = 256 * pcolor.
R;
1434 xcolor.green = 256 * pcolor.
G;
1435 xcolor.blue = 256 * pcolor.
B;
1436 XAllocColor (
display, lut, &xcolor );
1442 xcolor.red = 256 * pcolor.
R;
1443 xcolor.green = 256 * pcolor.
G;
1444 xcolor.blue = 256 * pcolor.
B;
1445 XAllocColor (
display, lut, &xcolor );
1451 xcolor.red = 256 * pcolor.
R;
1452 xcolor.green = 256 * pcolor.
G;
1453 xcolor.blue = 256 * pcolor.
B;
1454 XAllocColor (
display, lut, &xcolor );
1460 xcolor.red = 256 * pcolor.
R;
1461 xcolor.green = 256 * pcolor.
G;
1462 xcolor.blue = 256 * pcolor.
B;
1463 XAllocColor (
display, lut, &xcolor );
1469 xcolor.red = 256 * pcolor.
R;
1470 xcolor.green = 256 * pcolor.
G;
1471 xcolor.blue = 256 * pcolor.
B;
1472 XAllocColor (
display, lut, &xcolor );
1478 xcolor.red = 256 * pcolor.
R;
1479 xcolor.green = 256 * pcolor.
G;
1480 xcolor.blue = 256 * pcolor.
B;
1481 XAllocColor (
display, lut, &xcolor );
1487 xcolor.red = 256 * pcolor.
R;
1488 xcolor.green = 256 * pcolor.
G;
1489 xcolor.blue = 256 * pcolor.
B;
1490 XAllocColor (
display, lut, &xcolor );
1496 xcolor.red = 256 * pcolor.
R;
1497 xcolor.green = 256 * pcolor.
G;
1498 xcolor.blue = 256 * pcolor.
B;
1499 XAllocColor (
display, lut, &xcolor );
1505 xcolor.red = 256 * pcolor.
R;
1506 xcolor.green = 256 * pcolor.
G;
1507 xcolor.blue = 256 * pcolor.
B;
1508 XAllocColor (
display, lut, &xcolor );
1514 xcolor.red = 256 * pcolor.
R;
1515 xcolor.green = 256 * pcolor.
G;
1516 xcolor.blue = 256 * pcolor.
B;
1517 XAllocColor (
display, lut, &xcolor );
1523 xcolor.red = 256 * pcolor.
R;
1524 xcolor.green = 256 * pcolor.
G;
1525 xcolor.blue = 256 * pcolor.
B;
1526 XAllocColor (
display, lut, &xcolor );
1537 ButtonPressMask | ButtonReleaseMask |
1538 KeyPressMask | KeyReleaseMask |
1539 StructureNotifyMask |
1543 values.plane_mask = AllPlanes;
1544 values.fill_style = FillSolid;
1545 values.foreground = WhitePixel (
display, screen );
1546 values.background = BlackPixel (
display, screen );
1548 GCPlaneMask | GCFillStyle | GCForeground | GCBackground,
1551 if ( context == NULL )
1555 "Can't create graphics context" ) ) ;
1567 Ximage = XCreateImage (
display, DefaultVisual (
display, screen ),
1568 screen_depth, ZPixmap, 0, NULL,
1571 Ximage->data = (
char * ) malloc (
height * (
unsigned int)Ximage->bytes_per_line );
1572 ximage_data_init =
true;
1604 stringfont = XLoadFont (
display, font) ;
1605 XSetFont (
display, context, stringfont);
1618 "X not initialized" ) ) ;
1632 title_ = std::string(title);
1634 title_ = std::string(
" ");
1641 "X not initialized" ) ) ;
1662 "X not initialized" ) ) ;
1682 switch ( screen_depth )
1686 unsigned char *src_8 = NULL;
1687 unsigned char *dst_8 = NULL;
1688 src_8 = (
unsigned char * ) I.
bitmap;
1689 dst_8 = (
unsigned char * ) Ximage->data;
1695 unsigned char nivGris;
1700 nivGris = src_8[i] ;
1701 if ( nivGris > nivGrisMax )
1718 unsigned short *dst_16 = (
unsigned short* ) Ximage->data;
1719 unsigned char *dst_8 = NULL;
1720 unsigned int bytes_per_line = (
unsigned int)Ximage->bytes_per_line;
1721 for (
unsigned int i = 0; i <
height ; i++ ) {
1722 dst_8 = (
unsigned char*) Ximage->data + i * bytes_per_line;
1723 dst_16 = (
unsigned short *) dst_8;
1724 for (
unsigned int j=0 ; j <
width; j++ )
1726 * ( dst_16 + j ) = (
unsigned short ) colortable[I[i][j]] ;
1731 XPutImage (
display, pixmap, context, Ximage, 0, 0, 0, 0,
width, height );
1741 unsigned char *dst_32 = NULL;
1743 dst_32 = (
unsigned char* ) Ximage->data;
1744 unsigned char *bitmap = I.
bitmap ;
1745 unsigned char *n = I.
bitmap + size_;
1747 while ( bitmap < n )
1749 unsigned char val = * ( bitmap++ );
1750 * ( dst_32 ++ ) = val;
1751 * ( dst_32 ++ ) = val;
1752 * ( dst_32 ++ ) = val;
1753 * ( dst_32 ++ ) = val;
1757 XPutImage (
display, pixmap, context, Ximage, 0, 0, 0, 0,
width, height );
1769 "X not initialized" ) ) ;
1787 switch ( screen_depth )
1790 unsigned short *dst_16 = NULL;
1791 unsigned char *dst_8 = NULL;
1793 unsigned int r, g, b;
1794 unsigned int bytes_per_line = (
unsigned int)Ximage->bytes_per_line;
1796 for (
unsigned int i = 0; i <
height ; i++ ) {
1797 dst_8 = (
unsigned char*) Ximage->data + i * bytes_per_line;
1798 dst_16 = (
unsigned short *) dst_8;
1799 for (
unsigned int j=0 ; j <
width; j++ )
1804 * ( dst_16 + j ) = (((r << 8) >> RShift) & RMask) |
1805 (((g << 8) >> GShift) & GMask) |
1806 (((b << 8) >> BShift) & BMask);
1811 XPutImage (
display, pixmap, context, Ximage, 0, 0, 0, 0,
width, height );
1822 unsigned char *dst_32 = NULL;
1823 dst_32 = (
unsigned char* ) Ximage->data;
1826 if (XImageByteOrder(
display) == 1) {
1828 for (
unsigned int i = 0; i < sizeI ; i++ ) {
1829 *(dst_32++) = bitmap->A;
1830 *(dst_32++) = bitmap->R;
1831 *(dst_32++) = bitmap->G;
1832 *(dst_32++) = bitmap->B;
1838 for (
unsigned int i = 0; i < sizeI; i++ ) {
1839 *(dst_32++) = bitmap->B;
1840 *(dst_32++) = bitmap->G;
1841 *(dst_32++) = bitmap->R;
1842 *(dst_32++) = bitmap->A;
1855 vpERROR_TRACE (
"Unsupported depth (%d bpp) for color display",
1858 "Unsupported depth for color display" ) ) ;
1865 "X not initialized" ) ) ;
1882 unsigned char *dst_32 = NULL;
1887 dst_32 = (
unsigned char* ) Ximage->data;
1889 for (
unsigned int i = 0; i <
width *
height; i++ )
1891 * ( dst_32 ++ ) = *I;
1892 * ( dst_32 ++ ) = *I;
1893 * ( dst_32 ++ ) = *I;
1894 * ( dst_32 ++ ) = *I;
1899 XPutImage (
display, pixmap, context, Ximage, 0, 0, 0, 0,
width, height );
1908 "X not initialized" ) ) ;
1929 const unsigned int w,
const unsigned int h )
1933 switch ( screen_depth )
1937 unsigned char *src_8 = NULL;
1938 unsigned char *dst_8 = NULL;
1939 src_8 = (
unsigned char * ) I.
bitmap;
1940 dst_8 = (
unsigned char * ) Ximage->data;
1945 unsigned char nivGris;
1949 unsigned int iwidth = I.
getWidth();
1951 src_8 = src_8 + (int)(iP.
get_i()*iwidth+ iP.
get_j());
1960 nivGris = *(src_8+j);
1961 if ( nivGris > nivGrisMax )
1964 *(dst_8+j) = nivGris;
1967 src_8 = src_8 + iwidth;
1968 dst_8 = dst_8 + this->
width;
1982 unsigned short *dst_16 = NULL;
1983 unsigned char *dst_8 = NULL;
1984 unsigned int bytes_per_line = (
unsigned int)Ximage->bytes_per_line;
1985 for (
unsigned int i = (
unsigned int)iP.
get_i(); i < (
unsigned int)(iP.
get_i()+h) ; i++ ) {
1986 dst_8 = (
unsigned char *) Ximage->data + i * bytes_per_line;
1987 dst_16 = (
unsigned short *) dst_8;
1988 for (
unsigned int j=(
unsigned int)iP.
get_j() ; j < (
unsigned int)(iP.
get_j()+w); j++ )
1990 * ( dst_16 + j ) = (
unsigned short ) colortable[I[i][j]] ;
2028 unsigned char *dst_32 = NULL;
2030 dst_32 = (
unsigned char* ) Ximage->data;
2031 unsigned char *src_8 = I.
bitmap ;
2034 unsigned int iwidth = I.
getWidth();
2036 src_8 = src_8 + (int)(iP.
get_i()*iwidth+ iP.
get_j());
2045 unsigned char val = *(src_8+j);
2046 *(dst_32+4*j) = val;
2047 *(dst_32+4*j+1) = val;
2048 *(dst_32+4*j+2) = val;
2049 *(dst_32+4*j+3) = val;
2052 src_8 = src_8 + iwidth;
2053 dst_32 = dst_32 + 4*this->
width;
2070 "X not initialized" ) ) ;
2091 const unsigned int w,
const unsigned int h )
2095 switch ( screen_depth )
2098 unsigned short *dst_16 = NULL;
2099 unsigned char *dst_8 = NULL;
2100 unsigned int r, g, b;
2101 unsigned int bytes_per_line = (
unsigned int)Ximage->bytes_per_line;
2102 for (
unsigned int i = (
unsigned int)iP.
get_i(); i < (
unsigned int)(iP.
get_i()+h) ; i++ ) {
2103 dst_8 = (
unsigned char *) Ximage->data + i * bytes_per_line;
2104 dst_16 = (
unsigned short *) dst_8;
2105 for (
unsigned int j=(
unsigned int)iP.
get_j() ; j < (
unsigned int)(iP.
get_j()+w); j++ )
2110 * ( dst_16 + j ) = (((r << 8) >> RShift) & RMask) |
2111 (((g << 8) >> GShift) & GMask) |
2112 (((b << 8) >> BShift) & BMask);
2128 unsigned char *dst_32 = NULL;
2129 dst_32 = (
unsigned char* ) Ximage->data;
2133 unsigned int iwidth = I.
getWidth();
2135 src_32 = src_32 + (int)(iP.
get_i()*iwidth+ iP.
get_j());
2140 if (XImageByteOrder(
display) == 1) {
2145 *(dst_32+4*j) = (src_32+j)->A;
2146 *(dst_32+4*j+1) = (src_32+j)->R;
2147 *(dst_32+4*j+2) = (src_32+j)->G;
2148 *(dst_32+4*j+3) = (src_32+j)->B;
2152 src_32 = src_32 + iwidth;
2153 dst_32 = dst_32 + 4*this->
width;
2163 *(dst_32+4*j) = (src_32+j)->B;
2164 *(dst_32+4*j+1) = (src_32+j)->G;
2165 *(dst_32+4*j+2) = (src_32+j)->R;
2166 *(dst_32+4*j+3) = (src_32+j)->A;
2170 src_32 = src_32 + iwidth;
2171 dst_32 = dst_32 + 4*this->
width;
2185 vpERROR_TRACE (
"Unsupported depth (%d bpp) for color display",
2188 "Unsupported depth for color display" ) ) ;
2195 "X not initialized" ) ) ;
2210 if ( ximage_data_init ==
true )
2211 free ( Ximage->data );
2213 Ximage->data = NULL;
2214 XDestroyImage ( Ximage );
2216 XFreePixmap (
display, pixmap );
2224 if (x_color != NULL) {
2249 "X not initialized" ) ) ;
2272 "X not initialized" ) ) ;
2290 xcolor.red = 256 * color.
R;
2291 xcolor.green = 256 * color.
G;
2292 xcolor.blue = 256 * color.
B;
2293 XAllocColor (
display, lut, &xcolor );
2294 XSetForeground (
display, context, xcolor.pixel );
2299 XFreePixmap (
display, pixmap );
2307 "X not initialized" ) ) ;
2321 unsigned int w,
unsigned int h,
2322 unsigned int thickness)
2333 if ((std::fabs(a) <= std::numeric_limits<double>::epsilon() )&&(std::fabs(b) <= std::numeric_limits<double>::epsilon()) )
2372 "X not initialized" ) ) ;
2394 XSetForeground (
display, context, x_color[color.
id] );
2397 xcolor.red = 256 * color.
R;
2398 xcolor.green = 256 * color.
G;
2399 xcolor.blue = 256 * color.
B;
2400 XAllocColor (
display, lut, &xcolor );
2401 XSetForeground (
display, context, xcolor.pixel );
2403 XDrawString (
display, pixmap, context,
2405 text, (int)strlen ( text ) );
2411 "X not initialized" ) ) ;
2425 unsigned int radius,
2428 unsigned int thickness )
2432 if ( thickness == 1 ) thickness = 0;
2434 XSetForeground (
display, context, x_color[color.
id] );
2437 xcolor.red = 256 * color.
R;
2438 xcolor.green = 256 * color.
G;
2439 xcolor.blue = 256 * color.
B;
2440 XAllocColor (
display, lut, &xcolor );
2441 XSetForeground (
display, context, xcolor.pixel );
2444 XSetLineAttributes (
display, context, thickness,
2445 LineSolid, CapButt, JoinBevel );
2447 if ( fill ==
false )
2449 XDrawArc (
display, pixmap, context,
2452 radius*2, radius*2, 0, 23040 );
2456 XFillArc (
display, pixmap, context,
2459 radius*2, radius*2, 0, 23040 );
2466 "X not initialized" ) ) ;
2478 unsigned int cross_size,
2480 unsigned int thickness)
2486 double i = ip.
get_i();
2487 double j = ip.
get_j();
2490 ip1.
set_i( i-cross_size/2 );
2492 ip2.
set_i( i+cross_size/2 );
2497 ip1.
set_j( j-cross_size/2 );
2499 ip2.
set_j( j+cross_size/2 );
2514 "X not initialized" ) ) ;
2527 unsigned int thickness )
2532 if ( thickness == 1 ) thickness = 0;
2535 XSetForeground (
display, context, x_color[color.
id] );
2538 xcolor.red = 256 * color.
R;
2539 xcolor.green = 256 * color.
G;
2540 xcolor.blue = 256 * color.
B;
2541 XAllocColor (
display, lut, &xcolor );
2542 XSetForeground (
display, context, xcolor.pixel );
2545 XSetLineAttributes (
display, context, thickness,
2546 LineOnOffDash, CapButt, JoinBevel );
2548 XDrawLine (
display, pixmap, context,
2558 "X not initialized" ) ) ;
2571 unsigned int thickness )
2575 if ( thickness == 1 ) thickness = 0;
2578 XSetForeground (
display, context, x_color[color.
id] );
2581 xcolor.red = 256 * color.
R;
2582 xcolor.green = 256 * color.
G;
2583 xcolor.blue = 256 * color.
B;
2584 XAllocColor (
display, lut, &xcolor );
2585 XSetForeground (
display, context, xcolor.pixel );
2588 XSetLineAttributes (
display, context, thickness,
2589 LineSolid, CapButt, JoinBevel );
2591 XDrawLine (
display, pixmap, context,
2601 "X not initialized" ) ) ;
2616 XSetForeground (
display, context, x_color[color.
id] );
2619 xcolor.red = 256 * color.
R;
2620 xcolor.green = 256 * color.
G;
2621 xcolor.blue = 256 * color.
B;
2622 XAllocColor (
display, lut, &xcolor );
2623 XSetForeground (
display, context, xcolor.pixel );
2626 XDrawPoint (
display, pixmap, context,
2634 "X not initialized" ) ) ;
2653 unsigned int w,
unsigned int h,
2654 const vpColor &color,
bool fill,
2655 unsigned int thickness )
2659 if ( thickness == 1 ) thickness = 0;
2661 XSetForeground (
display, context, x_color[color.
id] );
2664 xcolor.red = 256 * color.
R;
2665 xcolor.green = 256 * color.
G;
2666 xcolor.blue = 256 * color.
B;
2667 XAllocColor (
display, lut, &xcolor );
2668 XSetForeground (
display, context, xcolor.pixel );
2670 XSetLineAttributes (
display, context, thickness,
2671 LineSolid, CapButt, JoinBevel );
2672 if ( fill ==
false )
2674 XDrawRectangle (
display, pixmap, context,
2681 XFillRectangle (
display, pixmap, context,
2691 "X not initialized" ) ) ;
2710 const vpColor &color,
bool fill,
2711 unsigned int thickness )
2715 if ( thickness == 1 ) thickness = 0;
2717 XSetForeground (
display, context, x_color[color.
id] );
2720 xcolor.red = 256 * color.
R;
2721 xcolor.green = 256 * color.
G;
2722 xcolor.blue = 256 * color.
B;
2723 XAllocColor (
display, lut, &xcolor );
2724 XSetForeground (
display, context, xcolor.pixel );
2727 XSetLineAttributes (
display, context, thickness,
2728 LineSolid, CapButt, JoinBevel );
2732 if ( fill ==
false )
2735 XDrawRectangle (
display, pixmap, context,
2738 w > 0 ? w-1 : 1, h > 0 ? h : 1 );
2742 XFillRectangle (
display, pixmap, context,
2752 "X not initialized" ) ) ;
2770 const vpColor &color,
bool fill,
2771 unsigned int thickness )
2775 if ( thickness == 1 ) thickness = 0;
2777 XSetForeground (
display, context, x_color[color.
id] );
2780 xcolor.red = 256 * color.
R;
2781 xcolor.green = 256 * color.
G;
2782 xcolor.blue = 256 * color.
B;
2783 XAllocColor (
display, lut, &xcolor );
2784 XSetForeground (
display, context, xcolor.pixel );
2787 XSetLineAttributes (
display, context, thickness,
2788 LineSolid, CapButt, JoinBevel );
2790 if ( fill ==
false )
2792 XDrawRectangle (
display, pixmap, context,
2800 XFillRectangle (
display, pixmap, context,
2812 "X not initialized" ) ) ;
2839 Window rootwin, childwin ;
2840 int root_x, root_y, win_x, win_y ;
2841 unsigned int modifier ;
2845 XCheckMaskEvent(
display , ButtonPressMask, &event);
2846 XCheckMaskEvent(
display , ButtonReleaseMask, &event);
2847 XMaskEvent (
display, ButtonPressMask ,&event );
2851 ret = XCheckMaskEvent(
display , ButtonPressMask, &event);
2858 &rootwin, &childwin,
2867 "X not initialized" ) ) ;
2895 Window rootwin, childwin ;
2896 int root_x, root_y, win_x, win_y ;
2897 unsigned int modifier ;
2900 XCheckMaskEvent(
display , ButtonPressMask, &event);
2901 XCheckMaskEvent(
display , ButtonReleaseMask, &event);
2902 XMaskEvent (
display, ButtonPressMask ,&event );
2906 ret = XCheckMaskEvent(
display , ButtonPressMask, &event);
2913 &rootwin, &childwin,
2917 ip.
set_u( (
double)event.xbutton.x );
2918 ip.
set_v( (
double)event.xbutton.y );
2925 "X not initialized" ) ) ;
2958 Window rootwin, childwin ;
2959 int root_x, root_y, win_x, win_y ;
2960 unsigned int modifier ;
2964 XCheckMaskEvent(
display , ButtonPressMask, &event);
2965 XCheckMaskEvent(
display , ButtonReleaseMask, &event);
2966 XMaskEvent (
display, ButtonPressMask ,&event );
2970 ret = XCheckMaskEvent(
display , ButtonPressMask, &event);
2977 &rootwin, &childwin,
2981 ip.
set_u( (
double)event.xbutton.x );
2982 ip.
set_v( (
double)event.xbutton.y );
2983 switch ( event.xbutton.button ) {
2994 "X not initialized" ) ) ;
3030 Window rootwin, childwin ;
3031 int root_x, root_y, win_x, win_y ;
3032 unsigned int modifier ;
3036 XCheckMaskEvent(
display , ButtonPressMask, &event);
3037 XCheckMaskEvent(
display , ButtonReleaseMask, &event);
3038 XMaskEvent (
display, ButtonReleaseMask ,&event );
3042 ret = XCheckMaskEvent(
display , ButtonReleaseMask, &event);
3049 &rootwin, &childwin,
3053 ip.
set_u( (
double)event.xbutton.x );
3054 ip.
set_v( (
double)event.xbutton.y );
3055 switch ( event.xbutton.button ) {
3066 "X not initialized" ) ) ;
3087 AllPlanes, ZPixmap ) ;
3099 unsigned char *src_32 = NULL;
3100 src_32 = (
unsigned char* ) xi->data;
3102 if (screen_depth == 16) {
3103 for (
unsigned int i = 0; i < I.
getHeight() ; i++ ) {
3105 for (
unsigned int j = 0; j < I.
getWidth() ; j++ ) {
3107 unsigned long pixel = XGetPixel(xi, (
int)j, (
int)i);
3108 I.
bitmap[ij_].
R = (((pixel & RMask) << RShift) >> 8);
3109 I.
bitmap[ij_].
G = (((pixel & GMask) << GShift) >> 8);
3110 I.
bitmap[ij_].
B = (((pixel & BMask) << BShift) >> 8);
3117 if (XImageByteOrder(
display) == 1) {
3121 I.
bitmap[i].
R = src_32[i*4 + 1] ;
3122 I.
bitmap[i].
G = src_32[i*4 + 2] ;
3123 I.
bitmap[i].
B = src_32[i*4 + 3] ;
3130 I.
bitmap[i].
G = src_32[i*4 + 1] ;
3131 I.
bitmap[i].
R = src_32[i*4 + 2] ;
3132 I.
bitmap[i].
A = src_32[i*4 + 3] ;
3136 XDestroyImage ( xi ) ;
3142 "X not initialized" ) ) ;
3155 if ( ( display_ = XOpenDisplay ( NULL ) ) == NULL )
3158 XDisplayName ( NULL ) );
3160 "Can't connect display on server." ) ) ;
3162 screen_ = DefaultScreen ( display_ );
3163 depth = (
unsigned int)DefaultDepth ( display_, screen_ );
3165 XCloseDisplay ( display_ );
3179 if ( ( display_ = XOpenDisplay ( NULL ) ) == NULL )
3182 XDisplayName ( NULL ) );
3184 "Can't connect display on server." ) ) ;
3186 screen_ = DefaultScreen ( display_ );
3187 w = (
unsigned int)DisplayWidth ( display_, screen_ );
3188 h = (
unsigned int)DisplayHeight ( display_, screen_ );
3190 XCloseDisplay ( display_ );
3221 XMaskEvent (
display, KeyPressMask ,&event );
3225 ret = XCheckMaskEvent(
display , KeyPressMask, &event);
3231 "X not initialized" ) ) ;
3265 XComposeStatus compose_status;
3271 XMaskEvent (
display, KeyPressMask ,&event );
3272 XLookupString ((XKeyEvent *)&event, &buffer, 1,
3273 &keysym, &compose_status);
3275 sprintf(
string,
"%c", buffer);
3279 ret = XCheckMaskEvent(
display , KeyPressMask, &event);
3281 XLookupString ((XKeyEvent *)&event, &buffer, 1,
3282 &keysym, &compose_status);
3283 sprintf(
string,
"%c", buffer);
3290 "X not initialized" ) ) ;
3313 Window rootwin, childwin ;
3314 int root_x, root_y, win_x, win_y ;
3315 unsigned int modifier ;
3317 ret = XCheckMaskEvent(
display , PointerMotionMask, &event);
3323 &rootwin, &childwin,
3327 ip.
set_u( (
double)event.xbutton.x );
3328 ip.
set_v( (
double)event.xbutton.y );
3335 "X not initialized" ) ) ;
3357 Window rootwin, childwin ;
3358 int root_x, root_y, win_x, win_y ;
3359 unsigned int modifier ;
3367 &rootwin, &childwin,
3371 ip.
set_u( (
double)win_x );
3372 ip.
set_v( (
double)win_y );
3379 "X not initialized" ) ) ;
3391 for (i = 31; i >= 0; --i) {
3392 if (u32val & 0x80000000L)
3398 #elif !defined(VISP_BUILD_SHARED_LIBS)
3400 void dummy_vpDisplayX() {};
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)
vpWin32Window window
The window.
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)
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)
set the size of the image without initializing it.
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)
static double distance(const vpImagePoint &iP1, const vpImagePoint &iP2)
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)