Back to index

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