]> Pileus Git - ~andy/gtk/blob - contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlibrgb.h
gdk-pixbuf-xlib.h use G_BEGIN/END_DECLS.
[~andy/gtk] / contrib / gdk-pixbuf-xlib / gdk-pixbuf-xlibrgb.h
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
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 #include <glib.h>
55
56 G_BEGIN_DECLS
57
58 #include <X11/Xlib.h>
59 #include <X11/Xutil.h>
60
61 typedef struct _XlibRgbCmap XlibRgbCmap;
62
63 struct _XlibRgbCmap {
64   unsigned int colors[256];
65   unsigned char lut[256]; /* for 8-bit modes */
66 };
67
68 void
69 xlib_rgb_init (Display *display, Screen *screen);
70 void
71 xlib_rgb_init_with_depth (Display *display, Screen *screen, int prefDepth);
72
73 unsigned long
74 xlib_rgb_xpixel_from_rgb (guint32 rgb);
75
76 void
77 xlib_rgb_gc_set_foreground (GC gc, guint32 rgb);
78
79 void
80 xlib_rgb_gc_set_background (GC gc, guint32 rgb);
81
82 typedef enum
83 {
84   XLIB_RGB_DITHER_NONE,
85   XLIB_RGB_DITHER_NORMAL,
86   XLIB_RGB_DITHER_MAX
87 } XlibRgbDither;
88
89 void
90 xlib_draw_rgb_image (Drawable drawable,
91                      GC gc,
92                      int x,
93                      int y,
94                      int width,
95                      int height,
96                      XlibRgbDither dith,
97                      unsigned char *rgb_buf,
98                      int rowstride);
99
100 void
101 xlib_draw_rgb_image_dithalign (Drawable drawable,
102                                GC gc,
103                                int x,
104                                int y,
105                                int width,
106                                int height,
107                                XlibRgbDither dith,
108                                unsigned char *rgb_buf,
109                                int rowstride,
110                                int xdith,
111                                int ydith);
112
113 void
114 xlib_draw_rgb_32_image (Drawable drawable,
115                         GC gc,
116                         int x,
117                         int y,
118                         int width,
119                         int height,
120                         XlibRgbDither dith,
121                         unsigned char *buf,
122                         int rowstride);
123
124 void
125 xlib_draw_gray_image (Drawable drawable,
126                       GC gc,
127                       int x,
128                       int y,
129                       int width,
130                       int height,
131                       XlibRgbDither dith,
132                       unsigned char *buf,
133                       int rowstride);
134
135 XlibRgbCmap *
136 xlib_rgb_cmap_new (guint32 *colors, int n_colors);
137
138 void
139 xlib_rgb_cmap_free (XlibRgbCmap *cmap);
140
141 void
142 xlib_draw_indexed_image (Drawable drawable,
143                          GC gc,
144                          int x,
145                          int y,
146                          int width,
147                          int height,
148                          XlibRgbDither dith,
149                          unsigned char *buf,
150                          int rowstride,
151                          XlibRgbCmap *cmap);
152
153 /* Below are some functions which are primarily useful for debugging
154    and experimentation. */
155 Bool
156 xlib_rgb_ditherable (void);
157
158 void
159 xlib_rgb_set_verbose (Bool verbose);
160
161 /* experimental colormap stuff */
162 void
163 xlib_rgb_set_install (Bool install);
164
165 void
166 xlib_rgb_set_min_colors (int min_colors);
167
168 Colormap
169 xlib_rgb_get_cmap (void);
170
171 Visual *
172 xlib_rgb_get_visual (void);
173
174 XVisualInfo *
175 xlib_rgb_get_visual_info (void);
176
177 int
178 xlib_rgb_get_depth (void);
179
180 Display *
181 xlib_rgb_get_display (void);
182
183 Screen *
184 xlib_rgb_get_screen (void);
185
186 G_END_DECLS
187
188 #endif /* __XLIB_RGB_H__ */