Blame contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlibrgb.h

Packit a4058c
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
Packit a4058c
 *
Packit a4058c
 * The contents of this file are subject to the Mozilla Public License
Packit a4058c
 * Version 1.1 (the "MPL"); you may not use this file except in
Packit a4058c
 * compliance with the MPL.  You may obtain a copy of the MPL at
Packit a4058c
 * http://www.mozilla.org/MPL/
Packit a4058c
 *
Packit a4058c
 * Software distributed under the MPL is distributed on an "AS IS" basis,
Packit a4058c
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the MPL
Packit a4058c
 * for the specific language governing rights and limitations under the
Packit a4058c
 * MPL.
Packit a4058c
 *
Packit a4058c
 * Alternatively, the contents of this file may be used under the
Packit a4058c
 * terms of the GNU Library General Public License (the "LGPL"), in
Packit a4058c
 * which case the provisions of the LGPL are applicable instead of
Packit a4058c
 * those above.  If you wish to allow use of your version of this file
Packit a4058c
 * only under the terms of the LGPL and not to allow others to use
Packit a4058c
 * your version of this file under the MPL, indicate your decision by
Packit a4058c
 * deleting the provisions above and replace them with the notice and
Packit a4058c
 * other provisions required by the LGPL.  If you do not delete the
Packit a4058c
 * provisions above, a recipient may use your version of this file
Packit a4058c
 * under either the MPL or the LGPL.
Packit a4058c
 */
Packit a4058c
Packit a4058c
/*
Packit a4058c
 * This code is derived from GdkRgb.
Packit a4058c
 * For more information on GdkRgb, see http://www.levien.com/gdkrgb/
Packit a4058c
 * Raph Levien <raph@acm.org>
Packit a4058c
 */
Packit a4058c
Packit a4058c
/* Ported by Christopher Blizzard to Xlib.  With permission from the
Packit a4058c
 * original authors of this file, the contents of this file are also
Packit a4058c
 * redistributable under the terms of the Mozilla Public license.  For
Packit a4058c
 * information about the Mozilla Public License, please see the
Packit a4058c
 * license information at http://www.mozilla.org/MPL/
Packit a4058c
 */
Packit a4058c
Packit a4058c
/* This code is copyright the following authors:
Packit a4058c
 * Raph Levien          <raph@acm.org>
Packit a4058c
 * Manish Singh         <manish@gtk.org>
Packit a4058c
 * Tim Janik            <timj@gtk.org>
Packit a4058c
 * Peter Mattis         <petm@xcf.berkeley.edu>
Packit a4058c
 * Spencer Kimball      <spencer@xcf.berkeley.edu>
Packit a4058c
 * Josh MacDonald       <jmacd@xcf.berkeley.edu>
Packit a4058c
 * Christopher Blizzard <blizzard@redhat.com>
Packit a4058c
 * Owen Taylor          <otaylor@redhat.com>
Packit a4058c
 * Shawn T. Amundson    <amundson@gtk.org>
Packit a4058c
*/
Packit a4058c
Packit a4058c
Packit a4058c
#ifndef __XLIB_RGB_H__
Packit a4058c
#define __XLIB_RGB_H__
Packit a4058c
Packit a4058c
#include <gdk-pixbuf/gdk-pixbuf.h>
Packit a4058c
Packit a4058c
G_BEGIN_DECLS
Packit a4058c
Packit a4058c
#include <X11/Xlib.h>
Packit a4058c
#include <X11/Xutil.h>
Packit a4058c
Packit a4058c
/**
Packit a4058c
 * XlibRgbCmap:
Packit a4058c
 * @colors: FIXME.
Packit a4058c
 * @lut: FIXME.
Packit a4058c
 * 
Packit a4058c
 *     FIXME: Describe this.
Packit a4058c
 */
Packit a4058c
typedef struct _XlibRgbCmap XlibRgbCmap;
Packit a4058c
struct _XlibRgbCmap {
Packit a4058c
  unsigned int colors[256];
Packit a4058c
  unsigned char lut[256]; /* for 8-bit modes */
Packit a4058c
};
Packit a4058c
Packit a4058c
_GDK_PIXBUF_EXTERN
Packit a4058c
void
Packit a4058c
xlib_rgb_init (Display *display, Screen *screen);
Packit a4058c
_GDK_PIXBUF_EXTERN
Packit a4058c
void
Packit a4058c
xlib_rgb_init_with_depth (Display *display, Screen *screen, int prefDepth);
Packit a4058c
Packit a4058c
_GDK_PIXBUF_EXTERN
Packit a4058c
unsigned long
Packit a4058c
xlib_rgb_xpixel_from_rgb (guint32 rgb);
Packit a4058c
Packit a4058c
_GDK_PIXBUF_EXTERN
Packit a4058c
void
Packit a4058c
xlib_rgb_gc_set_foreground (GC gc, guint32 rgb);
Packit a4058c
Packit a4058c
_GDK_PIXBUF_EXTERN
Packit a4058c
void
Packit a4058c
xlib_rgb_gc_set_background (GC gc, guint32 rgb);
Packit a4058c
Packit a4058c
/**
Packit a4058c
 * XlibRgbDither:
Packit a4058c
 * @XLIB_RGB_DITHER_NONE: Specifies no dithering.
Packit a4058c
 * @XLIB_RGB_DITHER_NORMAL: Specifies dithering only on pseudocolor
Packit a4058c
 *  displays.
Packit a4058c
 * @XLIB_RGB_DITHER_MAX: Specifies dithering on high color displays.
Packit a4058c
 * 
Packit a4058c
 * These values are used to specify which dithering method should be
Packit a4058c
 * used.  <symbol>XLIB_RGB_DITHER_NONE</symbol> will use no dithering
Packit a4058c
 * and simply map the colors in an RGB buffer to the closest colors
Packit a4058c
 * that the display can provide.
Packit a4058c
 * <symbol>XLIB_RGB_DITHER_NORMAL</symbol> will provide dithering
Packit a4058c
 * only on pseudocolor displays.
Packit a4058c
 * <symbol>XLIB_RGB_DITHER_MAX</symbol> will provide dithering on
Packit a4058c
 * pseudocolor and 16-bit truecolor or “high color”
Packit a4058c
 * displays.
Packit a4058c
 */
Packit a4058c
typedef enum
Packit a4058c
{
Packit a4058c
  XLIB_RGB_DITHER_NONE,
Packit a4058c
  XLIB_RGB_DITHER_NORMAL,
Packit a4058c
  XLIB_RGB_DITHER_MAX
Packit a4058c
} XlibRgbDither;
Packit a4058c
Packit a4058c
_GDK_PIXBUF_EXTERN
Packit a4058c
void
Packit a4058c
xlib_draw_rgb_image (Drawable drawable,
Packit a4058c
		     GC gc,
Packit a4058c
		     int x,
Packit a4058c
		     int y,
Packit a4058c
		     int width,
Packit a4058c
		     int height,
Packit a4058c
		     XlibRgbDither dith,
Packit a4058c
		     unsigned char *rgb_buf,
Packit a4058c
		     int rowstride);
Packit a4058c
Packit a4058c
_GDK_PIXBUF_EXTERN
Packit a4058c
void
Packit a4058c
xlib_draw_rgb_image_dithalign (Drawable drawable,
Packit a4058c
			       GC gc,
Packit a4058c
			       int x,
Packit a4058c
			       int y,
Packit a4058c
			       int width,
Packit a4058c
			       int height,
Packit a4058c
			       XlibRgbDither dith,
Packit a4058c
			       unsigned char *rgb_buf,
Packit a4058c
			       int rowstride,
Packit a4058c
			       int xdith,
Packit a4058c
			       int ydith);
Packit a4058c
Packit a4058c
_GDK_PIXBUF_EXTERN
Packit a4058c
void
Packit a4058c
xlib_draw_rgb_32_image (Drawable drawable,
Packit a4058c
			GC gc,
Packit a4058c
			int x,
Packit a4058c
			int y,
Packit a4058c
			int width,
Packit a4058c
			int height,
Packit a4058c
			XlibRgbDither dith,
Packit a4058c
			unsigned char *buf,
Packit a4058c
			int rowstride);
Packit a4058c
Packit a4058c
_GDK_PIXBUF_EXTERN
Packit a4058c
void
Packit a4058c
xlib_draw_gray_image (Drawable drawable,
Packit a4058c
		      GC gc,
Packit a4058c
		      int x,
Packit a4058c
		      int y,
Packit a4058c
		      int width,
Packit a4058c
		      int height,
Packit a4058c
		      XlibRgbDither dith,
Packit a4058c
		      unsigned char *buf,
Packit a4058c
		      int rowstride);
Packit a4058c
Packit a4058c
_GDK_PIXBUF_EXTERN
Packit a4058c
XlibRgbCmap *
Packit a4058c
xlib_rgb_cmap_new (guint32 *colors, int n_colors);
Packit a4058c
Packit a4058c
_GDK_PIXBUF_EXTERN
Packit a4058c
void
Packit a4058c
xlib_rgb_cmap_free (XlibRgbCmap *cmap);
Packit a4058c
Packit a4058c
_GDK_PIXBUF_EXTERN
Packit a4058c
void
Packit a4058c
xlib_draw_indexed_image (Drawable drawable,
Packit a4058c
                         GC gc,
Packit a4058c
                         int x,
Packit a4058c
                         int y,
Packit a4058c
                         int width,
Packit a4058c
                         int height,
Packit a4058c
                         XlibRgbDither dith,
Packit a4058c
                         unsigned char *buf,
Packit a4058c
                         int rowstride,
Packit a4058c
                         XlibRgbCmap *cmap);
Packit a4058c
Packit a4058c
/* Below are some functions which are primarily useful for debugging
Packit a4058c
   and experimentation. */
Packit a4058c
_GDK_PIXBUF_EXTERN
Packit a4058c
Bool
Packit a4058c
xlib_rgb_ditherable (void);
Packit a4058c
Packit a4058c
_GDK_PIXBUF_EXTERN
Packit a4058c
void
Packit a4058c
xlib_rgb_set_verbose (Bool verbose);
Packit a4058c
Packit a4058c
/* experimental colormap stuff */
Packit a4058c
_GDK_PIXBUF_EXTERN
Packit a4058c
void
Packit a4058c
xlib_rgb_set_install (Bool install);
Packit a4058c
Packit a4058c
_GDK_PIXBUF_EXTERN
Packit a4058c
void
Packit a4058c
xlib_rgb_set_min_colors (int min_colors);
Packit a4058c
Packit a4058c
_GDK_PIXBUF_EXTERN
Packit a4058c
Colormap
Packit a4058c
xlib_rgb_get_cmap (void);
Packit a4058c
Packit a4058c
_GDK_PIXBUF_EXTERN
Packit a4058c
Visual *
Packit a4058c
xlib_rgb_get_visual (void);
Packit a4058c
Packit a4058c
_GDK_PIXBUF_EXTERN
Packit a4058c
XVisualInfo *
Packit a4058c
xlib_rgb_get_visual_info (void);
Packit a4058c
Packit a4058c
_GDK_PIXBUF_EXTERN
Packit a4058c
int
Packit a4058c
xlib_rgb_get_depth (void);
Packit a4058c
Packit a4058c
_GDK_PIXBUF_EXTERN
Packit a4058c
Display *
Packit a4058c
xlib_rgb_get_display (void);
Packit a4058c
Packit a4058c
_GDK_PIXBUF_EXTERN
Packit a4058c
Screen *
Packit a4058c
xlib_rgb_get_screen (void);
Packit a4058c
Packit a4058c
G_END_DECLS
Packit a4058c
Packit a4058c
#endif /* __XLIB_RGB_H__ */