karbon

gdk-pixbuf-xlibrgb.h

00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
00002  *
00003  * The contents of this file are subject to the Mozilla Public License
00004  * Version 1.1 (the "MPL"); you may not use this file except in
00005  * compliance with the MPL.  You may obtain a copy of the MPL at
00006  * http://www.mozilla.org/MPL/
00007  *
00008  * Software distributed under the MPL is distributed on an "AS IS" basis,
00009  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the MPL
00010  * for the specific language governing rights and limitations under the
00011  * MPL.
00012  *
00013  * Alternatively, the contents of this file may be used under the
00014  * terms of the GNU Library General Public License (the "LGPL"), in
00015  * which case the provisions of the LGPL are applicable instead of
00016  * those above.  If you wish to allow use of your version of this file
00017  * only under the terms of the LGPL and not to allow others to use
00018  * your version of this file under the MPL, indicate your decision by
00019  * deleting the provisions above and replace them with the notice and
00020  * other provisions required by the LGPL.  If you do not delete the
00021  * provisions above, a recipient may use your version of this file
00022  * under either the MPL or the LGPL.
00023  */
00024 
00025 /*
00026  * This code is derived from GdkRgb.
00027  * For more information on GdkRgb, see http://www.levien.com/gdkrgb/
00028  * Raph Levien <raph@acm.org>
00029  */
00030 
00031 /* Ported by Christopher Blizzard to Xlib.  With permission from the
00032  * original authors of this file, the contents of this file are also
00033  * redistributable under the terms of the Mozilla Public license.  For
00034  * information about the Mozilla Public License, please see the
00035  * license information at http://www.mozilla.org/MPL/
00036  */
00037 
00038 /* This code is copyright the following authors:
00039  * Raph Levien          <raph@acm.org>
00040  * Manish Singh         <manish@gtk.org>
00041  * Tim Janik            <timj@gtk.org>
00042  * Peter Mattis         <petm@xcf.berkeley.edu>
00043  * Spencer Kimball      <spencer@xcf.berkeley.edu>
00044  * Josh MacDonald       <jmacd@xcf.berkeley.edu>
00045  * Christopher Blizzard <blizzard@redhat.com>
00046  * Owen Taylor          <otaylor@redhat.com>
00047  * Shawn T. Amundson    <amundson@gtk.org>
00048 */
00049 
00050 
00051 #ifndef __XLIB_RGB_H__
00052 #define __XLIB_RGB_H__
00053 
00054 #ifdef __cplusplus
00055 extern "C" {
00056 #endif /* __cplusplus */
00057 
00058 #include <X11/Xlib.h>
00059 #include <X11/Xutil.h>
00060 #include <X11/Xos.h>
00061 #include <X11/Intrinsic.h>
00062 
00063 
00064 typedef struct _XlibRgbCmap XlibRgbCmap;
00065 
00066 struct _XlibRgbCmap {
00067   unsigned int colors[256];
00068   unsigned char lut[256]; /* for 8-bit modes */
00069 };
00070 
00071 void
00072 xlib_rgb_init (Display *display, Screen *screen);
00073 void
00074 xlib_rgb_init_with_depth (Display *display, Screen *screen, int prefDepth);
00075 
00076 unsigned long
00077 xlib_rgb_xpixel_from_rgb (unsigned int rgb);
00078 
00079 void
00080 xlib_rgb_gc_set_foreground (GC gc, unsigned int rgb);
00081 
00082 void
00083 xlib_rgb_gc_set_background (GC gc, unsigned int rgb);
00084 
00085 typedef enum
00086 {
00087   XLIB_RGB_DITHER_NONE,
00088   XLIB_RGB_DITHER_NORMAL,
00089   XLIB_RGB_DITHER_MAX
00090 } XlibRgbDither;
00091 
00092 void
00093 xlib_draw_rgb_image (Drawable drawable,
00094              GC gc,
00095              int x,
00096              int y,
00097              int width,
00098              int height,
00099              XlibRgbDither dith,
00100              unsigned char *rgb_buf,
00101              int rowstride);
00102 
00103 void
00104 xlib_draw_rgb_image_dithalign (Drawable drawable,
00105                    GC gc,
00106                    int x,
00107                    int y,
00108                    int width,
00109                    int height,
00110                    XlibRgbDither dith,
00111                    unsigned char *rgb_buf,
00112                    int rowstride,
00113                    int xdith,
00114                    int ydith);
00115 
00116 void
00117 xlib_draw_rgb_32_image (Drawable drawable,
00118             GC gc,
00119             int x,
00120             int y,
00121             int width,
00122             int height,
00123             XlibRgbDither dith,
00124             unsigned char *buf,
00125             int rowstride);
00126 
00127 void
00128 xlib_draw_gray_image (Drawable drawable,
00129               GC gc,
00130               int x,
00131               int y,
00132               int width,
00133               int height,
00134               XlibRgbDither dith,
00135               unsigned char *buf,
00136               int rowstride);
00137 
00138 XlibRgbCmap *
00139 xlib_rgb_cmap_new (unsigned int *colors, int n_colors);
00140 
00141 void
00142 xlib_rgb_cmap_free (XlibRgbCmap *cmap);
00143 
00144 void
00145 xlib_draw_indexed_image (Drawable drawable,
00146                          GC gc,
00147                          int x,
00148                          int y,
00149                          int width,
00150                          int height,
00151                          XlibRgbDither dith,
00152                          unsigned char *buf,
00153                          int rowstride,
00154                          XlibRgbCmap *cmap);
00155 
00156 /* Below are some functions which are primarily useful for debugging
00157    and experimentation. */
00158 Bool
00159 xlib_rgb_ditherable (void);
00160 
00161 void
00162 xlib_rgb_set_verbose (Bool verbose);
00163 
00164 /* experimental colormap stuff */
00165 void
00166 xlib_rgb_set_install (Bool install);
00167 
00168 void
00169 xlib_rgb_set_min_colors (int min_colors);
00170 
00171 Colormap
00172 xlib_rgb_get_cmap (void);
00173 
00174 Visual *
00175 xlib_rgb_get_visual (void);
00176 
00177 XVisualInfo *
00178 xlib_rgb_get_visual_info (void);
00179 
00180 int
00181 xlib_rgb_get_depth (void);
00182 
00183 Display *
00184 xlib_rgb_get_display (void);
00185 
00186 Screen *
00187 xlib_rgb_get_screen (void);
00188 
00189 #ifdef __cplusplus
00190 }
00191 #endif /* __cplusplus */
00192 
00193 
00194 #endif /* __XLIB_RGB_H__ */
KDE Home | KDE Accessibility Home | Description of Access Keys