Back to index

scribus-ng  1.3.4.dfsg+svn20071115
Classes | Typedefs | Enumerations | Functions
gdk-pixbuf-xlibrgb.h File Reference
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <X11/Intrinsic.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _XlibRgbCmap

Typedefs

typedef struct _XlibRgbCmap

Enumerations

enum  XlibRgbDither { XLIB_RGB_DITHER_NONE, XLIB_RGB_DITHER_NORMAL, XLIB_RGB_DITHER_MAX }

Functions

void xlib_rgb_init (Display *display, Screen *screen)
 xlib_rgb_init: : X Display to use.
void xlib_rgb_init_with_depth (Display *display, Screen *screen, int prefDepth)
 xlib_rgb_init_with_depth: : X display to use.
unsigned long xlib_rgb_xpixel_from_rgb (unsigned int rgb)
 xlib_rgb_xpixel_from_rgb: : 32-bit representation of an RGB value, specified as 0x00RRGGBB.
void xlib_rgb_gc_set_foreground (GC gc, unsigned int rgb)
 xlib_rgb_gc_set_foreground: : A graphic context.
void xlib_rgb_gc_set_background (GC gc, unsigned int rgb)
 xlib_rgb_gc_set_background: : A graphic context.
void xlib_draw_rgb_image (Drawable drawable, GC gc, int x, int y, int width, int height, XlibRgbDither dith, unsigned char *rgb_buf, int rowstride)
 xlib_draw_rgb_image: : Destination drawable.
void xlib_draw_rgb_image_dithalign (Drawable drawable, GC gc, int x, int y, int width, int height, XlibRgbDither dith, unsigned char *rgb_buf, int rowstride, int xdith, int ydith)
 xlib_draw_rgb_image_dithalign: : Destination drawable.
void xlib_draw_rgb_32_image (Drawable drawable, GC gc, int x, int y, int width, int height, XlibRgbDither dith, unsigned char *buf, int rowstride)
 xlib_draw_rgb_32_image: : Destination drawable.
void xlib_draw_gray_image (Drawable drawable, GC gc, int x, int y, int width, int height, XlibRgbDither dith, unsigned char *buf, int rowstride)
 xlib_draw_gray_image: : Destination drawable.
XlibRgbCmap * xlib_rgb_cmap_new (unsigned int *colors, int n_colors)
 xlib_rgb_cmap_new: : FIXME : FIXME
void xlib_rgb_cmap_free (XlibRgbCmap *cmap)
 xlib_rgb_cmap_free: : An XlibRGB colormap.
void xlib_draw_indexed_image (Drawable drawable, GC gc, int x, int y, int width, int height, XlibRgbDither dith, unsigned char *buf, int rowstride, XlibRgbCmap *cmap)
 xlib_draw_indexed_image: : FIXME : FIXME : FIXME : FIXME : FIXME : FIXME : FIXME : FIXME : FIXME : FIXME
Bool xlib_rgb_ditherable (void)
 xlib_rgb_ditherable:
void xlib_rgb_set_verbose (Bool verbose)
 xlib_rgb_set_verbose: : True to be verbose
void xlib_rgb_set_install (Bool install)
 xlib_rgb_set_install: : True to install a colormap
void xlib_rgb_set_min_colors (int min_colors)
 xlib_rgb_set_min_colors: : minimum colors to use
Colormap xlib_rgb_get_cmap (void)
 xlib_rgb_get_cmap:
Visual * xlib_rgb_get_visual (void)
 xlib_rgb_get_visual:
XVisualInfo * xlib_rgb_get_visual_info (void)
 xlib_rgb_get_visual_info:
int xlib_rgb_get_depth (void)
 xlib_rgb_get_depth:
Display * xlib_rgb_get_display (void)
 xlib_rgb_get_display:
Screen * xlib_rgb_get_screen (void)
 xlib_rgb_get_screen:

Class Documentation

struct _XlibRgbCmap

Definition at line 72 of file gdk-pixbuf-xlibrgb.h.

Class Members
unsigned int colors
unsigned char lut

Typedef Documentation

typedef struct _XlibRgbCmap

Definition at line 70 of file gdk-pixbuf-xlibrgb.h.


Enumeration Type Documentation

Enumerator:
XLIB_RGB_DITHER_NONE 
XLIB_RGB_DITHER_NORMAL 
XLIB_RGB_DITHER_MAX 

Definition at line 91 of file gdk-pixbuf-xlibrgb.h.


Function Documentation

void xlib_draw_gray_image ( Drawable  drawable,
GC  gc,
int  x,
int  y,
int  width,
int  height,
XlibRgbDither  dith,
unsigned char *  buf,
int  rowstride 
)

xlib_draw_gray_image: : Destination drawable.

: A graphic context. : Leftmost coordinate of the destination rectangle. : Upper coordinate of the destination rectangle. : Width of the destination rectangle, in pixels. : Height of thd destination rectangle, in pixels. : Dithering method to use. : Pointer to the pixel in the grayscale buffer that corresponds to the upper-left corner of the rectangular region to render. : Offset between pixel rows in the grayscale buffer, in pixels.

Renders a grayscale buffer to a drawable. Pixels are specified as 8-bit intensity values. An image will thus look as a GGGGGG sequence of 8-bit values.

Definition at line 3493 of file gdk-pixbuf-xlibrgb.c.

{
  if (image_info->bpp == 1 &&
      image_info->gray_cmap == NULL &&
      (image_info->x_visual_info->class == PseudoColor ||
       image_info->x_visual_info->class == GrayScale))
    xlib_rgb_make_gray_cmap (image_info);
  
  if (dith == XLIB_RGB_DITHER_NONE || (dith == XLIB_RGB_DITHER_NORMAL &&
                                  !image_info->dith_default))
    xlib_draw_rgb_image_core (drawable, gc, x, y, width, height,
                           buf, 1, rowstride,
                           image_info->conv_gray, NULL, 0, 0);
  else
    xlib_draw_rgb_image_core (drawable, gc, x, y, width, height,
                           buf, 1, rowstride,
                           image_info->conv_gray_d, NULL, 0, 0);
}

Here is the call graph for this function:

void xlib_draw_indexed_image ( Drawable  drawable,
GC  gc,
int  x,
int  y,
int  width,
int  height,
XlibRgbDither  dith,
unsigned char *  buf,
int  rowstride,
XlibRgbCmap *  cmap 
)

xlib_draw_indexed_image: : FIXME : FIXME : FIXME : FIXME : FIXME : FIXME : FIXME : FIXME : FIXME : FIXME

FIXME

Definition at line 3587 of file gdk-pixbuf-xlibrgb.c.

{
  if (dith == XLIB_RGB_DITHER_NONE || (dith == XLIB_RGB_DITHER_NORMAL &&
                                   !image_info->dith_default))
    xlib_draw_rgb_image_core (drawable, gc, x, y, width, height,
                           buf, 1, rowstride,
                           image_info->conv_indexed, cmap, 0, 0);
  else
    xlib_draw_rgb_image_core (drawable, gc, x, y, width, height,
                           buf, 1, rowstride,
                           image_info->conv_indexed_d, cmap, 0, 0);
}

Here is the call graph for this function:

void xlib_draw_rgb_32_image ( Drawable  drawable,
GC  gc,
int  x,
int  y,
int  width,
int  height,
XlibRgbDither  dith,
unsigned char *  buf,
int  rowstride 
)

xlib_draw_rgb_32_image: : Destination drawable.

: A graphic context. : Leftmost coordinate of the destination rectangle. : Upper coordinate of the destination rectangle. : Width of the destination rectangle, in pixels. : Height of the destination rectangle, in pixels. : Dithering method to use. : Pointer to the pixel in the RGB buffer that corresponds to the upper-left corner of the rectangular region to render. : Offset between pixel rows in the RGB buffer, in bytes.

This function is analogous to xlib_draw_rgb_image(), but it lets you use 32-bit RGB buffers with pixels specified as 0xRRGGBB00. The least-significant 8 bits are actually discarded. This function can lead to faster results than xlib_draw_rgb_image() since the pixels are aligned on 32-bit boundaries.

Definition at line 3443 of file gdk-pixbuf-xlibrgb.c.

{
  if (dith == XLIB_RGB_DITHER_NONE || (dith == XLIB_RGB_DITHER_NORMAL &&
                                   !image_info->dith_default))
    xlib_draw_rgb_image_core (drawable, gc, x, y, width, height,
                           buf, 4, rowstride,
                           image_info->conv_32, NULL, 0, 0);
  else
    xlib_draw_rgb_image_core (drawable, gc, x, y, width, height,
                           buf, 4, rowstride,
                           image_info->conv_32_d, NULL, 0, 0);
}

Here is the call graph for this function:

void xlib_draw_rgb_image ( Drawable  drawable,
GC  gc,
int  x,
int  y,
int  width,
int  height,
XlibRgbDither  dith,
unsigned char *  rgb_buf,
int  rowstride 
)

xlib_draw_rgb_image: : Destination drawable.

: A graphic context. : Leftmost coordinate of the destination rectangle. : Upper coordinate of the destination rectangle. : Width of the destination rectangle, in pixels. : Height of the destination rectangle, in pixels. : Dithering method to use. : Pointer to the pixel in the RGB buffer that corresponds to the upper-left corner of the rectangular region to render. : Offset between pixel rows in the RGB buffer, in bytes.

Renders an RGB buffer to a drawable. Pixels are specified as RGB triplets with 8 bits per channel. An image will thus look like an RGBRGBRGBRGB sequence of 8-bit values. This function does not let you specify dither offsets; applications that need to render partial regions of a buffer to build the final image should use xlib_draw_rgb_image_dithalign() instead.

Definition at line 3356 of file gdk-pixbuf-xlibrgb.c.

{
  if (dith == XLIB_RGB_DITHER_NONE || (dith == XLIB_RGB_DITHER_NORMAL &&
                                  !image_info->dith_default))
    xlib_draw_rgb_image_core (drawable, gc, x, y, width, height,
                           rgb_buf, 3, rowstride, image_info->conv, NULL,
                           0, 0);
  else
    xlib_draw_rgb_image_core (drawable, gc, x, y, width, height,
                           rgb_buf, 3, rowstride, image_info->conv_d, NULL,
                           0, 0);
}

Here is the call graph for this function:

void xlib_draw_rgb_image_dithalign ( Drawable  drawable,
GC  gc,
int  x,
int  y,
int  width,
int  height,
XlibRgbDither  dith,
unsigned char *  rgb_buf,
int  rowstride,
int  xdith,
int  ydith 
)

xlib_draw_rgb_image_dithalign: : Destination drawable.

: A graphic context. : Leftmost coordinate of the destination rectangle. : Upper coordinate of the destination rectangle. : Width of the destination rectangle, in pixels. : Height of the destination rectangle, in pixels. : Dithering method to use. : Pointer to the pixel in the RGB buffer that corresponds to the upper-left corner of the rectangular region to render. : Offset between pixel rows in the RGB buffer, in bytes. : X offset for the dither mask. : Y offset for the dither mask.

Renders an RGB buffer to a drawable. Pixels are specified as RGB triplets with 8 bits per channel. An image will thus look like an RGBRGBRGBRGB sequence of 8-bit values. This function lets you specify a pair of dither offsets. It should be used when you need to render regions of an RGB buffer separately to form the final image; the dither offsets let you align the dither mask appropriately.

Definition at line 3400 of file gdk-pixbuf-xlibrgb.c.

{
  if (dith == XLIB_RGB_DITHER_NONE || (dith == XLIB_RGB_DITHER_NORMAL &&
                                   !image_info->dith_default))
    xlib_draw_rgb_image_core (drawable, gc, x, y, width, height,
                           rgb_buf, 3, rowstride, image_info->conv, NULL,
                           xdith, ydith);
  else
    xlib_draw_rgb_image_core (drawable, gc, x, y, width, height,
                           rgb_buf, 3, rowstride, image_info->conv_d, NULL,
                           xdith, ydith);
}

Here is the call graph for this function:

void xlib_rgb_cmap_free ( XlibRgbCmap *  cmap)

xlib_rgb_cmap_free: : An XlibRGB colormap.

Frees an XlibRGB colormap.

Definition at line 3566 of file gdk-pixbuf-xlibrgb.c.

{
  free (cmap);
}
XlibRgbCmap* xlib_rgb_cmap_new ( unsigned int colors,
int  n_colors 
)

xlib_rgb_cmap_new: : FIXME : FIXME

FIXME

Return value: FIXME

Definition at line 3530 of file gdk-pixbuf-xlibrgb.c.

{
  XlibRgbCmap *cmap;
  int i, j;
  unsigned int rgb;

  if (n_colors < 0)
    return NULL;
  if (n_colors > 256)
    return NULL;
  cmap = (XlibRgbCmap *) malloc(sizeof(XlibRgbCmap));
  memcpy (cmap->colors, colors, n_colors * sizeof(unsigned int));
  if (image_info->bpp == 1 &&
      (image_info->x_visual_info->class == PseudoColor ||
       image_info->x_visual_info->class == GrayScale))
    for (i = 0; i < n_colors; i++)
      {
       rgb = colors[i];
       j = ((rgb & 0xf00000) >> 12) |
                 ((rgb & 0xf000) >> 8) |
                 ((rgb & 0xf0) >> 4);
#ifdef VERBOSE
       printf ("%d %x %x %d\n", i, j, colorcube[j]);
#endif
       cmap->lut[i] = colorcube[j];
      }
  return cmap;
}

Here is the caller graph for this function:

Bool xlib_rgb_ditherable ( void  )

xlib_rgb_ditherable:

Queries whether XlibRGB supports dithering for its chosen visual.

Return value: TRUE if dithering can be performed for the visual that XlibRGB is using, FALSE otherwise.

Definition at line 3618 of file gdk-pixbuf-xlibrgb.c.

{
  return (image_info->conv != image_info->conv_d);
}
void xlib_rgb_gc_set_background ( GC  gc,
unsigned int  rgb 
)

xlib_rgb_gc_set_background: : A graphic context.

: 32-bit representation of an RGB value, specified as 0x00RRGGBB.

This is a convenience function to set the background of a GC from an RGB triplet. It calls xlib_rgb_xpixel_from_rgb() internally and uses the returned pixel value to set the GC's background.

Definition at line 1050 of file gdk-pixbuf-xlibrgb.c.

{
  unsigned long color;

  color = xlib_rgb_xpixel_from_rgb (rgb);
  XSetBackground(image_info->display, gc, color);
}

Here is the call graph for this function:

void xlib_rgb_gc_set_foreground ( GC  gc,
unsigned int  rgb 
)

xlib_rgb_gc_set_foreground: : A graphic context.

: 32-bit representation of an RGB value, specified as 0x00RRGGBB.

This is a convenience function to set the foreground of a GC from an RGB triplet. It calls xlib_rgb_xpixel_from_rgb() internally and uses the returned pixel value to set the GC's foreground.

Definition at line 1032 of file gdk-pixbuf-xlibrgb.c.

{
  unsigned long color;

  color = xlib_rgb_xpixel_from_rgb (rgb);
  XSetForeground(image_info->display, gc, color);
}

Here is the call graph for this function:

Colormap xlib_rgb_get_cmap ( void  )

xlib_rgb_get_cmap:

Queries the X colormap that XlibRGB is using.

Return value: An X colormap.

Definition at line 3631 of file gdk-pixbuf-xlibrgb.c.

{
  /* xlib_rgb_init (); */
  if (image_info)
    return image_info->cmap;
  else
    return 0;
}
int xlib_rgb_get_depth ( void  )

xlib_rgb_get_depth:

Queries the depth of the visual that XlibRGB is using.

Return value: Bit depth.

Definition at line 3682 of file gdk-pixbuf-xlibrgb.c.

{
  XVisualInfo * v = xlib_rgb_get_visual_info();

  if (v)
  {
    return v->depth;
  }

  return 0;
}

Here is the call graph for this function:

Display* xlib_rgb_get_display ( void  )

xlib_rgb_get_display:

Queries the X display that XlibRGB is using.

Return value: An X display.

Definition at line 3702 of file gdk-pixbuf-xlibrgb.c.

{
  if (image_info)
    return image_info->display;
  
  return NULL;
}
Screen* xlib_rgb_get_screen ( void  )

xlib_rgb_get_screen:

Queries the screen that XlibRGB is using.

Return value: An X screen.

Definition at line 3718 of file gdk-pixbuf-xlibrgb.c.

{
  if (image_info)
    return image_info->screen;
  
  return NULL;
}
Visual* xlib_rgb_get_visual ( void  )

xlib_rgb_get_visual:

Queries the visual that XlibRGB is using.

Return value: An X visual.

Definition at line 3648 of file gdk-pixbuf-xlibrgb.c.

{
  /* xlib_rgb_init (); */
  if (image_info)
    return image_info->x_visual_info->visual;
  else
    return 0;
}
XVisualInfo* xlib_rgb_get_visual_info ( void  )

xlib_rgb_get_visual_info:

Queries the visual info structure for the visual that XlibRGB is using.

Return value: An XVisualInfo structure.

Definition at line 3665 of file gdk-pixbuf-xlibrgb.c.

{
  /* xlib_rgb_init (); */
  if (image_info)
    return image_info->x_visual_info;
  else
    return 0;
}

Here is the caller graph for this function:

void xlib_rgb_init ( Display *  display,
Screen *  screen 
)

xlib_rgb_init: : X Display to use.

: Screen to use.

Initializes the XlibRGB machinery with the default depth. If you use this function XlibRGB will automatically pick the best visual available on your display. This function or xlib_rgb_init_with_depth() must be called before using any of the other functions in XlibRGB.

Definition at line 750 of file gdk-pixbuf-xlibrgb.c.

{
  int prefDepth = -1;            /*  let the function do the visual scoring */
  xlib_rgb_init_with_depth(display, screen, prefDepth);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void xlib_rgb_init_with_depth ( Display *  display,
Screen *  screen,
int  prefDepth 
)

xlib_rgb_init_with_depth: : X display to use.

: Screen to use. : Visual depth to use for color substitution tables. This must be one of the supported visual depths in the specified .

Initializes the XlibRGB machinery with a particular depth you specify, instead of automatically picking the best depth in the display. This function or xlib_rgb_init() must be called before using any of the other functions in XlibRGB.

Definition at line 769 of file gdk-pixbuf-xlibrgb.c.

{
  int i;
  static const int byte_order[1] = { 1 };

  static int initialized = 0;

  if (initialized)
  {
    return;
  }

  initialized = 1;

#ifdef WORDS_BIGENDIAN
  if (((char *)byte_order)[0] == 1) {
    printf ("xlib_rgb_init: compiled for big endian, but this is a little endian machine.\n\n");
    exit(1);
  }
#else
  if (((char *)byte_order)[0] != 1) {
    printf ("xlib_rgb_init: compiled for little endian, but this is a big endian machine.\n\n");
    exit(1);
  }
#endif

  if (image_info == NULL)
    {
      image_info = (XlibRgbInfo *) malloc(sizeof(XlibRgbInfo));
      memset(image_info, 0, sizeof(XlibRgbInfo));

      image_info->display = display;
      image_info->screen = screen;
      image_info->screen_num = XScreenNumberOfScreen(screen);
      image_info->x_visual_info = NULL;
      image_info->cmap = 0;
      image_info->default_visualid = DefaultVisual(display, image_info->screen_num);
      image_info->default_colormap = DefaultColormap(display, image_info->screen_num);

      image_info->color_pixels = NULL;
      image_info->gray_pixels = NULL;
      image_info->reserved_pixels = NULL;

      image_info->nred_shades = 6;
      image_info->ngreen_shades = 6;
      image_info->nblue_shades = 4;
      image_info->ngray_shades = 24;
      image_info->nreserved = 0;

      image_info->bpp = 0;
      image_info->cmap_alloced = FALSE;
      image_info->gamma_val = 1.0;

      image_info->stage_buf = NULL;

      image_info->own_gc = 0;
      
      image_info->red_shift = 0;
      image_info->red_prec = 0;
      image_info->green_shift = 0;
      image_info->green_prec = 0;
      image_info->blue_shift = 0;
      image_info->blue_prec = 0;

      if (prefDepth != -1)
        xlib_rgb_choose_visual_for_xprint (prefDepth);
      else
        xlib_rgb_choose_visual ();

      if ((image_info->x_visual_info->class == PseudoColor ||
          image_info->x_visual_info->class == StaticColor) &&
         image_info->x_visual_info->depth < 8 &&
         image_info->x_visual_info->depth >= 3)
       {
         image_info->cmap = image_info->default_colormap;
         xlib_rgb_colorcube_222 ();
       }
      else if (image_info->x_visual_info->class == PseudoColor)
       {
         if (xlib_rgb_install_cmap ||
             image_info->x_visual_info->visualid != image_info->default_visualid->visualid)
           {
             image_info->cmap = XCreateColormap(image_info->display,
                                           RootWindow(image_info->display, image_info->screen_num),
                                           image_info->x_visual_info->visual,
                                           AllocNone);
             image_info->cmap_alloced = TRUE;
           }
         if (!xlib_rgb_do_colormaps ())
           {
             image_info->cmap = XCreateColormap(image_info->display,
                                           RootWindow(image_info->display, image_info->screen_num),
                                           image_info->x_visual_info->visual,
                                           AllocNone);
             image_info->cmap_alloced = TRUE;
             xlib_rgb_do_colormaps ();
           }
         if (xlib_rgb_verbose)
           printf ("color cube: %d x %d x %d\n",
                  image_info->nred_shades,
                  image_info->ngreen_shades,
                  image_info->nblue_shades);

         if (!image_info->cmap_alloced)
             image_info->cmap = image_info->default_colormap;
       }
#ifdef ENABLE_GRAYSCALE
      else if (image_info->x_visual_info->class == GrayScale)
       {
         image_info->cmap = XCreateColormap(image_info->display,
                                        RootWindow(image_info->display, image_info->screen_num),
                                        image_info->x_visual_info->visual,
                                        AllocNone);
         xlib_rgb_set_gray_cmap (image_info->cmap);
         image_info->cmap_alloced = TRUE;
       }
#endif
      else
       {
         /* Always install colormap in direct color. */
         if (image_info->x_visual_info->class != DirectColor && 
             image_info->x_visual_info->visualid == image_info->default_visualid->visualid)
           image_info->cmap = image_info->default_colormap;
         else
           {
             image_info->cmap = XCreateColormap(image_info->display,
                                           RootWindow(image_info->display, image_info->screen_num),
                                           image_info->x_visual_info->visual,
                                           AllocNone);
             image_info->cmap_alloced = TRUE;
           }
       }

      image_info->bitmap = (image_info->x_visual_info->depth == 1);

      for (i = 0; i < N_IMAGES; i++) {
       if (image_info->bitmap) {
         /* Use malloc() instead of g_malloc since X will free() this mem */
         static_image[i] = XCreateImage(image_info->display,
                                    image_info->x_visual_info->visual,
                                    1,
                                    XYBitmap,
                                    0, 0, IMAGE_WIDTH, IMAGE_HEIGHT,
                                    8,
                                    0);
         static_image[i]->data = (char *) malloc(IMAGE_WIDTH * IMAGE_HEIGHT >> 3);
         static_image[i]->bitmap_bit_order = MSBFirst;
         static_image[i]->byte_order = MSBFirst;
       }
       else {
         static_image[i] = XCreateImage(image_info->display,
                                    image_info->x_visual_info->visual,
                                    (unsigned int)image_info->x_visual_info->depth,
                                    ZPixmap,
                                    0, 0,
                                    IMAGE_WIDTH,
                                    IMAGE_HEIGHT,
                                    32, 0);
         /* remove this when we are using shared memory.. */
         static_image[i]->data = (char *) malloc((size_t)IMAGE_WIDTH * IMAGE_HEIGHT * image_info->x_visual_info->depth);
         static_image[i]->bitmap_bit_order = MSBFirst;
         static_image[i]->byte_order = MSBFirst;
       }
      }
      /* ok, so apparently, image_info->bpp is actually
        BYTES per pixel.  What fun! */
      switch (static_image[0]->bits_per_pixel) {
      case 1:
      case 8:
       image_info->bpp = 1;
       break;
      case 16:
       image_info->bpp = 2;
       break;
      case 24:
       image_info->bpp = 3;
       break;
      case 32:
       image_info->bpp = 4;
       break;
      }
      xlib_rgb_select_conv (static_image[0], MSB_FIRST);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void xlib_rgb_set_install ( Bool  install)

xlib_rgb_set_install: : True to install a colormap

Sets whether we install an RGB colormap.

Definition at line 483 of file gdk-pixbuf-xlibrgb.c.

{
  xlib_rgb_install_cmap = install;
}
void xlib_rgb_set_min_colors ( int  min_colors)

xlib_rgb_set_min_colors: : minimum colors to use

Sets the minimum number of colors in the color cube.

Definition at line 495 of file gdk-pixbuf-xlibrgb.c.

{
  xlib_rgb_min_colors = min_colors;
}
void xlib_rgb_set_verbose ( Bool  verbose)

xlib_rgb_set_verbose: : True to be verbose

Enables/disables debug spew.

Definition at line 471 of file gdk-pixbuf-xlibrgb.c.

{
  xlib_rgb_verbose = verbose;
}
unsigned long xlib_rgb_xpixel_from_rgb ( unsigned int  rgb)

xlib_rgb_xpixel_from_rgb: : 32-bit representation of an RGB value, specified as 0x00RRGGBB.

Converts an RGB triplet into the closest color that XlibRGB visual can handle.

Return value: X pixel value that corresponds to the closest color in the XlibRGB visual and colormap.

Definition at line 965 of file gdk-pixbuf-xlibrgb.c.

{
  unsigned long pixel = 0;

  if (image_info->bitmap)
    {
      return ((rgb & 0xff0000) >> 16) +
       ((rgb & 0xff00) >> 7) +
       (rgb & 0xff) > 510;
    }
  else if (image_info->x_visual_info->class == PseudoColor)
    pixel = colorcube[((rgb & 0xf00000) >> 12) |
                   ((rgb & 0xf000) >> 8) |
                   ((rgb & 0xf0) >> 4)];
  else if (image_info->x_visual_info->depth < 8 &&
          image_info->x_visual_info->class == StaticColor)
    {
      pixel = colorcube_d[((rgb & 0x800000) >> 17) |
                      ((rgb & 0x8000) >> 12) |
                      ((rgb & 0x80) >> 7)];
    }
  else if (image_info->x_visual_info->class == TrueColor ||
          image_info->x_visual_info->class == DirectColor)
    {
#ifdef VERBOSE
      printf ("shift, prec: r %d %d g %d %d b %d %d\n",
             image_info->red_shift,
             image_info->red_prec,
             image_info->green_shift,
             image_info->green_prec,
             image_info->blue_shift,
             image_info->blue_prec);
#endif

      pixel = (((((rgb & 0xff0000) >> 16) >>
               (8 - image_info->red_prec)) <<
              image_info->red_shift) +
              ((((rgb & 0xff00) >> 8)  >>
               (8 - image_info->green_prec)) <<
              image_info->green_shift) +
              (((rgb & 0xff) >>
               (8 - image_info->blue_prec)) <<
              image_info->blue_shift));
    }
  else if (image_info->x_visual_info->class == StaticGray ||
          image_info->x_visual_info->class == GrayScale)
    {
      int gray = ((rgb & 0xff0000) >> 16) +
       ((rgb & 0xff00) >> 7) +
       (rgb & 0xff);

      return gray >> (10 - image_info->x_visual_info->depth);
    }

  return pixel;
}

Here is the caller graph for this function: