44 #include <sys/errno.h>
48 #include "circle.bitmap"
49 #include "circle_mask.bitmap"
51 static Boolean init_separate_color_rw(), init_color_rw(),
52 init_separate_color_ro(), init_color_ro(), init_mono_rw(), init_mono_ro();
53 static CONST_DECL char *visual_class_to_string();
102 source = XCreateBitmapFromData(
dpy, window, circle_bits,
103 circle_width, circle_height);
105 mask = XCreateBitmapFromData(
dpy, window, circle_mask_bits,
106 circle_width, circle_height);
108 color_1.pixel = WhitePixel (
dpy,
screen);
109 color_1.red = 0xffff;
110 color_1.green = 0xffff;
111 color_1.blue = 0xffff;
112 color_1.flags = DoRed | DoGreen | DoBlue;
114 color_1.pixel = BlackPixel (
dpy,
screen);
118 color_2.flags = DoRed | DoGreen | DoBlue;
122 circle_x_hot, circle_y_hot);
123 XFreePixmap (
dpy, source);
124 XFreePixmap (
dpy, mask);
136 image_information *img;
156 image->bytes_per_line * image->height,
160 if ( errno == ENOSPC )
164 "getx11: No more shared memory segments\n" );
168 perror(
"getx11: shared memory allocation failed" );
169 XDestroyImage( image );
178 if ( image->data == NULL) {
179 perror (
"getx11: attach shared image->data" );
180 XDestroyImage (image);
181 shmctl( img
->shm_img.shmid, IPC_RMID, 0 );
193 fprintf( stderr,
"getx11: XShmAttach failed.\n" );
194 XDestroyImage (image);
196 shmctl( img
->shm_img.shmid, IPC_RMID, 0 );
214 shmctl( shmid, IPC_RMID, 0 );
222 0, NULL, width, height, 32, 0);
225 image->data = (
char *)malloc ( image->bytes_per_line * height );
226 if ( image->data == NULL) {
227 perror (
"malloc image->data" );
228 XDestroyImage (image);
239 image_information *img;
246 XDestroyImage (image);
248 shmctl( img
->shm_img.shmid, IPC_RMID, 0 );
253 XDestroyImage( image );
258 static int handle_x_errors( dpy, event)
262 XID xid = event->resourceid;
265 switch ( event->error_code ) {
269 DPRINTF(stderr,
"img->pixmap allocation failed\n");
274 DPRINTF(stderr,
"img->icn_pixmap allocation failed\n");
278 _XDefaultError (dpy, event);
284 _XDefaultError( dpy, event );
287 _XDefaultError( dpy, event );
294 image_information *img;
297 XSetErrorHandler( handle_x_errors );
302 image_information *img;
309 ( reallocate || (img
->image->width < iw || img
->image->height < ih))) {
320 perror(
"problem getting XImage");
326 image_information *img;
334 if (( img
->pixmap != NULL && reallocate ) ||
349 XShmSegmentInfo shminfo;
359 image->bytes_per_line * image->height,
361 XDestroyImage( image );
364 if ( errno == ENOSPC )
368 "getx11: No more shared memory segments\n" );
372 perror(
"getx11: shared memory allocation failed" );
380 perror (
"getx11: attach shared pixmap" );
381 shmctl( img
->shm_pix.shmid, IPC_RMID, 0 );
392 fprintf( stderr,
"getx11: XShmAttach failed.\n" );
394 shmctl( img
->shm_pix.shmid, IPC_RMID, 0 );
422 shmctl( img
->shm_pix.shmid, IPC_RMID, 0 );
430 image_information *img;
433 XFreePixmap(
dpy, pix );
439 shmctl( img
->shm_pix.shmid, IPC_RMID, 0 );
448 image_information *img;
452 int src_x, src_y, dest_x, dest_y;
453 unsigned int width, height;
457 XShmPutImage(
dpy, d, gc, image, src_x, src_y, dest_x, dest_y,
458 width, height, False );
461 XPutImage(
dpy, d, gc, image, src_x, src_y, dest_x, dest_y,
468 int image_width, image_height;
469 int *icon_width, *icon_height, *icon_factor;
471 XIconSize *icon_sizes;
473 int width, height, factor;
482 #define DESIRED_ICON_WIDTH 48
483 #define DESIRED_ICON_HEIGHT 48
488 if (XGetIconSizes (
dpy,
root_window, &icon_sizes, &icon_size_count)
489 && icon_size_count >= 1) {
491 for (i = 0; i < icon_size_count; i++) {
500 if (i >= icon_size_count) {
501 width = icon_sizes[0].max_width;
502 height = icon_sizes[0].max_height;
507 factor = image_width / width;
508 if (factor < image_height / height)
509 factor = image_height / height;
513 *icon_width = 1 + (image_width / factor);
514 *icon_height = 1 + (image_height / factor);
515 *icon_factor = factor;
520 image_information *img;
525 fprintf(stderr,
"getx11: Could not create color map for visual\n");
527 VPRINTF(stderr,
"created colormap for visual type %s\n",
538 char *dotp = strrchr( display_name,
'.' );
539 char *colonp = strrchr( display_name,
':' );
542 if ( dotp && colonp && dotp > colonp && dotp[1] !=
'\0' )
546 if (display_name == NULL || *display_name ==
'\0')
547 display_name = getenv(
"DISPLAY");
549 dpy = XOpenDisplay(display_name);
552 fprintf(stderr,
"%s: Cant open display %s\n",
progname,
553 (display_name == NULL) ?
"" : display_name);
561 int sh_major, sh_minor;
564 sh_status = XShmQueryVersion(
dpy, &sh_major, &sh_minor, &sh_pixmaps );
569 if (strcmp(
"X11/NeWS - Sun Microsystems Inc.", ServerVendor(
dpy)) == 0 &&
570 VendorRelease(
dpy) == 2000)
576 image_information *img;
589 register image_information *img;
591 static char prog_name[] =
"getx11";
592 static char class_name[] =
"Getx11";
593 static XClassHint class_hint = {prog_name, class_name};
594 char default_geometry[30];
595 int width, height, x, y;
596 XSizeHints size_hints;
598 unsigned long gc_mask = 0;
601 XSetWindowAttributes xswa;
602 unsigned long xswa_mask;
604 int icn_alloc = False;
617 sprintf( default_geometry,
"=%dx%d", img
->w, img
->h );
619 mask = XGeometry(
dpy,
screen, window_geometry, default_geometry,
621 &x, &y, &width, &height );
623 size_hints.flags = 0;
625 if ( mask & (XValue | YValue) ) {
626 size_hints.flags |= USPosition;
630 size_hints.flags |= PPosition;
631 size_hints.x = x = (DisplayWidth(
dpy,
screen) - width)/2;
632 size_hints.y = y = (DisplayHeight(
dpy,
screen) - height)/2;
635 if ( mask & (WidthValue | HeightValue) ) {
636 size_hints.flags |= USSize;
637 size_hints.width = width;
638 size_hints.height = height;
641 VPRINTF (stderr,
"window at (%d, %d) %dx%d\n",
642 x, y, width, height);
644 xswa_mask = CWBackPixel | CWEventMask | CWBorderPixel;
645 xswa.background_pixel = BlackPixel (
dpy,
screen);
646 xswa.border_pixel = WhitePixel (
dpy,
screen);
647 xswa.event_mask = ButtonPressMask | ExposureMask | KeyPressMask |
652 xswa_mask |= CWColormap;
677 xswa_mask = CWBackPixel | CWBorderPixel;
678 xswa.background_pixel = BlackPixel (
dpy,
screen);
679 xswa.border_pixel = WhitePixel (
dpy,
screen);
683 xswa_mask |= CWColormap;
692 size_hints.flags = PMinSize | PMaxSize;
693 size_hints.min_width = img
->icn_w;
694 size_hints.max_width = img
->icn_w;
695 size_hints.min_height = img
->icn_h;
696 size_hints.max_height = img
->icn_h;
705 gc_values.function = GXcopy; gc_mask |= GCFunction;
706 gc_values.plane_mask = AllPlanes; gc_mask |= GCPlaneMask;
708 gc_values.foreground = img
->white_pixel; gc_mask |= GCForeground;
709 gc_values.background = img
->black_pixel; gc_mask |= GCBackground;
711 gc_values.graphics_exposures = False; gc_mask |= GCGraphicsExposures;
725 if ( new_pixmaps || icn_alloc )
731 wm_hints.flags = ( StateHint | IconPixmapHint | IconMaskHint |
732 IconWindowHint | InputHint );
733 wm_hints.initial_state = NormalState;
737 wm_hints.input = True;
757 get_most_contrasting( img, lightest, darkest )
758 register image_information *img;
759 unsigned long *lightest, *darkest;
761 register int c, l, d;
764 XColor *cells = (XColor *)malloc( n *
sizeof(XColor) );
766 for ( c = 0; c < n; c++ )
772 di = li = cells[0].red + cells[0].green + cells[0].blue;
773 for ( c = 0; c < n; c++ )
775 i = cells[c].red + cells[c].green + cells[c].blue;
787 *lightest = cells[l].pixel;
788 *darkest = cells[d].pixel;
793 static void set_white_black_pixel( img )
794 image_information *img;
796 static cmap_info cmap_i;
840 #define WANT_READ_WRITE 4
843 #define WANT_READ_ONLY 0
846 register image_information *img;
849 Boolean done = False, try_ro = True;
852 DPRINTF (stderr,
"Cmap type: binary %d, mono %d, read/write %d\n",
865 init_separate_color_rw( img ) :
866 init_color_rw( img ));
867 if ( !done && !try_ro) {
869 "%s: not enough cmap entries available, trying b/w.\n",
878 init_separate_color_ro( img, try_ro ) :
879 init_color_ro( img, try_ro ));
880 if ( !done && !try_ro ) {
882 "%s: not enough cmap entries available, trying b/w.\n",
891 init_separate_color_rw( img ) : init_mono_rw( img ));
897 init_separate_color_ro( img, try_ro ) :
898 init_mono_ro( img, try_ro ));
913 fprintf (stderr,
"Unknown type in init_colors: %d\n", type);
927 int n = (
int)(0.5 + 255.0 / (2 * (img
->lvls - 1)));
929 register int *divN = img
->divN;
931 for ( i = 0, j = n; j <= 255; i++, j++ )
933 for ( ; i < 255; i++ )
937 VPRINTF (stderr,
"Created color map with %d entries", img
->lvls);
943 set_white_black_pixel( img );
950 init_separate_color_rw ( img )
951 image_information *img;
954 int log2_num_lvls, num_lvls, total_levels;
972 num_lvls = 1 << log2_num_lvls;
973 total_levels = 1 << (log2_num_lvls * 3);
976 map = (
int *) malloc (num_lvls *
sizeof (
int) );
977 if (map == NULL)
continue;
980 if (color_defs == NULL) {
981 color_defs = (XColor *) malloc ( num_lvls *
sizeof (XColor) );
982 if (color_defs == NULL)
987 log2_num_lvls, log2_num_lvls,
1009 for (i = 0; i < num_lvls; i++)
1013 color_defs[i].red = map[i] << 8;
1014 color_defs[i].green = map[i] << 8;
1015 color_defs[i].blue = map[i] << 8;
1017 color_defs[i].flags = DoRed | DoGreen | DoBlue;
1022 if (img
->lvls != num_lvls) {
1030 int shift = 8 - log2_num_lvls;
1033 for ( i = 0; i < img
->cmlen; i++ )
1056 init_color_rw ( img )
1057 image_information *img;
1061 XColor *color_defs, *color;
1067 int free_pixels = 0, shift, cmap_size;
1070 DPRINTF(stderr,
"In init_color_rw\n");
1076 pixels = (
Pixel *) malloc (cmap_size *
sizeof (
Pixel) );
1077 color_defs = (XColor *) malloc (cmap_size *
sizeof (XColor) );
1078 if ( pixels && color_defs )
1080 DPRINTF(stderr,
"Allocating colors: success/failure ");
1083 &pixels[free_pixels],
1087 free_pixels += (
unsigned int)1 << shift;
1090 DPRINTF(stderr,
" got %d\n", free_pixels);
1095 for (num_lvls = img
->lvls;
1099 total_levels = num_lvls * num_lvls * num_lvls;
1100 if ( total_levels <= free_pixels )
1106 if (img
->lvls > num_lvls) {
1114 if ( num_lvls == 256 )
1120 map = (
int *) malloc (num_lvls *
sizeof (
int) );
1132 shift = free_pixels - total_levels;
1134 for (j = 0, i = shift; j < total_levels; i++, j++)
1137 for (i = 0; i < shift; i++)
1138 color_defs[i].pixel = pixels[i];
1141 color_defs, shift );
1147 color = &color_defs[shift];
1153 for (i = 0; i < total_levels; i++) {
1155 color->red = map[red_index] << 8;
1156 color->green = map[green_index] << 8;
1157 color->blue = map[blue_index] << 8;
1159 color->flags = DoRed | DoGreen | DoBlue;
1162 if (++red_index >= num_lvls) {
1163 if (++green_index >= num_lvls) {
1182 init_separate_color_ro ( img, try_ro )
1183 image_information *img;
1187 register int num_lvls;
1188 register int log2_num_lvls;
1189 register int *map = NULL;
1193 DPRINTF(stderr,
"In init_separate_color_ro\n");
1199 num_lvls = 1 << log2_num_lvls;
1202 map = (
int *) malloc (num_lvls *
sizeof (
int) );
1203 if (map == NULL)
continue;
1208 DPRINTF (stderr,
"num_lvls = %d\n", num_lvls);
1224 if (img
->lvls > num_lvls) {
1232 int shift = 8 - log2_num_lvls;
1235 for ( i = 0; i < img
->cmlen; i++ )
1253 static int pixcompare(pixel1, pixel2 )
1254 Pixel *pixel1, *pixel2;
1256 return( *pixel1 - *pixel2 );
1260 image_information *img;
1269 qsort(pixels, npixels,
sizeof(
Pixel), pixcompare);
1272 for (i=1; i<npixels; i++ ) {
1273 if ( pixels[i] != *p ) {
1279 nunique = (p - pixels) + 1;
1281 DPRINTF(stderr,
"In free_unique_pixels \n\nPixels: ");
1282 for (i=0;i<nunique;i++)
DPRINTF(stderr,
" %d ",pixels[i]);
1293 init_color_ro ( img, try_ro )
1294 image_information *img;
1297 register int num_lvls;
1298 register int total_levels;
1299 #ifdef XLIBINT_H_NOT_AVAILABLE
1302 register XColor *color_defs = NULL;
1303 register Status *status = NULL;
1305 register int red_index;
1306 register int green_index;
1307 register int blue_index;
1308 register int *map = NULL;
1310 #ifndef XLIBINT_H_NOT_AVAILABLE
1315 DPRINTF(stderr,
"In init_color_ro\n");
1317 for (num_lvls = img
->lvls; num_lvls >= 2; num_lvls -- ) {
1322 total_levels = num_lvls * num_lvls * num_lvls;
1329 if ( map == NULL ) {
1330 map = (
int *) malloc (num_lvls *
sizeof (
int) );
1331 if (map == NULL)
continue;
1341 red_index = green_index = blue_index = 0;
1343 #ifdef XLIBINT_H_NOT_AVAILABLE
1344 for ( i = 0; i < total_levels; i++ ) {
1345 color_def.red = map[red_index] << 8;
1346 color_def.green = map[green_index] << 8;
1347 color_def.blue = map[blue_index] << 8;
1349 if ( XAllocColor (dpy, img->colormap, &color_def ) == 0 ) {
1353 if (++red_index >= num_lvls) {
1354 if (++green_index >= num_lvls) {
1355 ++blue_index; green_index = 0;
1360 img->pixel_table[i] = color_def.pixel;
1364 if ( i < total_levels ) {
1365 free_unique_colors (img, img->pixel_table, i );
1370 color_defs = (XColor *) malloc(total_levels *
sizeof (XColor));
1372 status = (Status *) malloc(total_levels *
sizeof (Status));
1373 if ( !status || !color_defs )
continue;
1375 for ( i = 0; i < total_levels; i++ ) {
1376 color_defs[i].red = map[red_index] << 8;
1377 color_defs[i].green = map[green_index] << 8;
1378 color_defs[i].blue = map[blue_index] << 8;
1379 if (++red_index >= num_lvls) {
1380 if (++green_index >= num_lvls) {
1381 ++blue_index; green_index = 0;
1389 for ( i = 0, j = 0; i < total_levels; i++ )
1395 for ( i = 0; i < total_levels; i++ )
1405 if (map) free (map);
1406 #ifndef XLIBINT_H_NOT_AVAILABLE
1407 if (color_defs) free (color_defs);
1408 if (status) free (status);
1412 if (map) free (map);
1413 #ifndef XLIBINT_H_NOT_AVAILABLE
1414 if (color_defs) free (color_defs);
1415 if (status) free (status);
1422 init_mono_rw ( img )
1423 image_information *img;
1427 XColor *color_defs, *color;
1429 int free_pixels = 0, shift, cmap_size;
1432 DPRINTF(stderr,
"In init_mono_rw\n");
1438 pixels = (
Pixel *) malloc (cmap_size *
sizeof (
Pixel) );
1439 color_defs = (XColor *) malloc (cmap_size *
sizeof (XColor) );
1440 if ( pixels && color_defs ) {
1441 DPRINTF(stderr,
"Allocating colors: success/failure ");
1444 &pixels[free_pixels],
1448 free_pixels += (
unsigned int)1 << shift;
1451 DPRINTF(stderr,
" got %d\n", free_pixels);
1456 if ( img
->cmlen > free_pixels )
1457 fprintf(stderr,
"%s: Warning: Not enough cells for input cmap\n",
1461 if ( free_pixels == 0 )
return False;
1464 while ( num_lvls > free_pixels && num_lvls >= 2 )
1465 num_lvls = ((num_lvls > 16) ? num_lvls / 2 : num_lvls - 1);
1479 map = (
int *) malloc ( num_lvls *
sizeof(
int) );
1482 fprintf(stderr,
"malloc problems in init_mono_rw\n");
1496 shift = free_pixels - num_lvls;
1498 for (j = 0, i = shift; j < num_lvls; i++, j++)
1501 for (i = 0; i < shift; i++)
1502 color_defs[i].pixel = pixels[i];
1504 XQueryColors(
dpy, DefaultColormap(
dpy,
screen), color_defs, shift );
1510 color = &color_defs[shift];
1513 for ( i = 0; i < num_lvls; i++ ) {
1518 color->flags = DoRed | DoGreen | DoBlue;
1522 for ( i = 0; i < num_lvls; i++ ) {
1524 color->red = map[i] << 8;
1525 color->green = map[i] << 8;
1526 color->blue = map[i] << 8;
1527 color->flags = DoRed | DoGreen | DoBlue;
1541 init_mono_ro ( img, try_ro )
1542 image_information *img;
1545 register int num_lvls;
1546 #ifdef XLIBINT_H_NOT_AVAILABLE
1549 register XColor *color_defs = NULL;
1550 register Status *status = NULL;
1552 register int * map = NULL;
1554 #ifndef XLIBINT_H_NOT_AVAILABLE
1559 DPRINTF(stderr,
"In init_mono_ro");
1561 DPRINTF(stderr,
" trying read/only\n");
1569 for (num_lvls = img
->lvls; num_lvls >= 2;
1570 num_lvls = (num_lvls > 16) ? num_lvls / 2 : num_lvls - 1 ) {
1582 map = (
int *) malloc (num_lvls *
sizeof (
int) );
1583 if (map == NULL)
continue;
1595 #ifdef XLIBINT_H_NOT_AVAILABLE
1596 for ( i = 0; i < num_lvls; i++ ) {
1597 if ( img->mono_color ) {
1598 color_def.red = img->in_cmap[RLE_RED][i] << 8;
1599 color_def.green = img->in_cmap[RLE_GREEN][i] << 8;
1600 color_def.blue = img->in_cmap[RLE_BLUE][i] << 8;
1602 color_def.red = map[i] << 8;
1603 color_def.green = map[i] << 8;
1604 color_def.blue = map[i] << 8;
1607 if ( XAllocColor (dpy, img->colormap, &color_def ) == 0 ){
1610 img->pixel_table[i] = color_def.pixel;
1615 if ( i < num_lvls) {
1618 free_unique_colors (img, img->pixel_table, i );
1623 color_defs = (XColor *) malloc(num_lvls *
sizeof (XColor));
1625 status = (Status *) malloc(num_lvls *
sizeof (Status));
1626 if ( !status || !color_defs )
continue;
1628 for ( i = 0; i < num_lvls; i++ ) {
1629 color_defs[i].pixel = 0;
1635 color_defs[i].red = map[i] << 8;
1636 color_defs[i].green = map[i] << 8;
1637 color_defs[i].blue = map[i] << 8;
1643 for ( i = 0, j = 0; i < num_lvls; i++ )
1649 for ( i = 0; i < num_lvls; i++ )
1660 #ifndef XLIBINT_H_NOT_AVAILABLE
1661 if (status) free (status);
1662 if (color_defs) free (color_defs);
1671 if (map) free (map);
1672 #ifndef XLIBINT_H_NOT_AVAILABLE
1673 if (status) free (status);
1674 if (color_defs) free (color_defs);
1680 image_information *img;
1691 switch (visual_type) {
1692 case DirectColor: type_string =
"DirectColor";
break;
1693 case PseudoColor: type_string =
"PseudoColor";
break;
1694 case TrueColor: type_string =
"TrueColor";
break;
1695 case StaticColor: type_string =
"StaticColor";
break;
1696 case GrayScale: type_string =
"GrayScale";
break;
1697 case StaticGray: type_string =
"StaticGray";
break;
1698 default: type_string =
"any/unknown";
break;
1703 #define BINARY_TABLE_INDEX 0
1704 #define MONOCHROME_TABLE_INDEX 1
1705 #define COLOR_TABLE_INDEX 2
1715 { PseudoColor, StaticGray, GrayScale, DirectColor, TrueColor, StaticColor},
1716 { PseudoColor, GrayScale, StaticGray, DirectColor, TrueColor, StaticColor},
1717 { PseudoColor, DirectColor, TrueColor, StaticColor, GrayScale, StaticGray}
1722 register image_information *img;
1724 static int num_visuals = 0;
1725 static XVisualInfo *visual_info = NULL;
1726 register XVisualInfo *vi, *found_vi;
1727 XVisualInfo *XGetVisualInfo ();
1728 VisualID def_visual_id;
1729 int def_visual_index = 0;
1730 int def_scrn = DefaultScreen(
dpy);
1739 if (visual_info == NULL) {
1740 visual_info = XGetVisualInfo (
dpy, VisualNoMask, NULL, &num_visuals);
1741 if (visual_info == NULL || num_visuals == 0) {
1742 fprintf (stderr,
"XGetVisualInfo failed\n");
1749 for (i = 2; i < img
->lvls; i <<= 1) {
1771 VPRINTF (stderr,
"Searching for %s visual with desired depth >= %d\n",
1791 def_visual_id = DefaultVisual(
dpy, def_scrn)->visualid ;
1794 for (i = 0; i < num_visuals; i++)
1796 if ( deepest_visual < visual_info[i].depth )
1797 deepest_visual = visual_info[i].depth;
1799 if ( def_visual_id == visual_info[i].visualid &&
1800 def_scrn == visual_info[i].screen )
1801 def_visual_index = i;
1805 if ( visual_info[def_visual_index].depth >= desired_depth ||
1806 visual_info[def_visual_index].depth == deepest_visual )
1807 found_vi = &visual_info[def_visual_index];
1812 for (depth = desired_depth; depth >= 1; depth -= depth_delta) {
1813 for (vi = visual_info; vi < visual_info + num_visuals; vi++)
1819 if (found_vi->depth == depth)
break;
1829 for (depth = desired_depth; depth >= 0; depth -= depth_delta) {
1830 if (found_vi != NULL)
1832 for (i = 0; i < 6; i++) {
1838 for (vi = visual_info; vi < visual_info+num_visuals; vi++)
1839 if (vi->class == vt && vi->depth >= depth) {
1840 if (found_vi==NULL || found_vi->depth > vi->depth)
1842 if (vi->depth == depth)
1849 if (found_vi == NULL) {
1850 fprintf (stderr,
"%s: Could not find appropriate visual type - %s\n",
1859 for (vi = visual_info; vi < visual_info+num_visuals; vi++)
1860 if (vi->class == found_vi->class &&
1861 vi->depth == found_vi->depth &&
1862 vi->screen == def_scrn )
1869 screen = found_vi->screen;
1878 if ( found_vi->visualid == def_visual_id )
1898 if ( class == GrayScale || class == StaticGray ) {
1905 img
->rw_cmap = class == PseudoColor || class == GrayScale ||
1906 class == DirectColor;
1908 if ( class == DirectColor || class == TrueColor ||
1909 (class == StaticColor &&
1911 (found_vi->visual->red_mask != 0 ||
1912 found_vi->visual->blue_mask != 0 ||
1913 found_vi->visual->green_mask != 0))) {
1935 if (depth_delta == 1) {
1936 i = found_vi->colormap_size;
1939 for (i = 1; i * i * i < found_vi->colormap_size; i++) {}
1953 VPRINTF(stderr,
"Visual type %s, depth %d, screen %d\n",
1963 image_information *img;
1968 unsigned int w, h, hunoz, huwanz, font_height;
1970 XGetGeometry (
dpy, img
->window, &hukairz, &x, &y, &w, &h, &hunoz, &huwanz);
1975 fprintf (stderr,
"%s: unable to load font '%s'\n",
1982 y = (use_top ? 0 : (h - font_height));
1998 image_information *img;
2002 unsigned char *r, *g, *b;
2013 sprintf (str,
"(%4d,%4d): %3d -> 0x%02x%02x%02x ( %3d, %3d, %3d ) (Mag %2d)",
2017 sprintf (str,
"(%4d,%4d): %3d -> 0x%02x%02x%02x ( %3d, %3d, %3d )",
2019 *r, R, G, B, R, G, B);
2022 sprintf (str,
"(%4d,%4d): ( %3d ) (Mag %2d)",
2026 sprintf (str,
"(%4d,%4d): ( %3d )",
2027 x + img
->x, img
->h - y - 1 + img
->y, *r);
2033 sprintf (str,
"(%4d,%4d): ( %3d, %3d ) (Mag %2d)",
2037 sprintf (str,
"(%4d,%4d): ( %3d, %3d )",
2046 "(%4d,%4d): 0x%02x%02x%02x ( %3d, %3d, %3d ) (Mag %2d)",
2050 sprintf (str,
"(%4d,%4d): 0x%02x%02x%02x ( %3d, %3d, %3d )",
2052 *r, *g, *b, *r, *g, *b);
2063 image_information *img;
2069 sprintf( str,
"%s%d Frames/Second", (s > 0) ?
"":
"1/", (s>0)?s:-s );
2071 sprintf( str,
"As fast as possible" );
2081 image_information *img;
Boolean use_shared_pixmaps
void allocate_pixmap(image_information *img, Boolean reallocate)
void MapPixWindow(image_information *img, int use_top)
void get_dither_arrays(register image_information *img)
void free_X_pixmap(image_information *img, Pixmap pix)
static image_information * wait_img
void make_square(double N, divN, modN, magic)
void UnmapPixWindow(image_information *img)
void check_pixmap_allocation(image_information *img)
void get_cursors(Window window)
void open_x_display(char *display_name)
static Cursor circle_cursor
void calc_view_origin(image_information *img)
#define DESIRED_ICON_HEIGHT
void init_color(register image_information *img)
void find_appropriate_visual(register image_information *img)
void get_x_colormap(image_information *img)
static int specified_screen
static Cursor watch_cursor
int shift_match_right(Pixel mask)
void create_windows(register image_information *img, char *window_geometry)
int shift_match_left(Pixel mask, int high_bit_index)
static int desired_class_table[][6]
#define SAVED_RLE_ROW(img, y)
void destroy_X_image(image_information *img, XImage *image)
static Cursor left_ptr_cursor
void set_circle_cursor(Window window)
#define IMAGE_BORDERWIDTH
void set_watch_cursor(Window window)
void determine_icon_size(int image_width, int image_height, int *icon_width, int *icon_height, int *icon_factor)
void free_unique_colors(image_information *img, Pixel *pixels, int npixels)
#define MONOCHROME_TABLE_INDEX
#define BINARY_TABLE_INDEX
int XAllocColors(register Display *dpy, Colormap cmap, XColor *defs, int ndefs, int *statuses)
static XFontStruct * pixel_font_info
#define COLOR_TABLE_INDEX
#define SHIFT_MASK_PIXEL(r, g, b)
void DrawSpeedWindow(image_information *img, int s)
#define DESIRED_ICON_WIDTH
void put_X_image(image_information *img, Drawable d, GC gc, XImage *image, int src_x, int src_y, int dest_x, int dest_y, unsigned int width, unsigned int height)
int allocate_ximage(image_information *img, Boolean reallocate)
void DrawPixWindow(image_information *img, int x, int y)
void free_image_colors(image_information *img)
XImage * get_X_image(image_information *img, int width, int height, Boolean share)
void bwdithermap(int levels, double gamma, bwmap, divN, modN, magic)
void set_left_ptr_cursor(Window window)