Logo Search packages:      
Sourcecode: pan version File versions

G_BEGIN_DECLS GdkPixbuf* pan_gdk_pixbuf_create_from_x_face ( GdkColormap *  cmap,
GdkDrawable *  drawable,
const char *  text 
)

end uncompface.c

Definition at line 1168 of file xface.c.

{
  int status;
  char xface [2048];
  GdkPixbuf * pixbuf = 0;
  
  g_strlcpy (xface, text, sizeof(xface));
  status = uncompface (xface);
  if (status >= 0)
  {
    GdkPixmap * pixmap;
    GdkColor black, white;
    int i;
    char *bits, *bp;
    const char *p;

    /* the compface library exports char F[], which uses a single
       byte per pixel to represent a 48x48 bitmap.  Yuck.
       This loop written by Andy Piper. */
    bp = bits = g_newa (char, PIXELS/8);
    for (i=0, p=F; i<(PIXELS/8); ++i)
    {
      int n, b;
      /* reverse the bit order of each byte... */
      for (b=n=0; b<8; ++b)
        n |= ((*p++) << b);
      n = ~n;
      *bp++ = (char) n;
    }

    if (!cmap)
      cmap = gdk_colormap_get_system ();
    gdk_color_black (cmap, &black);
    gdk_color_white (cmap, &white);

    pixmap = gdk_pixmap_create_from_data (drawable, bits, WIDTH, HEIGHT, -1, &white, &black);
    pixbuf = gdk_pixbuf_get_from_drawable (NULL, pixmap, cmap, 0, 0, 0, 0, WIDTH, HEIGHT);
    gdk_bitmap_unref (pixmap);
  }

  return pixbuf;
}


Generated by  Doxygen 1.6.0   Back to index