gdk-pixbuf-xlibrgb.h
1/*
2 *
3 * The contents of this file are subject to the Mozilla Public License
4 * Version 1.1 (the "MPL"); you may not use this file except in
5 * compliance with the MPL. You may obtain a copy of the MPL at
6 * http://www.mozilla.org/MPL/
7 *
8 * Software distributed under the MPL is distributed on an "AS IS" basis,
9 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the MPL
10 * for the specific language governing rights and limitations under the
11 * MPL.
12 *
13 * Alternatively, the contents of this file may be used under the
14 * terms of the GNU Library General Public License (the "LGPL"), in
15 * which case the provisions of the LGPL are applicable instead of
16 * those above. If you wish to allow use of your version of this file
17 * only under the terms of the LGPL and not to allow others to use
18 * your version of this file under the MPL, indicate your decision by
19 * deleting the provisions above and replace them with the notice and
20 * other provisions required by the LGPL. If you do not delete the
21 * provisions above, a recipient may use your version of this file
22 * under either the MPL or the LGPL.
23 */
24
25/*
26 * This code is derived from GdkRgb.
27 * For more information on GdkRgb, see http://www.levien.com/gdkrgb/
28 * Raph Levien <raph@acm.org>
29 */
30
31/* Ported by Christopher Blizzard to Xlib. With permission from the
32 * original authors of this file, the contents of this file are also
33 * redistributable under the terms of the Mozilla Public license. For
34 * information about the Mozilla Public License, please see the
35 * license information at http://www.mozilla.org/MPL/
36 */
37
38/* This code is copyright the following authors:
39 * Raph Levien <raph@acm.org>
40 * Manish Singh <manish@gtk.org>
41 * Tim Janik <timj@gtk.org>
42 * Peter Mattis <petm@xcf.berkeley.edu>
43 * Spencer Kimball <spencer@xcf.berkeley.edu>
44 * Josh MacDonald <jmacd@xcf.berkeley.edu>
45 * Christopher Blizzard <blizzard@redhat.com>
46 * Owen Taylor <otaylor@redhat.com>
47 * Shawn T. Amundson <amundson@gtk.org>
48*/
49
50
51#ifndef __XLIB_RGB_H__
52#define __XLIB_RGB_H__
53
54#ifdef __cplusplus
55extern "C" {
56#endif /* __cplusplus */
57
58#include <X11/Xlib.h>
59#include <X11/Xutil.h>
60#include <X11/Xos.h>
61#include <X11/Intrinsic.h>
62
63
64typedef struct _XlibRgbCmap XlibRgbCmap;
65
66struct _XlibRgbCmap {
67 unsigned int colors[256];
68 unsigned char lut[256]; /* for 8-bit modes */
69};
70
71void
72xlib_rgb_init (Display *display, Screen *screen);
73void
74xlib_rgb_init_with_depth (Display *display, Screen *screen, int prefDepth);
75
76unsigned long
77xlib_rgb_xpixel_from_rgb (unsigned int rgb);
78
79void
80xlib_rgb_gc_set_foreground (GC gc, unsigned int rgb);
81
82void
83xlib_rgb_gc_set_background (GC gc, unsigned int rgb);
84
85typedef enum
86{
87 XLIB_RGB_DITHER_NONE,
88 XLIB_RGB_DITHER_NORMAL,
89 XLIB_RGB_DITHER_MAX
90} XlibRgbDither;
91
92void
93xlib_draw_rgb_image (Drawable drawable,
94 GC gc,
95 int x,
96 int y,
97 int width,
98 int height,
99 XlibRgbDither dith,
100 unsigned char *rgb_buf,
101 int rowstride);
102
103void
104xlib_draw_rgb_image_dithalign (Drawable drawable,
105 GC gc,
106 int x,
107 int y,
108 int width,
109 int height,
110 XlibRgbDither dith,
111 unsigned char *rgb_buf,
112 int rowstride,
113 int xdith,
114 int ydith);
115
116void
117xlib_draw_rgb_32_image (Drawable drawable,
118 GC gc,
119 int x,
120 int y,
121 int width,
122 int height,
123 XlibRgbDither dith,
124 unsigned char *buf,
125 int rowstride);
126
127void
128xlib_draw_gray_image (Drawable drawable,
129 GC gc,
130 int x,
131 int y,
132 int width,
133 int height,
134 XlibRgbDither dith,
135 unsigned char *buf,
136 int rowstride);
137
138XlibRgbCmap *
139xlib_rgb_cmap_new (unsigned int *colors, int n_colors);
140
141void
142xlib_rgb_cmap_free (XlibRgbCmap *cmap);
143
144void
145xlib_draw_indexed_image (Drawable drawable,
146 GC gc,
147 int x,
148 int y,
149 int width,
150 int height,
151 XlibRgbDither dith,
152 unsigned char *buf,
153 int rowstride,
154 XlibRgbCmap *cmap);
155
156/* Below are some functions which are primarily useful for debugging
157 and experimentation. */
158Bool
159xlib_rgb_ditherable (void);
160
161void
162xlib_rgb_set_verbose (Bool verbose);
163
164/* experimental colormap stuff */
165void
166xlib_rgb_set_install (Bool install);
167
168void
169xlib_rgb_set_min_colors (int min_colors);
170
171Colormap
172xlib_rgb_get_cmap (void);
173
174Visual *
175xlib_rgb_get_visual (void);
176
177XVisualInfo *
178xlib_rgb_get_visual_info (void);
179
180int
181xlib_rgb_get_depth (void);
182
183Display *
184xlib_rgb_get_display (void);
185
186Screen *
187xlib_rgb_get_screen (void);
188
189#ifdef __cplusplus
190}
191#endif /* __cplusplus */
192
193
194#endif /* __XLIB_RGB_H__ */