Back to index

scribus-ng  1.3.4.dfsg+svn20071115
Classes | Defines | Typedefs | Enumerations | Functions | Variables
gdk-pixbuf-xlibrgb.c File Reference
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "gdk-pixbuf-xlibrgb.h"
#include "gdk-pixbuf-xlib-private.h"

Go to the source code of this file.

Classes

struct  _XlibRgbInfo

Defines

#define ENABLE_GRAYSCALE
#define MIN(a, b)   (((a) < (b)) ? (a) : (b))
#define MAX(a, b)   (((a) > (b)) ? (a) : (b))
#define IMAGE_WIDTH   256
#define STAGE_ROWSTRIDE   (IMAGE_WIDTH * 3)
#define IMAGE_HEIGHT   64
#define N_IMAGES   6
#define HAIRY_CONVERT_8
#define DM_WIDTH   128
#define DM_WIDTH_SHIFT   7
#define DM_HEIGHT   128
#define HAIRY_CONVERT_565
#define HAIRY_CONVERT_888

Typedefs

typedef struct _XlibRgbInfo
typedef void(* XlibRgbConvFunc )(XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)

Enumerations

enum  ByteOrder { LSB_FIRST, MSB_FIRST }

Functions

static unsigned long xlib_get_prec_from_mask (unsigned long val)
static unsigned long xlib_get_shift_from_mask (unsigned long val)
static int xlib_rgb_cmap_fail (const char *msg, Colormap cmap, unsigned long *pixels)
static void xlib_rgb_make_colorcube (unsigned long *pixels, int nr, int ng, int nb)
static void xlib_rgb_make_colorcube_d (unsigned long *pixels, int nr, int ng, int nb)
static int xlib_rgb_try_colormap (int nr, int ng, int nb)
static Bool xlib_rgb_do_colormaps (void)
static void xlib_rgb_colorcube_222 (void)
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
static unsigned int xlib_rgb_score_visual (XVisualInfo *visual)
static void xlib_rgb_choose_visual (void)
static void xlib_rgb_choose_visual_for_xprint (int aDepth)
static void xlib_rgb_select_conv (XImage *image, ByteOrder byte_order)
static void xlib_rgb_set_gray_cmap (Colormap cmap)
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.
static void xlib_rgb_convert_8 (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_preprocess_dm_565 (void)
static void xlib_rgb_convert_8_d666 (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_convert_8_d (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_convert_8_indexed (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_convert_gray8 (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_convert_gray8_gray (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_convert_565 (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_convert_565_gray (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_convert_565_br (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_convert_565_d (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_convert_555 (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_convert_555_br (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_convert_888_msb (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_convert_888_lsb (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_convert_0888 (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_convert_0888_br (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_convert_8880_br (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_convert_truecolor_lsb (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_convert_truecolor_lsb_d (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_convert_truecolor_msb (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_convert_truecolor_msb_d (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_convert_4 (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_convert_gray4 (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_convert_gray4_pack (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_convert_gray4_d (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_convert_gray4_d_pack (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_convert_1 (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static unsigned char * xlib_rgb_ensure_stage (void)
static void xlib_rgb_32_to_stage (unsigned char *buf, int rowstride, int width, int height)
static void xlib_rgb_convert_32_generic (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_convert_32_generic_d (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_gray_to_stage (unsigned char *buf, int rowstride, int width, int height)
static void xlib_rgb_convert_gray_generic (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_convert_gray_generic_d (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_convert_gray_cmap (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_indexed_to_stage (unsigned char *buf, int rowstride, int width, int height, XlibRgbCmap *cmap)
static void xlib_rgb_convert_indexed_generic (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static void xlib_rgb_convert_indexed_generic_d (XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)
static int xlib_rgb_alloc_scratch_image (void)
static XImage * xlib_rgb_alloc_scratch (int width, int height, int *ax, int *ay)
static void xlib_draw_rgb_image_core (Drawable drawable, GC gc, int x, int y, int width, int height, unsigned char *buf, int pixstride, int rowstride, XlibRgbConvFunc conv, XlibRgbCmap *cmap, int xdith, int ydith)
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.
static void xlib_rgb_make_gray_cmap (XlibRgbInfo *info)
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:
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:

Variables

static Bool xlib_rgb_install_cmap = FALSE
static int xlib_rgb_min_colors = 5 * 5 * 5
static Bool xlib_rgb_verbose = FALSE
static XlibRgbInfo * image_info = NULL
static XImage * static_image [N_IMAGES]
static int static_image_idx
static unsigned char * colorcube
static unsigned char * colorcube_d
static const unsigned char DM [128][128]
static unsigned intDM_565 = NULL
static int horiz_idx
static int horiz_y = IMAGE_HEIGHT
static int vert_idx
static int vert_x = IMAGE_WIDTH
static int tile_idx
static int tile_x = IMAGE_WIDTH
static int tile_y1 = IMAGE_HEIGHT
static int tile_y2 = IMAGE_HEIGHT

Class Documentation

struct _XlibRgbInfo

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

Class Members
Bool bitmap
unsigned long blue_prec
unsigned long blue_shift
unsigned int bpp
Colormap cmap
unsigned int cmap_alloced
XColor * cmap_colors
unsigned long * color_pixels
XlibRgbConvFunc conv
XlibRgbConvFunc conv_32
XlibRgbConvFunc conv_32_d
XlibRgbConvFunc conv_d
XlibRgbConvFunc conv_gray
XlibRgbConvFunc conv_gray_d
XlibRgbConvFunc conv_indexed
XlibRgbConvFunc conv_indexed_d
Colormap default_colormap
Visual * default_visualid
Display * display
Bool dith_default
double gamma_val
XlibRgbCmap * gray_cmap
unsigned long * gray_pixels
unsigned long green_prec
unsigned long green_shift
unsigned int nblue_shades
unsigned int ngray_shades
unsigned int ngreen_shades
unsigned int nred_shades
unsigned int nreserved
GC own_gc
unsigned long red_prec
unsigned long red_shift
unsigned long * reserved_pixels
Screen * screen
int screen_num
unsigned char * stage_buf
XVisualInfo * x_visual_info

Define Documentation

#define DM_HEIGHT   128

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

#define DM_WIDTH   128

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

#define DM_WIDTH_SHIFT   7

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

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

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

#define HAIRY_CONVERT_8

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

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

#define IMAGE_HEIGHT   64

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

#define IMAGE_WIDTH   256

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

#define MAX (   a,
 
)    (((a) > (b)) ? (a) : (b))

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

#define MIN (   a,
 
)    (((a) < (b)) ? (a) : (b))

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

#define N_IMAGES   6

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

#define STAGE_ROWSTRIDE   (IMAGE_WIDTH * 3)

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


Typedef Documentation

typedef struct _XlibRgbInfo

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

typedef void(* XlibRgbConvFunc)(XImage *image, int ax, int ay, int width, int height, unsigned char *buf, int rowstride, int x_align, int y_align, XlibRgbCmap *cmap)

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


Enumeration Type Documentation

enum ByteOrder
Enumerator:
LSB_FIRST 
MSB_FIRST 

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


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:

static void xlib_draw_rgb_image_core ( Drawable  drawable,
GC  gc,
int  x,
int  y,
int  width,
int  height,
unsigned char *  buf,
int  pixstride,
int  rowstride,
XlibRgbConvFunc  conv,
XlibRgbCmap *  cmap,
int  xdith,
int  ydith 
) [static]

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

{
  int ay, ax;
  int xs0, ys0;
  XImage *image;
  int width1, height1;
  unsigned char *buf_ptr;

  if (image_info->bitmap)
    {
      if (image_info->own_gc == 0)
       {
         XColor color;

         image_info->own_gc = XCreateGC(image_info->display,
                                    drawable,
                                    0, NULL);
         color.pixel = WhitePixel(image_info->display,
                               image_info->screen_num);
         XSetForeground(image_info->display, image_info->own_gc, color.pixel);
         color.pixel = BlackPixel(image_info->display,
                               image_info->screen_num);
         XSetBackground(image_info->display, image_info->own_gc, color.pixel);
       }
      gc = image_info->own_gc;
    }
  for (ay = 0; ay < height; ay += IMAGE_HEIGHT)
    {
      height1 = MIN (height - ay, IMAGE_HEIGHT);
      for (ax = 0; ax < width; ax += IMAGE_WIDTH)
       {
         width1 = MIN (width - ax, IMAGE_WIDTH);
         buf_ptr = buf + ay * rowstride + ax * pixstride;

         image = xlib_rgb_alloc_scratch (width1, height1, &xs0, &ys0);

         conv (image, xs0, ys0, width1, height1, buf_ptr, rowstride,
              x + ax + xdith, y + ay + ydith, cmap);

#ifndef DONT_ACTUALLY_DRAW
         XPutImage(image_info->display, drawable, gc, image,
                  xs0, ys0, x + ax, y + ay, (unsigned int)width1, (unsigned int)height1);
#endif
       }
    }
}

Here is the call graph for this function:

Here is the caller 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:

static unsigned long xlib_get_prec_from_mask ( unsigned long  val) [static]

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

{
  unsigned long retval = 0;
  unsigned int cur_bit = 0;
  /* walk through the number, incrementing the value if
     the bit in question is set. */
  while (cur_bit < (sizeof(unsigned long) * 8)) {
    if ((val >> cur_bit) & 0x1) {
      retval++;
    }
    cur_bit++;
  }
  return retval;
}

Here is the caller graph for this function:

static unsigned long xlib_get_shift_from_mask ( unsigned long  val) [static]

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

{
  unsigned long cur_bit = 0;
  /* walk through the number, looking for the first 1 */
  while (cur_bit < (sizeof(unsigned long) * 8)) {
    if ((val >> cur_bit) & 0x1) {
      return cur_bit;
    }
    cur_bit++;
  }
  return cur_bit;
}

Here is the caller graph for this function:

static void xlib_rgb_32_to_stage ( unsigned char *  buf,
int  rowstride,
int  width,
int  height 
) [static]

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

{
  int x, y;
  unsigned char *pi_start, *po_start;
  unsigned char *pi, *po;

  pi_start = buf;
  po_start = xlib_rgb_ensure_stage ();
  for (y = 0; y < height; y++)
    {
      pi = pi_start;
      po = po_start;
      for (x = 0; x < width; x++)
       {
         *po++ = *pi++;
         *po++ = *pi++;
         *po++ = *pi++;
         pi++;
       }
      pi_start += rowstride;
      po_start += STAGE_ROWSTRIDE;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static XImage* xlib_rgb_alloc_scratch ( int  width,
int  height,
int ax,
int ay 
) [static]

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

{
  XImage *image;
  int idx;

  if (width >= (IMAGE_WIDTH >> 1))
    {
      if (height >= (IMAGE_HEIGHT >> 1))
       {
         idx = xlib_rgb_alloc_scratch_image ();
         *ax = 0;
         *ay = 0;
       }
      else
       {
         if (height + horiz_y > IMAGE_HEIGHT)
           {
             horiz_idx = xlib_rgb_alloc_scratch_image ();
             horiz_y = 0;
           }
         idx = horiz_idx;
         *ax = 0;
         *ay = horiz_y;
         horiz_y += height;
       }
    }
  else
    {
      if (height >= (IMAGE_HEIGHT >> 1))
       {
         if (width + vert_x > IMAGE_WIDTH)
           {
             vert_idx = xlib_rgb_alloc_scratch_image ();
             vert_x = 0;
           }
         idx = vert_idx;
         *ax = vert_x;
         *ay = 0;
         /* using 3 and -4 would be slightly more efficient on 32-bit machines
            with > 1bpp displays */
         vert_x += (width + 7) & -8;
       }
      else
       {
         if (width + tile_x > IMAGE_WIDTH)
           {
             tile_y1 = tile_y2;
             tile_x = 0;
           }
         if (height + tile_y1 > IMAGE_HEIGHT)
           {
             tile_idx = xlib_rgb_alloc_scratch_image ();
             tile_x = 0;
             tile_y1 = 0;
             tile_y2 = 0;
           }
         if (height + tile_y1 > tile_y2)
           tile_y2 = height + tile_y1;
         idx = tile_idx;
         *ax = tile_x;
         *ay = tile_y1;
         tile_x += (width + 7) & -8;
       }
    }
  image = static_image[idx];
#ifdef VERBOSE
  printf ("index %d, x %d, y %d (%d x %d)\n", idx, *ax, *ay, width, height);
  sincelast++;
#endif
  return image;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int xlib_rgb_alloc_scratch_image ( void  ) [static]

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

{
  if (static_image_idx == N_IMAGES)
    {
#ifndef NO_FLUSH
      XFlush(image_info->display);
#endif
#ifdef VERBOSE
      printf ("flush, %d puts since last flush\n", sincelast);
      sincelast = 0;
#endif
      static_image_idx = 0;
      horiz_y = IMAGE_HEIGHT;
      vert_x = IMAGE_WIDTH;
      tile_x = IMAGE_WIDTH;
      tile_y1 = tile_y2 = IMAGE_HEIGHT;
    }
  return static_image_idx++;
}

Here is the caller graph for this function:

static void xlib_rgb_choose_visual ( void  ) [static]

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

{
  XVisualInfo *visuals;
  XVisualInfo *visual;
  XVisualInfo *best_visual;
  XVisualInfo *final_visual;
  XVisualInfo template;
  int num_visuals;
  unsigned int score, best_score;
  int cur_visual = 1;
  int i;
  
  template.screen = image_info->screen_num;
  visuals = XGetVisualInfo(image_info->display, VisualScreenMask,
                        &template, &num_visuals);
  
  best_visual = visuals;
  best_score = xlib_rgb_score_visual (best_visual);

  for (i = cur_visual; i < num_visuals; i++)
    {
      visual = &visuals[i];
      score = xlib_rgb_score_visual  (visual);
      if (score > best_score)
       {
         best_score = score;
         best_visual = visual;
       }
    }
  /* make a copy of the visual so that we can free
     the allocated visual list above. */
  final_visual = (XVisualInfo *) malloc(sizeof(XVisualInfo));
  memcpy(final_visual, best_visual, sizeof(XVisualInfo));
  image_info->x_visual_info = final_visual;
  XFree(visuals);
  /* set up the shift and the precision for the red, green and blue.
     this only applies to cool visuals like true color and direct color. */
  if (image_info->x_visual_info->class == TrueColor ||
      image_info->x_visual_info->class == DirectColor) {
    image_info->red_shift = xlib_get_shift_from_mask(image_info->x_visual_info->red_mask);
    image_info->red_prec = xlib_get_prec_from_mask(image_info->x_visual_info->red_mask);
    image_info->green_shift = xlib_get_shift_from_mask(image_info->x_visual_info->green_mask);
    image_info->green_prec = xlib_get_prec_from_mask(image_info->x_visual_info->green_mask);
    image_info->blue_shift = xlib_get_shift_from_mask(image_info->x_visual_info->blue_mask);
    image_info->blue_prec = xlib_get_prec_from_mask(image_info->x_visual_info->blue_mask);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void xlib_rgb_choose_visual_for_xprint ( int  aDepth) [static]

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

{
  XVisualInfo *visuals;
  XVisualInfo *visual;
  XVisualInfo *best_visual;
  XVisualInfo *final_visual;
  XVisualInfo template;
  int num_visuals;
  int cur_visual = 1;
  int i;

  XWindowAttributes win_att;
  Status ret_stat;
  Visual      *root_visual;

  ret_stat = XGetWindowAttributes(image_info->display, 
                     RootWindow(image_info->display, image_info->screen_num),
                     &win_att);
  root_visual = win_att.visual;
  template.screen = image_info->screen_num;
  visuals = XGetVisualInfo(image_info->display, VisualScreenMask,
                        &template, &num_visuals);
 
  best_visual = visuals;
  if (best_visual->visual != root_visual) {
     for (i = cur_visual; i < num_visuals; i++) {
        visual = &visuals[i];
        if (visual->visual == root_visual) {
           best_visual = visual;
           break;
        }
      }
   }
  /* make a copy of the visual so that we can free
     the allocated visual list above. */
  final_visual = (XVisualInfo *) malloc(sizeof(XVisualInfo));
  memcpy(final_visual, best_visual, sizeof(XVisualInfo));
  image_info->x_visual_info = final_visual;
  XFree(visuals);
  /* set up the shift and the precision for the red, green and blue.
     this only applies to cool visuals like true color and direct color. */
  if (image_info->x_visual_info->class == TrueColor ||
      image_info->x_visual_info->class == DirectColor) {
    image_info->red_shift = xlib_get_shift_from_mask(image_info->x_visual_info->red_mask);
    image_info->red_prec = xlib_get_prec_from_mask(image_info->x_visual_info->red_mask);
    image_info->green_shift = xlib_get_shift_from_mask(image_info->x_visual_info->green_mask);
    image_info->green_prec = xlib_get_prec_from_mask(image_info->x_visual_info->green_mask);
    image_info->blue_shift = xlib_get_shift_from_mask(image_info->x_visual_info->blue_mask);
    image_info->blue_prec = xlib_get_prec_from_mask(image_info->x_visual_info->blue_mask);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int xlib_rgb_cmap_fail ( const char *  msg,
Colormap  cmap,
unsigned long pixels 
) [static]

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

{
  unsigned long free_pixels[256];
  int n_free;
  int i;

#ifdef VERBOSE
  printf ("%s", msg);
#endif
  n_free = 0;
  for (i = 0; i < 256; i++)
    if (pixels[i] < 256)
      free_pixels[n_free++] = pixels[i];
  
  if (n_free)
    XFreeColors(image_info->display,
              cmap,
              free_pixels,
              n_free,
              0);
  return 0;
}

Here is the caller 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:

static void xlib_rgb_colorcube_222 ( void  ) [static]

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

{
  int i;
  XColor color;
  Colormap cmap;

  if (image_info->cmap_alloced)
    cmap = image_info->cmap;
  else
    cmap = image_info->default_colormap;

  colorcube_d = (unsigned char *) malloc(sizeof(unsigned char) * 512);

  for (i = 0; i < 8; i++)
    {
      color.red = ((i & 4) >> 2) * 65535;
      color.green = ((i & 2) >> 1) * 65535;
      color.blue = (i & 1) * 65535;
      XAllocColor (image_info->display, cmap, &color);
      colorcube_d[((i & 4) << 4) | ((i & 2) << 2) | (i & 1)] = color.pixel;
    }
}

Here is the caller graph for this function:

static void xlib_rgb_convert_0888 ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  int x, y;
  unsigned char *obuf;
  int bpl;
  unsigned char *bptr, *bp2;
  int r, g, b;

  bptr = buf;
  bpl = image->bytes_per_line;
  obuf = ((unsigned char *)image->data) + ay * bpl + ax * 4;
  for (y = 0; y < height; y++)
    {
      bp2 = bptr;
      for (x = 0; x < width; x++)
       {
         r = bp2[0];
         g = bp2[1];
         b = bp2[2];
         ((unsigned int *)obuf)[x] = (r << 16) | (g << 8) | b;
         bp2 += 3;
       }
      bptr += rowstride;
      obuf += bpl;
    }
}

Here is the caller graph for this function:

static void xlib_rgb_convert_0888_br ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  int x, y;
  unsigned char *obuf;
  int bpl;
  unsigned char *bptr, *bp2;
  int r, g, b;

  bptr = buf;
  bpl = image->bytes_per_line;
  obuf = ((unsigned char *)image->data) + ay * bpl + ax * 4;
  for (y = 0; y < height; y++)
    {
      bp2 = bptr;
      for (x = 0; x < width; x++)
       {
         r = bp2[0];
         g = bp2[1];
         b = bp2[2];
         ((unsigned int *)obuf)[x] = (b << 24) | (g << 16) | (r << 8);
         bp2 += 3;
       }
      bptr += rowstride;
      obuf += bpl;
    }
}

Here is the caller graph for this function:

static void xlib_rgb_convert_1 ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  int x, y;
  int bpl;
  unsigned char *obuf, *obptr;
  unsigned char *bptr, *bp2;
  int r, g, b;
  const unsigned char *dmp;
  int dith;
  unsigned char byte;

  bptr = buf;
  bpl = image->bytes_per_line;
  obuf = ((unsigned char *)image->data) + ay * bpl + (ax >> 3);
  byte = 0; /* unnecessary, but it keeps gcc from complaining */
  for (y = 0; y < height; y++)
    {
      dmp = DM[(y_align + y) & (DM_HEIGHT - 1)];
      bp2 = bptr;
      obptr = obuf;
      for (x = 0; x < width; x++)
       {
         r = *bp2++;
         g = *bp2++;
         b = *bp2++;
         dith = (dmp[(x_align + x) & (DM_WIDTH - 1)] << 4) | 4;
         byte += byte + (r + g + g + b + dith > 1020);
         if ((x & 7) == 7)
           {
             obptr[0] = byte;
             obptr++;
           }
       }
      if (x & 7)
       obptr[0] = byte << (8 - (x & 7));
      bptr += rowstride;
      obuf += bpl;
    }
}

Here is the caller graph for this function:

static void xlib_rgb_convert_32_generic ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  xlib_rgb_32_to_stage (buf, rowstride, width, height);

  (*image_info->conv) (image, ax, ay, width, height,
                     image_info->stage_buf, STAGE_ROWSTRIDE,
                     x_align, y_align, cmap);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void xlib_rgb_convert_32_generic_d ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  xlib_rgb_32_to_stage (buf, rowstride, width, height);

  (*image_info->conv_d) (image, ax, ay, width, height,
                      image_info->stage_buf, STAGE_ROWSTRIDE,
                      x_align, y_align, cmap);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void xlib_rgb_convert_4 ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  int x, y;
  int bpl;
  unsigned char *obuf, *obptr;
  unsigned char *bptr, *bp2;
  int r, g, b;
  const unsigned char *dmp;
  int dith;

  bptr = buf;
  bpl = image->bytes_per_line;
  obuf = ((unsigned char *)image->data) + ay * bpl + ax;
  for (y = 0; y < height; y++)
    {
      dmp = DM[(y_align + y) & (DM_HEIGHT - 1)];
      bp2 = bptr;
      obptr = obuf;
      for (x = 0; x < width; x += 1)
       {
         r = *bp2++;
         g = *bp2++;
         b = *bp2++;
         dith = (dmp[(x_align + x) & (DM_WIDTH - 1)] << 2) | 3;
         obptr[0] = colorcube_d[(((r + dith) & 0x100) >> 2) |
                            (((g + 258 - dith) & 0x100) >> 5) |
                            (((b + dith) & 0x100) >> 8)];
         obptr++;
       }
      bptr += rowstride;
      obuf += bpl;
    }
}

Here is the caller graph for this function:

static void xlib_rgb_convert_555 ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  int x, y;
  unsigned char *obuf;
  int bpl;
  unsigned char *bptr, *bp2;
  unsigned char r, g, b;

  bptr = buf;
  bpl = image->bytes_per_line;
  obuf = ((unsigned char *)image->data) + ay * bpl + ax * 2;
  for (y = 0; y < height; y++)
    {
      bp2 = bptr;
      for (x = 0; x < width; x++)
       {
         r = *bp2++;
         g = *bp2++;
         b = *bp2++;
         ((unsigned short *)obuf)[x] = ((r & 0xf8) << 7) |
           ((g & 0xf8) << 2) |
           (b >> 3);
       }
      bptr += rowstride;
      obuf += bpl;
    }
}

Here is the caller graph for this function:

static void xlib_rgb_convert_555_br ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  int x, y;
  unsigned char *obuf;
  int bpl;
  unsigned char *bptr, *bp2;
  unsigned char r, g, b;

  bptr = buf;
  bpl = image->bytes_per_line;
  obuf = ((unsigned char *)image->data) + ay * bpl + ax * 2;
  for (y = 0; y < height; y++)
    {
      bp2 = bptr;
      for (x = 0; x < width; x++)
       {
         r = *bp2++;
         g = *bp2++;
         b = *bp2++;
         /* final word is:
            g5 g4 g3 b7 b6 b5 b4 b3  0 r7 r6 r5 r4 r3 g7 g6
          */
         ((unsigned short *)obuf)[x] = ((r & 0xf8) >> 1) |
           ((g & 0xc0) >> 6) |
           ((g & 0x18) << 10) |
           ((b & 0xf8) << 5);
       }
      bptr += rowstride;
      obuf += bpl;
    }
}

Here is the caller graph for this function:

static void xlib_rgb_convert_565 ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  int x, y;
  unsigned char *obuf, *obptr;
  int bpl;
  unsigned char *bptr, *bp2;
  unsigned char r, g, b;

  bptr = buf;
  bpl = image->bytes_per_line;
  obuf = ((unsigned char *)image->data) + ay * bpl + ax * 2;
  for (y = 0; y < height; y++)
    {
      bp2 = bptr;
      obptr = obuf;
      if (((unsigned long)obuf | (unsigned long) bp2) & 3)
       {
         for (x = 0; x < width; x++)
           {
             r = *bp2++;
             g = *bp2++;
             b = *bp2++;
             ((unsigned short *)obptr)[0] = ((r & 0xf8) << 8) |
              ((g & 0xfc) << 3) |
              (b >> 3);
             obptr += 2;
           }
       }
      else
       {
         for (x = 0; x < width - 3; x += 4)
           {
             unsigned int r1b0g0r0;
             unsigned int g2r2b1g1;
             unsigned int b3g3r3b2;

             r1b0g0r0 = ((unsigned int *)bp2)[0];
             g2r2b1g1 = ((unsigned int *)bp2)[1];
             b3g3r3b2 = ((unsigned int *)bp2)[2];
             ((unsigned int *)obptr)[0] =
              ((r1b0g0r0 & 0xf8) << 8) |
              ((r1b0g0r0 & 0xfc00) >> 5) |
              ((r1b0g0r0 & 0xf80000) >> 19) |
              (r1b0g0r0 & 0xf8000000) |
              ((g2r2b1g1 & 0xfc) << 19) |
              ((g2r2b1g1 & 0xf800) << 5);
             ((unsigned int *)obptr)[1] =
              ((g2r2b1g1 & 0xf80000) >> 8) |
              ((g2r2b1g1 & 0xfc000000) >> 21) |
              ((b3g3r3b2 & 0xf8) >> 3) |
              ((b3g3r3b2 & 0xf800) << 16) |
              ((b3g3r3b2 & 0xfc0000) << 3) |
              ((b3g3r3b2 & 0xf8000000) >> 11);
             bp2 += 12;
             obptr += 8;
           }
         for (; x < width; x++)
           {
             r = *bp2++;
             g = *bp2++;
             b = *bp2++;
             ((unsigned short *)obptr)[0] = ((r & 0xf8) << 8) |
              ((g & 0xfc) << 3) |
              (b >> 3);
             obptr += 2;
           }
       }
      bptr += rowstride;
      obuf += bpl;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void xlib_rgb_convert_565_br ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  int x, y;
  unsigned char *obuf;
  int bpl;
  unsigned char *bptr, *bp2;
  unsigned char r, g, b;

  bptr = buf;
  bpl = image->bytes_per_line;
  obuf = ((unsigned char *)image->data) + ay * bpl + ax * 2;
  for (y = 0; y < height; y++)
    {
      bp2 = bptr;
      for (x = 0; x < width; x++)
       {
         r = *bp2++;
         g = *bp2++;
         b = *bp2++;
         /* final word is:
            g4 g3 g2 b7 b6 b5 b4 b3  r7 r6 r5 r4 r3 g7 g6 g5
          */
         ((unsigned short *)obuf)[x] = (r & 0xf8) |
           ((g & 0xe0) >> 5) |
           ((g & 0x1c) << 11) |
           ((b & 0xf8) << 5);
       }
      bptr += rowstride;
      obuf += bpl;
    }
}

Here is the caller graph for this function:

static void xlib_rgb_convert_565_d ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  /* Now this is what I'd call some highly tuned code! */
  int x, y;
  unsigned char *obuf, *obptr;
  int bpl;
  unsigned char *bptr, *bp2;

  width += x_align;
  height += y_align;
  
  bptr = buf;
  bpl = image->bytes_per_line;
  obuf = ((unsigned char *)image->data) + ay * bpl + ax * 2;
  for (y = y_align; y < height; y++)
    {
      unsigned int *dmp = DM_565 + ((y & (DM_HEIGHT - 1)) << DM_WIDTH_SHIFT);
      bp2 = bptr;
      obptr = obuf;
      if (((unsigned long)obuf | (unsigned long) bp2) & 3)
       {
         for (x = x_align; x < width; x++)
           {
             int rgb = *bp2++ << 20;
             rgb += *bp2++ << 10;
             rgb += *bp2++;
             rgb += dmp[x & (DM_WIDTH - 1)];
             rgb += 0x10040100
              - ((rgb & 0x1e0001e0) >> 5)
              - ((rgb & 0x00070000) >> 6);

             ((unsigned short *)obptr)[0] =
              ((rgb & 0x0f800000) >> 12) |
              ((rgb & 0x0003f000) >> 7) |
              ((rgb & 0x000000f8) >> 3);
             obptr += 2;
           }
       }
      else
       {
         for (x = x_align; x < width - 3; x += 4)
           {
             unsigned int r1b0g0r0;
             unsigned int g2r2b1g1;
             unsigned int b3g3r3b2;
             unsigned int rgb02, rgb13;

             r1b0g0r0 = ((unsigned int *)bp2)[0];
             g2r2b1g1 = ((unsigned int *)bp2)[1];
             b3g3r3b2 = ((unsigned int *)bp2)[2];
             rgb02 =
              ((r1b0g0r0 & 0xff) << 20) +
              ((r1b0g0r0 & 0xff00) << 2) +
              ((r1b0g0r0 & 0xff0000) >> 16) +
              dmp[x & (DM_WIDTH - 1)];
             rgb02 += 0x10040100
              - ((rgb02 & 0x1e0001e0) >> 5)
              - ((rgb02 & 0x00070000) >> 6);
             rgb13 =
              ((r1b0g0r0 & 0xff000000) >> 4) +
              ((g2r2b1g1 & 0xff) << 10) +
              ((g2r2b1g1 & 0xff00) >> 8) +
              dmp[(x + 1) & (DM_WIDTH - 1)];
             rgb13 += 0x10040100
              - ((rgb13 & 0x1e0001e0) >> 5)
              - ((rgb13 & 0x00070000) >> 6);
             ((unsigned int *)obptr)[0] =
              ((rgb02 & 0x0f800000) >> 12) |
              ((rgb02 & 0x0003f000) >> 7) |
              ((rgb02 & 0x000000f8) >> 3) |
              ((rgb13 & 0x0f800000) << 4) |
              ((rgb13 & 0x0003f000) << 9) |
              ((rgb13 & 0x000000f8) << 13);
             rgb02 =
              ((g2r2b1g1 & 0xff0000) << 4) +
              ((g2r2b1g1 & 0xff000000) >> 14) +
              (b3g3r3b2 & 0xff) +
              dmp[(x + 2) & (DM_WIDTH - 1)];
             rgb02 += 0x10040100
              - ((rgb02 & 0x1e0001e0) >> 5)
              - ((rgb02 & 0x00070000) >> 6);
             rgb13 =
              ((b3g3r3b2 & 0xff00) << 12) +
              ((b3g3r3b2 & 0xff0000) >> 6) +
              ((b3g3r3b2 & 0xff000000) >> 24) +
              dmp[(x + 3) & (DM_WIDTH - 1)];
             rgb13 += 0x10040100
              - ((rgb13 & 0x1e0001e0) >> 5)
              - ((rgb13 & 0x00070000) >> 6);
             ((unsigned int *)obptr)[1] =
              ((rgb02 & 0x0f800000) >> 12) |
              ((rgb02 & 0x0003f000) >> 7) |
              ((rgb02 & 0x000000f8) >> 3) |
              ((rgb13 & 0x0f800000) << 4) |
              ((rgb13 & 0x0003f000) << 9) |
              ((rgb13 & 0x000000f8) << 13);
             bp2 += 12;
             obptr += 8;
           }
         for (; x < width; x++)
           {
             int rgb = *bp2++ << 20;
             rgb += *bp2++ << 10;
             rgb += *bp2++;
             rgb += dmp[x & (DM_WIDTH - 1)];
             rgb += 0x10040100
              - ((rgb & 0x1e0001e0) >> 5)
              - ((rgb & 0x00070000) >> 6);

             ((unsigned short *)obptr)[0] =
              ((rgb & 0x0f800000) >> 12) |
              ((rgb & 0x0003f000) >> 7) |
              ((rgb & 0x000000f8) >> 3);
             obptr += 2;
           }
       }
      bptr += rowstride;
      obuf += bpl;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void xlib_rgb_convert_565_gray ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  int x, y;
  unsigned char *obuf, *obptr;
  int bpl;
  unsigned char *bptr, *bp2;
  unsigned char g;

  bptr = buf;
  bpl = image->bytes_per_line;
  obuf = ((unsigned char *)image->data) + ay * bpl + ax * 2;
  for (y = 0; y < height; y++)
    {
      bp2 = bptr;
      obptr = obuf;
      if (((unsigned long)obuf | (unsigned long) bp2) & 3)
       {
         for (x = 0; x < width; x++)
           {
             g = *bp2++;
             ((unsigned short *)obptr)[0] = ((g & 0xf8) << 8) |
              ((g & 0xfc) << 3) |
              (g >> 3);
             obptr += 2;
           }
       }
      else
       {
         for (x = 0; x < width - 3; x += 4)
           {
             unsigned int g3g2g1g0;

             g3g2g1g0 = ((unsigned int *)bp2)[0];
             ((unsigned int *)obptr)[0] =
              ((g3g2g1g0 & 0xf8) << 8) |
              ((g3g2g1g0 & 0xfc) << 3) |
              ((g3g2g1g0 & 0xf8) >> 3) |
              (g3g2g1g0 & 0xf800) << 16 |
              ((g3g2g1g0 & 0xfc00) << 11) |
              ((g3g2g1g0 & 0xf800) << 5);
             ((unsigned int *)obptr)[1] =
              ((g3g2g1g0 & 0xf80000) >> 8) |
              ((g3g2g1g0 & 0xfc0000) >> 13) |
              ((g3g2g1g0 & 0xf80000) >> 19) |
              (g3g2g1g0 & 0xf8000000) |
              ((g3g2g1g0 & 0xfc000000) >> 5) |
              ((g3g2g1g0 & 0xf8000000) >> 11);
             bp2 += 4;
             obptr += 8;
           }
         for (; x < width; x++)
           {
             g = *bp2++;
             ((unsigned short *)obptr)[0] = ((g & 0xf8) << 8) |
              ((g & 0xfc) << 3) |
              (g >> 3);
             obptr += 2;
           }
       }
      bptr += rowstride;
      obuf += bpl;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void xlib_rgb_convert_8 ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  int x, y;
  int bpl;
  unsigned char *obuf, *obptr;
  unsigned char *bptr, *bp2;
  int r, g, b;

  bptr = buf;
  bpl = image->bytes_per_line;
  obuf = ((unsigned char *)image->data) + ay * bpl + ax;
  for (y = 0; y < height; y++)
    {
      bp2 = bptr;
      obptr = obuf;
      if (((unsigned long)obuf | (unsigned long) bp2) & 3)
       {
         for (x = 0; x < width; x++)
           {
             r = *bp2++;
             g = *bp2++;
             b = *bp2++;
             obptr[0] = colorcube[((r & 0xf0) << 4) |
                              (g & 0xf0) |
                              (b >> 4)];
             obptr++;
           }
       }
      else
       {
         for (x = 0; x < width - 3; x += 4)
           {
             unsigned int r1b0g0r0;
             unsigned int g2r2b1g1;
             unsigned int b3g3r3b2;

             r1b0g0r0 = ((unsigned int *)bp2)[0];
             g2r2b1g1 = ((unsigned int *)bp2)[1];
             b3g3r3b2 = ((unsigned int *)bp2)[2];
             ((unsigned int *)obptr)[0] =
              colorcube[((r1b0g0r0 & 0xf0) << 4) | 
                      ((r1b0g0r0 & 0xf000) >> 8) |
                      ((r1b0g0r0 & 0xf00000) >> 20)] |
              (colorcube[((r1b0g0r0 & 0xf0000000) >> 20) |
                       (g2r2b1g1 & 0xf0) |
                       ((g2r2b1g1 & 0xf000) >> 12)] << 8) |
              (colorcube[((g2r2b1g1 & 0xf00000) >> 12) |
                       ((g2r2b1g1 & 0xf0000000) >> 24) |
                       ((b3g3r3b2 & 0xf0) >> 4)] << 16) |
              (colorcube[((b3g3r3b2 & 0xf000) >> 4) |
                       ((b3g3r3b2 & 0xf00000) >> 16) |
                       (b3g3r3b2 >> 28)] << 24);
             bp2 += 12;
             obptr += 4;
           }
         for (; x < width; x++)
           {
             r = *bp2++;
             g = *bp2++;
             b = *bp2++;
             obptr[0] = colorcube[((r & 0xf0) << 4) |
                              (g & 0xf0) |
                              (b >> 4)];
             obptr++;
           }
       }
      bptr += rowstride;
      obuf += bpl;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void xlib_rgb_convert_8880_br ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  int x, y;
  unsigned char *obuf;
  int bpl;
  unsigned char *bptr, *bp2;
  int r, g, b;

  bptr = buf;
  bpl = image->bytes_per_line;
  obuf = ((unsigned char *)image->data) + ay * bpl + ax * 4;
  for (y = 0; y < height; y++)
    {
      bp2 = bptr;
      for (x = 0; x < width; x++)
       {
         r = bp2[0];
         g = bp2[1];
         b = bp2[2];
         ((unsigned int *)obuf)[x] = (b << 16) | (g << 8) | r;
         bp2 += 3;
       }
      bptr += rowstride;
      obuf += bpl;
    }
}

Here is the caller graph for this function:

static void xlib_rgb_convert_888_lsb ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  int x, y;
  unsigned char *obuf, *obptr;
  int bpl;
  unsigned char *bptr, *bp2;
  int r, g, b;

  bptr = buf;
  bpl = image->bytes_per_line;
  obuf = ((unsigned char *)image->data) + ay * bpl + ax * 3;
  for (y = 0; y < height; y++)
    {
      bp2 = bptr;
      obptr = obuf;
      if (((unsigned long)obuf | (unsigned long) bp2) & 3)
       {
         for (x = 0; x < width; x++)
           {
             r = bp2[0];
             g = bp2[1];
             b = bp2[2];
             *obptr++ = b;
             *obptr++ = g;
             *obptr++ = r;
             bp2 += 3;
           }
       }
      else
       {
         for (x = 0; x < width - 3; x += 4)
           {
             unsigned int r1b0g0r0;
             unsigned int g2r2b1g1;
             unsigned int b3g3r3b2;

             r1b0g0r0 = ((unsigned int *)bp2)[0];
             g2r2b1g1 = ((unsigned int *)bp2)[1];
             b3g3r3b2 = ((unsigned int *)bp2)[2];
             ((unsigned int *)obptr)[0] =
              (r1b0g0r0 & 0xff00) |
              ((r1b0g0r0 & 0xff0000) >> 16) |
              (((g2r2b1g1 & 0xff00) | (r1b0g0r0 & 0xff)) << 16);
             ((unsigned int *)obptr)[1] =
              (g2r2b1g1 & 0xff0000ff) |
              ((r1b0g0r0 & 0xff000000) >> 16) |
              ((b3g3r3b2 & 0xff) << 16);
             ((unsigned int *)obptr)[2] =
              (((g2r2b1g1 & 0xff0000) | (b3g3r3b2 & 0xff000000)) >> 16) |
              ((b3g3r3b2 & 0xff00) << 16) |
              ((b3g3r3b2 & 0xff0000));
             bp2 += 12;
             obptr += 12;
           }
         for (; x < width; x++)
           {
             r = bp2[0];
             g = bp2[1];
             b = bp2[2];
             *obptr++ = b;
             *obptr++ = g;
             *obptr++ = r;
             bp2 += 3;
           }
       }
      bptr += rowstride;
      obuf += bpl;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void xlib_rgb_convert_888_msb ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  int y;
  unsigned char *obuf;
  int bpl;
  unsigned char *bptr;

  bptr = buf;
  bpl = image->bytes_per_line;
  obuf = ((unsigned char *)image->data) + ay * bpl + ax * 3;
  for (y = 0; y < height; y++)
    {
      memcpy (obuf, bptr, (unsigned int)(width + width + width));
      bptr += rowstride;
      obuf += bpl;
    }
}

Here is the caller graph for this function:

static void xlib_rgb_convert_8_d ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  int x, y;
  int bpl;
  unsigned char *obuf, *obptr;
  unsigned char *bptr, *bp2;
  int r, g, b;
  const unsigned char *dmp;
  int dith;
  int rs, gs, bs;

  bptr = buf;
  bpl = image->bytes_per_line;
  rs = image_info->nred_shades - 1;
  gs = image_info->ngreen_shades - 1;
  bs = image_info->nblue_shades - 1;
  obuf = ((unsigned char *)image->data) + ay * bpl + ax;
  for (y = 0; y < height; y++)
    {
      dmp = DM[(y_align + y) & (DM_HEIGHT - 1)];
      bp2 = bptr;
      obptr = obuf;
      for (x = 0; x < width; x++)
       {
         r = *bp2++;
         g = *bp2++;
         b = *bp2++;
         dith = (dmp[(x_align + x) & (DM_WIDTH - 1)] << 2) | 7;
         r = ((r * rs) + dith) >> 8;
         g = ((g * gs) + (262 - dith)) >> 8;
         b = ((b * bs) + dith) >> 8;
         obptr[0] = colorcube_d[(r << 6) | (g << 3) | b];
         obptr++;
       }
      bptr += rowstride;
      obuf += bpl;
    }
}

Here is the caller graph for this function:

static void xlib_rgb_convert_8_d666 ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  int x, y;
  int bpl;
  unsigned char *obuf, *obptr;
  unsigned char *bptr, *bp2;
  int r, g, b;
  const unsigned char *dmp;
  int dith;

  bptr = buf;
  bpl = image->bytes_per_line;
  obuf = ((unsigned char *)image->data) + ay * bpl + ax;
  for (y = 0; y < height; y++)
    {
      dmp = DM[(y_align + y) & (DM_HEIGHT - 1)];
      bp2 = bptr;
      obptr = obuf;
      for (x = 0; x < width; x++)
       {
         r = *bp2++;
         g = *bp2++;
         b = *bp2++;
         dith = (dmp[(x_align + x) & (DM_WIDTH - 1)] << 2) | 7;
         r = ((r * 5) + dith) >> 8;
         g = ((g * 5) + (262 - dith)) >> 8;
         b = ((b * 5) + dith) >> 8;
         obptr[0] = colorcube_d[(r << 6) | (g << 3) | b];
         obptr++;
       }
      bptr += rowstride;
      obuf += bpl;
    }
}

Here is the caller graph for this function:

static void xlib_rgb_convert_8_indexed ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  int x, y;
  int bpl;
  unsigned char *obuf, *obptr;
  unsigned char *bptr, *bp2;
  unsigned char c;
  unsigned char *lut;

  lut = cmap->lut;
  bptr = buf;
  bpl = image->bytes_per_line;
  obuf = ((unsigned char *)image->data) + ay * bpl + ax;
  for (y = 0; y < height; y++)
    {
      bp2 = bptr;
      obptr = obuf;
      for (x = 0; x < width; x++)
       {
         c = *bp2++;
         obptr[0] = lut[c];
         obptr++;
       }
      bptr += rowstride;
      obuf += bpl;
    }
}

Here is the caller graph for this function:

static void xlib_rgb_convert_gray4 ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  int x, y;
  int bpl;
  unsigned char *obuf, *obptr;
  unsigned char *bptr, *bp2;
  int r, g, b;
  int shift;

  bptr = buf;
  bpl = image->bytes_per_line;
  obuf = ((unsigned char *)image->data) + ay * bpl + ax;
  shift = 9 - image_info->x_visual_info->depth;
  for (y = 0; y < height; y++)
    {
      bp2 = bptr;
      obptr = obuf;
      for (x = 0; x < width; x++)
       {
         r = *bp2++;
         g = *bp2++;
         b = *bp2++;
         obptr[0] = (g + ((b + r) >> 1)) >> shift;
         obptr++;
       }
      bptr += rowstride;
      obuf += bpl;
    }
}

Here is the caller graph for this function:

static void xlib_rgb_convert_gray4_d ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  int x, y;
  int bpl;
  unsigned char *obuf, *obptr;
  unsigned char *bptr, *bp2;
  int r, g, b;
  const unsigned char *dmp;
  int prec, right;
  int gray;

  bptr = buf;
  bpl = image->bytes_per_line;
  obuf = ((unsigned char *)image->data) + ay * bpl + ax;
  prec = image_info->x_visual_info->depth;
  right = 8 - prec;
  for (y = 0; y < height; y++)
    {
      bp2 = bptr;
      obptr = obuf;
      dmp = DM[(y_align + y) & (DM_HEIGHT - 1)];
      for (x = 0; x < width; x++)
       {
         r = *bp2++;
         g = *bp2++;
         b = *bp2++;
         gray = (g + ((b + r) >> 1)) >> 1;
         gray += (dmp[(x_align + x) & (DM_WIDTH - 1)] << 2) >> prec;
         obptr[0] = (gray - (gray >> prec)) >> right;
         obptr++;
       }
      bptr += rowstride;
      obuf += bpl;
    }
}

Here is the caller graph for this function:

static void xlib_rgb_convert_gray4_d_pack ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  int x, y;
  int bpl;
  unsigned char *obuf, *obptr;
  unsigned char *bptr, *bp2;
  int r, g, b;
  const unsigned char *dmp;
  int prec, right;
  int gray;
  unsigned char pix0, pix1;
  /* todo: this is hardcoded to big-endian. Make endian-agile. */

  bptr = buf;
  bpl = image->bytes_per_line;
  obuf = ((unsigned char *)image->data) + ay * bpl + (ax >> 1);
  prec = image_info->x_visual_info->depth;
  right = 8 - prec;
  for (y = 0; y < height; y++)
    {
      bp2 = bptr;
      obptr = obuf;
      dmp = DM[(y_align + y) & (DM_HEIGHT - 1)];
      for (x = 0; x < width; x += 2)
       {
         r = *bp2++;
         g = *bp2++;
         b = *bp2++;
         gray = (g + ((b + r) >> 1)) >> 1;
         gray += (dmp[(x_align + x) & (DM_WIDTH - 1)] << 2) >> prec;
         pix0 = (gray - (gray >> prec)) >> right;
         r = *bp2++;
         g = *bp2++;
         b = *bp2++;
         gray = (g + ((b + r) >> 1)) >> 1;
         gray += (dmp[(x_align + x + 1) & (DM_WIDTH - 1)] << 2) >> prec;
         pix1 = (gray - (gray >> prec)) >> right;
         obptr[0] = (pix0 << 4) | pix1;
         obptr++;
       }
      if (width & 1)
       {
         r = *bp2++;
         g = *bp2++;
         b = *bp2++;
         gray = (g + ((b + r) >> 1)) >> 1;
         gray += (dmp[(x_align + x + 1) & (DM_WIDTH - 1)] << 2) >> prec;
         pix0 = (gray - (gray >> prec)) >> right;
         obptr[0] = (pix0 << 4);
       }
      bptr += rowstride;
      obuf += bpl;
    }
}

Here is the caller graph for this function:

static void xlib_rgb_convert_gray4_pack ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  int x, y;
  int bpl;
  unsigned char *obuf, *obptr;
  unsigned char *bptr, *bp2;
  int r, g, b;
  int shift;
  unsigned char pix0, pix1;
  /* todo: this is hardcoded to big-endian. Make endian-agile. */

  bptr = buf;
  bpl = image->bytes_per_line;
  obuf = ((unsigned char *)image->data) + ay * bpl + (ax >> 1);
  shift = 9 - image_info->x_visual_info->depth;
  for (y = 0; y < height; y++)
    {
      bp2 = bptr;
      obptr = obuf;
      for (x = 0; x < width; x += 2)
       {
         r = *bp2++;
         g = *bp2++;
         b = *bp2++;
         pix0 = (g + ((b + r) >> 1)) >> shift;
         r = *bp2++;
         g = *bp2++;
         b = *bp2++;
         pix1 = (g + ((b + r) >> 1)) >> shift;
         obptr[0] = (pix0 << 4) | pix1;
         obptr++;
       }
      if (width & 1)
       {
         r = *bp2++;
         g = *bp2++;
         b = *bp2++;
         pix0 = (g + ((b + r) >> 1)) >> shift;
         obptr[0] = (pix0 << 4);
       }
      bptr += rowstride;
      obuf += bpl;
    }
}

Here is the caller graph for this function:

static void xlib_rgb_convert_gray8 ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  int x, y;
  int bpl;
  unsigned char *obuf, *obptr;
  unsigned char *bptr, *bp2;
  int r, g, b;

  bptr = buf;
  bpl = image->bytes_per_line;
  obuf = ((unsigned char *)image->data) + ay * bpl + ax;
  for (y = 0; y < height; y++)
    {
      bp2 = bptr;
      obptr = obuf;
      for (x = 0; x < width; x++)
       {
         r = *bp2++;
         g = *bp2++;
         b = *bp2++;
         obptr[0] = (g + ((b + r) >> 1)) >> 1;
         obptr++;
       }
      bptr += rowstride;
      obuf += bpl;
    }
}

Here is the caller graph for this function:

static void xlib_rgb_convert_gray8_gray ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  int y;
  int bpl;
  unsigned char *obuf;
  unsigned char *bptr;

  bptr = buf;
  bpl = image->bytes_per_line;
  obuf = ((unsigned char *)image->data) + ay * bpl + ax;
  for (y = 0; y < height; y++)
    {
      memcpy (obuf, bptr, (unsigned int)width);
      bptr += rowstride;
      obuf += bpl;
    }
}

Here is the caller graph for this function:

static void xlib_rgb_convert_gray_cmap ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  (*image_info->conv_indexed) (image, ax, ay, width, height,
                            buf, rowstride,
                            x_align, y_align, image_info->gray_cmap);
}

Here is the caller graph for this function:

static void xlib_rgb_convert_gray_generic ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  xlib_rgb_gray_to_stage (buf, rowstride, width, height);

  (*image_info->conv) (image, ax, ay, width, height,
                     image_info->stage_buf, STAGE_ROWSTRIDE,
                     x_align, y_align, cmap);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void xlib_rgb_convert_gray_generic_d ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  xlib_rgb_gray_to_stage (buf, rowstride, width, height);

  (*image_info->conv_d) (image, ax, ay, width, height,
                      image_info->stage_buf, STAGE_ROWSTRIDE,
                      x_align, y_align, cmap);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void xlib_rgb_convert_indexed_generic ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  xlib_rgb_indexed_to_stage (buf, rowstride, width, height, cmap);

  (*image_info->conv) (image, ax, ay, width, height,
                     image_info->stage_buf, STAGE_ROWSTRIDE,
                     x_align, y_align, cmap);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void xlib_rgb_convert_indexed_generic_d ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  xlib_rgb_indexed_to_stage (buf, rowstride, width, height, cmap);

  (*image_info->conv_d) (image, ax, ay, width, height,
                      image_info->stage_buf, STAGE_ROWSTRIDE,
                      x_align, y_align, cmap);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void xlib_rgb_convert_truecolor_lsb ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  int x, y;
  unsigned char *obuf, *obptr;
  int bpl;
  unsigned char *bptr, *bp2;
  int r, g, b;
  int r_right, r_left;
  int g_right, g_left;
  int b_right, b_left;
  int bpp;
  unsigned int pixel;
  int i;

  r_right = 8 - image_info->red_prec;
  r_left = image_info->red_shift;
  g_right = 8 - image_info->green_prec;
  g_left = image_info->green_shift;
  b_right = 8 - image_info->blue_prec;
  b_left = image_info->blue_shift;
  bpp = image_info->bpp;
  bptr = buf;
  bpl = image->bytes_per_line;
  obuf = ((unsigned char *)image->data) + ay * bpl + ax * bpp;
  for (y = 0; y < height; y++)
    {
      obptr = obuf;
      bp2 = bptr;
      for (x = 0; x < width; x++)
       {
         r = bp2[0];
         g = bp2[1];
         b = bp2[2];
         pixel = ((r >> r_right) << r_left) |
           ((g >> g_right) << g_left) |
           ((b >> b_right) << b_left);
         for (i = 0; i < bpp; i++)
           {
             *obptr++ = pixel & 0xff;
             pixel >>= 8;
           }
         bp2 += 3;
       }
      bptr += rowstride;
      obuf += bpl;
    }
}

Here is the caller graph for this function:

static void xlib_rgb_convert_truecolor_lsb_d ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  int x, y;
  unsigned char *obuf, *obptr;
  int bpl;
  unsigned char *bptr, *bp2;
  int r, g, b;
  int r_right, r_left, r_prec;
  int g_right, g_left, g_prec;
  int b_right, b_left, b_prec;
  int bpp;
  unsigned int pixel;
  int i;
  int dith;
  int r1, g1, b1;
  const unsigned char *dmp;

  r_right = 8 - image_info->red_prec;
  r_left = image_info->red_shift;
  r_prec = image_info->red_prec;
  g_right = 8 - image_info->green_prec;
  g_left = image_info->green_shift;
  g_prec = image_info->green_prec;
  b_right = 8 - image_info->blue_prec;
  b_left = image_info->blue_shift;
  b_prec = image_info->blue_prec;
  bpp = image_info->bpp;
  bptr = buf;
  bpl = image->bytes_per_line;
  obuf = ((unsigned char *)image->data) + ay * bpl + ax * bpp;
  for (y = 0; y < height; y++)
    {
      dmp = DM[(y_align + y) & (DM_HEIGHT - 1)];
      obptr = obuf;
      bp2 = bptr;
      for (x = 0; x < width; x++)
       {
         r = bp2[0];
         g = bp2[1];
         b = bp2[2];
         dith = dmp[(x_align + x) & (DM_WIDTH - 1)] << 2;
         r1 = r + (dith >> r_prec);
         g1 = g + ((252 - dith) >> g_prec);
         b1 = b + (dith >> b_prec);
         pixel = (((r1 - (r1 >> r_prec)) >> r_right) << r_left) |
           (((g1 - (g1 >> g_prec)) >> g_right) << g_left) |
           (((b1 - (b1 >> b_prec)) >> b_right) << b_left);
         for (i = 0; i < bpp; i++)
           {
             *obptr++ = pixel & 0xff;
             pixel >>= 8;
           }
         bp2 += 3;
       }
      bptr += rowstride;
      obuf += bpl;
    }
}

Here is the caller graph for this function:

static void xlib_rgb_convert_truecolor_msb ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  int x, y;
  unsigned char *obuf, *obptr;
  int bpl;
  unsigned char *bptr, *bp2;
  int r, g, b;
  int r_right, r_left;
  int g_right, g_left;
  int b_right, b_left;
  int bpp;
  unsigned int pixel;
  int shift, shift_init;

  r_right = 8 - image_info->red_prec;
  r_left = image_info->red_shift;
  g_right = 8 - image_info->green_prec;
  g_left = image_info->green_shift;
  b_right = 8 - image_info->blue_prec;
  b_left = image_info->blue_shift;
  bpp = image_info->bpp;
  bptr = buf;
  bpl = image->bytes_per_line;
  obuf = ((unsigned char *)image->data) + ay * bpl + ax * bpp;
  shift_init = (bpp - 1) << 3;
  for (y = 0; y < height; y++)
    {
      obptr = obuf;
      bp2 = bptr;
      for (x = 0; x < width; x++)
       {
         r = bp2[0];
         g = bp2[1];
         b = bp2[2];
         pixel = ((r >> r_right) << r_left) |
           ((g >> g_right) << g_left) |
           ((b >> b_right) << b_left);
         for (shift = shift_init; shift >= 0; shift -= 8)
           {
             *obptr++ = (pixel >> shift) & 0xff;
           }
         bp2 += 3;
       }
      bptr += rowstride;
      obuf += bpl;
    }
}

Here is the caller graph for this function:

static void xlib_rgb_convert_truecolor_msb_d ( XImage *  image,
int  ax,
int  ay,
int  width,
int  height,
unsigned char *  buf,
int  rowstride,
int  x_align,
int  y_align,
XlibRgbCmap *  cmap 
) [static]

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

{
  int x, y;
  unsigned char *obuf, *obptr;
  int bpl;
  unsigned char *bptr, *bp2;
  int r, g, b;
  int r_right, r_left, r_prec;
  int g_right, g_left, g_prec;
  int b_right, b_left, b_prec;
  int bpp;
  unsigned int pixel;
  int shift, shift_init;
  int dith;
  int r1, g1, b1;
  const unsigned char *dmp;

  r_right = 8 - image_info->red_prec;
  r_left = image_info->red_shift;
  r_prec = image_info->red_prec;
  g_right = 8 - image_info->green_prec;
  g_left = image_info->green_shift;
  g_prec = image_info->green_prec;
  b_right = 8 - image_info->blue_prec;
  b_left = image_info->blue_shift;
  b_prec = image_info->blue_prec;
  bpp = image_info->bpp;
  bptr = buf;
  bpl = image->bytes_per_line;
  obuf = ((unsigned char *)image->data) + ay * bpl + ax * bpp;
  shift_init = (bpp - 1) << 3;
  for (y = 0; y < height; y++)
    {
      dmp = DM[(y_align + y) & (DM_HEIGHT - 1)];
      obptr = obuf;
      bp2 = bptr;
      for (x = 0; x < width; x++)
       {
         r = bp2[0];
         g = bp2[1];
         b = bp2[2];
         dith = dmp[(x_align + x) & (DM_WIDTH - 1)] << 2;
         r1 = r + (dith >> r_prec);
         g1 = g + ((252 - dith) >> g_prec);
         b1 = b + (dith >> b_prec);
         pixel = (((r1 - (r1 >> r_prec)) >> r_right) << r_left) |
           (((g1 - (g1 >> g_prec)) >> g_right) << g_left) |
           (((b1 - (b1 >> b_prec)) >> b_right) << b_left);
         for (shift = shift_init; shift >= 0; shift -= 8)
           {
             *obptr++ = (pixel >> shift) & 0xff;
           }
         bp2 += 3;
       }
      bptr += rowstride;
      obuf += bpl;
    }
}

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);
}
static Bool xlib_rgb_do_colormaps ( void  ) [static]

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

{
  static const int sizes[][3] = {
    /*    { 6, 7, 6 }, */
    { 6, 6, 6 }, 
    { 6, 6, 5 }, 
    { 6, 6, 4 }, 
    { 5, 5, 5 }, 
    { 5, 5, 4 }, 
    { 4, 4, 4 }, 
    { 4, 4, 3 }, 
    { 3, 3, 3 }, 
    { 2, 2, 2 }
  };
  static const int n_sizes = sizeof(sizes) / (3 * sizeof(int));
  int i;
  
  for (i = 0; i < n_sizes; i++)
    if (xlib_rgb_try_colormap (sizes[i][0], sizes[i][1], sizes[i][2]))
      return TRUE;
  return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static unsigned char* xlib_rgb_ensure_stage ( void  ) [static]

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

{
  if (image_info->stage_buf == NULL)
    image_info->stage_buf = (unsigned char *) malloc (IMAGE_HEIGHT * STAGE_ROWSTRIDE);
  return image_info->stage_buf;
}

Here is the caller graph for this function:

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:

static void xlib_rgb_gray_to_stage ( unsigned char *  buf,
int  rowstride,
int  width,
int  height 
) [static]

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

{
  int x, y;
  unsigned char *pi_start, *po_start;
  unsigned char *pi, *po;
  unsigned char gray;

  pi_start = buf;
  po_start = xlib_rgb_ensure_stage ();
  for (y = 0; y < height; y++)
    {
      pi = pi_start;
      po = po_start;
      for (x = 0; x < width; x++)
       {
         gray = *pi++;
         *po++ = gray;
         *po++ = gray;
         *po++ = gray;
       }
      pi_start += rowstride;
      po_start += STAGE_ROWSTRIDE;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void xlib_rgb_indexed_to_stage ( unsigned char *  buf,
int  rowstride,
int  width,
int  height,
XlibRgbCmap *  cmap 
) [static]

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

{
  int x, y;
  unsigned char *pi_start, *po_start;
  unsigned char *pi, *po;
  int rgb;

  pi_start = buf;
  po_start = xlib_rgb_ensure_stage ();
  for (y = 0; y < height; y++)
    {
      pi = pi_start;
      po = po_start;
      for (x = 0; x < width; x++)
       {
         rgb = cmap->colors[*pi++];
         *po++ = rgb >> 16;
         *po++ = (rgb >> 8) & 0xff;
         *po++ = rgb & 0xff;
       }
      pi_start += rowstride;
      po_start += STAGE_ROWSTRIDE;
    }
}

Here is the call graph for this function:

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:

static void xlib_rgb_make_colorcube ( unsigned long pixels,
int  nr,
int  ng,
int  nb 
) [static]

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

{
  unsigned char rt[16], gt[16], bt[16];
  int i;

  colorcube = (unsigned char *) malloc(sizeof(unsigned char) * 4096);
  memset(colorcube, 0, (sizeof(unsigned char) * 4096));
  for (i = 0; i < 16; i++)
    {
      rt[i] = ng * nb * ((i * 17 * (nr - 1) + 128) >> 8);
      gt[i] = nb * ((i * 17 * (ng - 1) + 128) >> 8);
      bt[i] = ((i * 17 * (nb - 1) + 128) >> 8);
    }

  for (i = 0; i < 4096; i++)
    {
      colorcube[i] = pixels[rt[i >> 8] + gt[(i >> 4) & 0x0f] + bt[i & 0x0f]];
#ifdef VERBOSE
      printf ("%03x %02x %x %x %x\n", i, colorcube[i], rt[i >> 8], gt[(i >> 4) & 0x0f], bt[i & 0x0f]);
#endif
    }
}

Here is the caller graph for this function:

static void xlib_rgb_make_colorcube_d ( unsigned long pixels,
int  nr,
int  ng,
int  nb 
) [static]

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

{
  int r, g, b;
  int i;

  colorcube_d = (unsigned char *) malloc(sizeof(unsigned char) * 512);
  memset(colorcube_d, 0, (sizeof(unsigned char) * 512));
  for (i = 0; i < 512; i++)
    {
      r = MIN (nr - 1, i >> 6);
      g = MIN (ng - 1, (i >> 3) & 7);
      b = MIN (nb - 1, i & 7);
      colorcube_d[i] = pixels[(r * ng + g) * nb + b];
    }
}

Here is the caller graph for this function:

static void xlib_rgb_make_gray_cmap ( XlibRgbInfo *  info) [static]

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

{
  unsigned int rgb[256];
  int i;

  for (i = 0; i < 256; i++)
    rgb[i] = (i << 16)  | (i << 8) | i;
  info->gray_cmap = xlib_rgb_cmap_new (rgb, 256);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void xlib_rgb_preprocess_dm_565 ( void  ) [static]

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

{
  int i;
  unsigned int dith;

  if (DM_565 == NULL)
    {
      DM_565 = (unsigned int *) malloc(sizeof(unsigned int) * DM_WIDTH * DM_HEIGHT);
      for (i = 0; i < DM_WIDTH * DM_HEIGHT; i++)
       {
         dith = DM[0][i] >> 3;
         DM_565[i] = (dith << 20) | dith | (((7 - dith) >> 1) << 10);
#ifdef VERBOSE
         printf ("%i %x %x\n", i, dith, DM_565[i]);
#endif
       }
    }
}

Here is the caller graph for this function:

static unsigned int xlib_rgb_score_visual ( XVisualInfo *  visual) [static]

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

{
  unsigned int quality, speed, pseudo, sys;
  static const char* visual_names[] =
  {
    "static gray",
    "grayscale",
    "static color",
    "pseudo color",
    "true color",
    "direct color",
  };
  
  
  quality = 0;
  speed = 1;
  sys = 0;
  if (visual->class == TrueColor ||
      visual->class == DirectColor)
    {
      if (visual->depth == 24)
       {
         quality = 9;
         /* Should test for MSB visual here, and set speed if so. */
       }
      else if (visual->depth == 16)
       quality = 8;
      else if (visual->depth == 15)
       quality = 7;
      else if (visual->depth == 8)
       quality = 4;
    }
  else if (visual->class == PseudoColor ||
          visual->class == StaticColor)
    {
      if (visual->depth == 8)
       quality = 4;
      else if (visual->depth == 4)
       quality = 2;
      else if (visual->depth == 1)
       quality = 1;
    }
  else if (visual->class == StaticGray
#ifdef ENABLE_GRAYSCALE
          || visual->class == GrayScale
#endif
          )
    {
      if (visual->depth == 8)
       quality = 4;
      else if (visual->depth == 4)
       quality = 2;
      else if (visual->depth == 1)
       quality = 1;
    }

  if (quality == 0)
    return 0;

  sys = (visual->visualid == image_info->default_visualid->visualid);
  
  pseudo = (visual->class == PseudoColor || visual->class == TrueColor);

  if (xlib_rgb_verbose)
    printf ("Visual 0x%x, type = %s, depth = %d, %ld:%ld:%ld%s; score=%x\n",
           (int)visual->visualid,
           visual_names[visual->class],
           visual->depth,
           visual->red_mask,
           visual->green_mask,
           visual->blue_mask,
           sys ? " (system)" : "",
           (quality << 12) | (speed << 8) | (sys << 4) | pseudo);
  
  return (quality << 12) | (speed << 8) | (sys << 4) | pseudo;
}

Here is the caller graph for this function:

static void xlib_rgb_select_conv ( XImage *  image,
ByteOrder  byte_order 
) [static]

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

{
  int depth, byterev;
  int vtype; /* visual type */
  int bpp; /* bits per pixel - from the visual */
  unsigned int red_mask, green_mask, blue_mask;
  XlibRgbConvFunc conv, conv_d;
  XlibRgbConvFunc conv_32, conv_32_d;
  XlibRgbConvFunc conv_gray, conv_gray_d;
  XlibRgbConvFunc conv_indexed, conv_indexed_d;
  Bool mask_rgb, mask_bgr;

  depth = image_info->x_visual_info->depth;
  bpp = image->bits_per_pixel;
  if (xlib_rgb_verbose)
    printf ("Chose visual 0x%x, image bpp=%d, %s first\n",
           (int)image_info->x_visual_info->visual->visualid,
           bpp, byte_order == LSB_FIRST ? "lsb" : "msb");

#ifdef WORDS_BIGENDIAN
  byterev = (byte_order == LSB_FIRST);
#else
  byterev = (byte_order == MSB_FIRST);
#endif

  vtype = image_info->x_visual_info->class;
  if (vtype == DirectColor)
    vtype = TrueColor;

  red_mask = image_info->x_visual_info->red_mask;
  green_mask = image_info->x_visual_info->green_mask;
  blue_mask = image_info->x_visual_info->blue_mask;

  mask_rgb = red_mask == 0xff0000 && green_mask == 0xff00 && blue_mask == 0xff;
  mask_bgr = red_mask == 0xff && green_mask == 0xff00 && blue_mask == 0xff0000;

  conv = NULL;
  conv_d = NULL;

  conv_32 = xlib_rgb_convert_32_generic;
  conv_32_d = xlib_rgb_convert_32_generic_d;

  conv_gray = xlib_rgb_convert_gray_generic;
  conv_gray_d = xlib_rgb_convert_gray_generic_d;

  conv_indexed = xlib_rgb_convert_indexed_generic;
  conv_indexed_d = xlib_rgb_convert_indexed_generic_d;

  image_info->dith_default = FALSE;

  if (image_info->bitmap)
    conv = xlib_rgb_convert_1;
  else if (bpp == 16 && depth == 16 && !byterev &&
      red_mask == 0xf800 && green_mask == 0x7e0 && blue_mask == 0x1f)
    {
      conv = xlib_rgb_convert_565;
      conv_d = xlib_rgb_convert_565_d;
      conv_gray = xlib_rgb_convert_565_gray;
      xlib_rgb_preprocess_dm_565 ();
    }
  else if (bpp == 16 && depth == 16 &&
          vtype == TrueColor&& byterev &&
      red_mask == 0xf800 && green_mask == 0x7e0 && blue_mask == 0x1f)
    conv = xlib_rgb_convert_565_br;

  else if (bpp == 16 && depth == 15 &&
          vtype == TrueColor && !byterev &&
      red_mask == 0x7c00 && green_mask == 0x3e0 && blue_mask == 0x1f)
    conv = xlib_rgb_convert_555;

  else if (bpp == 16 && depth == 15 &&
          vtype == TrueColor && byterev &&
      red_mask == 0x7c00 && green_mask == 0x3e0 && blue_mask == 0x1f)
    conv = xlib_rgb_convert_555_br;

  /* I'm not 100% sure about the 24bpp tests - but testing will show*/
  else if (bpp == 24 && depth == 24 && vtype == TrueColor &&
          ((mask_rgb && byte_order == LSB_FIRST) ||
           (mask_bgr && byte_order == MSB_FIRST)))
    conv = xlib_rgb_convert_888_lsb;
  else if (bpp == 24 && depth == 24 && vtype == TrueColor &&
          ((mask_rgb && byte_order == MSB_FIRST) ||
           (mask_bgr && byte_order == LSB_FIRST)))
    conv = xlib_rgb_convert_888_msb;
#ifdef WORDS_BIGENDIAN
  else if (bpp == 32 && depth == 24 && vtype == TrueColor &&
          (mask_rgb && byte_order == LSB_FIRST))
    conv = xlib_rgb_convert_0888_br;
  else if (bpp == 32 && depth == 24 && vtype == TrueColor &&
          (mask_rgb && byte_order == MSB_FIRST))
    conv = xlib_rgb_convert_0888;
  else if (bpp == 32 && depth == 24 && vtype == TrueColor &&
          (mask_bgr && byte_order == MSB_FIRST))
    conv = xlib_rgb_convert_8880_br;
#else
  else if (bpp == 32 && depth == 24 && vtype == TrueColor &&
          (mask_rgb && byte_order == MSB_FIRST))
    conv = xlib_rgb_convert_0888_br;
  else if (bpp == 32 && (depth == 32 || depth == 24) && vtype == TrueColor &&
          (mask_rgb && byte_order == LSB_FIRST))
    conv = xlib_rgb_convert_0888;
  else if (bpp == 32 && depth == 24 && vtype == TrueColor &&
          (mask_bgr && byte_order == LSB_FIRST))
    conv = xlib_rgb_convert_8880_br;
#endif

  else if (vtype == TrueColor && byte_order == LSB_FIRST)
    {
      conv = xlib_rgb_convert_truecolor_lsb;
      conv_d = xlib_rgb_convert_truecolor_lsb_d;
    }
  else if (vtype == TrueColor && byte_order == MSB_FIRST)
    {
      conv = xlib_rgb_convert_truecolor_msb;
      conv_d = xlib_rgb_convert_truecolor_msb_d;
    }
  else if (bpp == 8 && depth == 8 && (vtype == PseudoColor
#ifdef ENABLE_GRAYSCALE
                                  || vtype == GrayScale
#endif
                                  ))
    {
      image_info->dith_default = TRUE;
      conv = xlib_rgb_convert_8;
      if (vtype != GrayScale)
       {
         if (image_info->nred_shades == 6 &&
             image_info->ngreen_shades == 6 &&
             image_info->nblue_shades == 6)
           conv_d = xlib_rgb_convert_8_d666;
         else
           conv_d = xlib_rgb_convert_8_d;
       }
      conv_indexed = xlib_rgb_convert_8_indexed;
      conv_gray = xlib_rgb_convert_gray_cmap;
    }
  else if (bpp == 8 && depth == 8 && (vtype == StaticGray
#ifdef not_ENABLE_GRAYSCALE
                                  || vtype == GrayScale
#endif
                                  ))
    {
      conv = xlib_rgb_convert_gray8;
      conv_gray = xlib_rgb_convert_gray8_gray;
    }
  else if (bpp == 8 && depth < 8 && depth >= 2 &&
          (vtype == StaticGray
           || vtype == GrayScale))
    {
      conv = xlib_rgb_convert_gray4;
      conv_d = xlib_rgb_convert_gray4_d;
    }
  else if (bpp == 8 && depth < 8 && depth >= 3)
    {
      conv = xlib_rgb_convert_4;
    }
  else if (bpp == 4 && depth <= 4 && depth >= 2 &&
          (vtype == StaticGray
           || vtype == GrayScale))
    {
      conv = xlib_rgb_convert_gray4_pack;
      conv_d = xlib_rgb_convert_gray4_d_pack;
    }

  if (conv_d == NULL)
    conv_d = conv;

  image_info->conv = conv;
  image_info->conv_d = conv_d;

  image_info->conv_32 = conv_32;
  image_info->conv_32_d = conv_32_d;

  image_info->conv_gray = conv_gray;
  image_info->conv_gray_d = conv_gray_d;

  image_info->conv_indexed = conv_indexed;
  image_info->conv_indexed_d = conv_indexed_d;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void xlib_rgb_set_gray_cmap ( Colormap  cmap) [static]

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

{
  int i;
  XColor color;
  int status;
  unsigned long pixels[256];
  int r, g, b, gray;

  for (i = 0; i < 256; i++)
    {
      color.pixel = i;
      color.red = i * 257;
      color.green = i * 257;
      color.blue = i * 257;
      status = XAllocColor(image_info->display, cmap, &color);
      pixels[i] = color.pixel;
#ifdef VERBOSE
      printf ("allocating pixel %d, %x %x %x, result %d\n",
              color.pixel, color.red, color.green, color.blue, status);
#endif
    }

  /* Now, we make fake colorcubes - we ultimately just use the pseudocolor
     methods. */

  colorcube = (unsigned char *) malloc(sizeof(unsigned char) * 4096);

  for (i = 0; i < 4096; i++)
    {
      r = (i >> 4) & 0xf0;
      r = r | r >> 4;
      g = i & 0xf0;
      g = g | g >> 4;
      b = (i << 4 & 0xf0);
      b = b | b >> 4;
      gray = (g + ((r + b) >> 1)) >> 1;
      colorcube[i] = pixels[gray];
    }
}

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;
}
static int xlib_rgb_try_colormap ( int  nr,
int  ng,
int  nb 
) [static]

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

{
  int r, g, b;
  int ri, gi, bi;
  int r0, g0, b0;
  Colormap     cmap;
  XVisualInfo *visual;
  XColor      *colors = NULL;
  XColor       color;
  unsigned long pixels[256];
  unsigned long junk[256];
  int i;
  int d2;
  unsigned int colors_needed;
  int idx;
  int best[256];

  if (nr * ng * nb < xlib_rgb_min_colors)
    return FALSE;

  if (image_info->cmap_alloced) {
    cmap = image_info->cmap;
    visual = image_info->x_visual_info;
  }
  else {
    cmap = image_info->default_colormap;
    visual = image_info->x_visual_info;
  }
  colors_needed = nr * ng * nb;
  for (i = 0; i < 256; i++)
    {
      best[i] = 192;
      pixels[i] = 256;
    }

#ifndef GAMMA
  if (!xlib_rgb_install_cmap) {
    /* go out and get the colors for this colormap. */
    colors = (XColor *) malloc(sizeof(XColor) * visual->colormap_size);
    for (i=0; i < visual->colormap_size; i++){
      colors[i].pixel = i;
    }
    XQueryColors (image_info->display,
                cmap,
                colors, visual->colormap_size);
    /* find color cube colors that are already present */
    for (i = 0; i < MIN (256, visual->colormap_size); i++)
      {
       r = colors[i].red >> 8;
       g = colors[i].green >> 8;
       b = colors[i].blue >> 8;
       ri = (r * (nr - 1) + 128) >> 8;
       gi = (g * (ng - 1) + 128) >> 8;
       bi = (b * (nb - 1) + 128) >> 8;
       r0 = ri * 255 / (nr - 1);
       g0 = gi * 255 / (ng - 1);
       b0 = bi * 255 / (nb - 1);
       idx = ((ri * nr) + gi) * nb + bi;
       d2 = (r - r0) * (r - r0) + (g - g0) * (g - g0) + (b - b0) * (b - b0);
       if (d2 < best[idx]) {
         if (pixels[idx] < 256)
           XFreeColors(image_info->display,
                     cmap,
                     pixels + idx,
                     1, 0);
         else
           colors_needed--;
         color.pixel = colors[i].pixel;
         color.red = colors[i].red;
         color.green = colors[i].green;
         color.blue = colors[i].blue;
         color.flags = 0;
         if (!XAllocColor(image_info->display, cmap, &color))
           return xlib_rgb_cmap_fail ("error allocating system color\n",
                                  cmap, pixels);
         pixels[idx] = color.pixel; /* which is almost certainly i */
         best[idx] = d2;
       }
      }
  }

#endif

  if (colors_needed)
    {
      if (!XAllocColorCells(image_info->display, cmap, 0, NULL, 0, junk, colors_needed))
       {
         char tmp_str[80];
         
         sprintf (tmp_str,
                 "%d %d %d colormap failed (in XAllocColorCells)\n",
                 nr, ng, nb);
         return xlib_rgb_cmap_fail (tmp_str, cmap, pixels);
       }
      XFreeColors(image_info->display, cmap, junk, (int)colors_needed, 0);
    }

  for (r = 0, i = 0; r < nr; r++)
    for (g = 0; g < ng; g++)
      for (b = 0; b < nb; b++, i++)
       {
         if (pixels[i] == 256)
           {
             color.red = r * 65535 / (nr - 1);
             color.green = g * 65535 / (ng - 1);
             color.blue = b * 65535 / (nb - 1);

#ifdef GAMMA
             color.red = 65535 * pow (color.red / 65535.0, 0.5);
             color.green = 65535 * pow (color.green / 65535.0, 0.5);
             color.blue = 65535 * pow (color.blue / 65535.0, 0.5);
#endif

             /* This should be a raw XAllocColor call */
             if (!XAllocColor(image_info->display, cmap, &color))
              {
                char tmp_str[80];

                sprintf (tmp_str, "%d %d %d colormap failed\n",
                        nr, ng, nb);
                return xlib_rgb_cmap_fail (tmp_str,
                                       cmap, pixels);
              }
             pixels[i] = color.pixel;
           }
#ifdef VERBOSE
         printf ("%d: %lx\n", i, pixels[i]);
#endif
       }

  image_info->nred_shades = nr;
  image_info->ngreen_shades = ng;
  image_info->nblue_shades = nb;
  xlib_rgb_make_colorcube (pixels, nr, ng, nb);
  xlib_rgb_make_colorcube_d (pixels, nr, ng, nb);
  if (colors)
    free(colors);
  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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:


Variable Documentation

unsigned char* colorcube [static]

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

unsigned char* colorcube_d [static]

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

const unsigned char DM[128][128] [static]

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

unsigned int* DM_565 = NULL [static]

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

int horiz_idx [static]

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

int horiz_y = IMAGE_HEIGHT [static]

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

XlibRgbInfo* image_info = NULL [static]

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

XImage* static_image[N_IMAGES] [static]

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

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

int tile_idx [static]

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

int tile_x = IMAGE_WIDTH [static]

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

int tile_y1 = IMAGE_HEIGHT [static]

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

int tile_y2 = IMAGE_HEIGHT [static]

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

int vert_idx [static]

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

int vert_x = IMAGE_WIDTH [static]

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

Bool xlib_rgb_install_cmap = FALSE [static]

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

int xlib_rgb_min_colors = 5 * 5 * 5 [static]

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

Bool xlib_rgb_verbose = FALSE [static]

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