Blame contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib.c

Packit a4058c
/* GdkPixbuf library - Initialization functions
Packit a4058c
 *
Packit a4058c
 * Author: John Harper <john@dcs.warwick.ac.uk>
Packit a4058c
 *
Packit a4058c
 * This library is free software; you can redistribute it and/or
Packit a4058c
 * modify it under the terms of the GNU Library General Public
Packit a4058c
 * License as published by the Free Software Foundation; either
Packit a4058c
 * version 2 of the License, or (at your option) any later version.
Packit a4058c
 *
Packit a4058c
 * This library is distributed in the hope that it will be useful,
Packit a4058c
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit a4058c
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit a4058c
 * Library General Public License for more details.
Packit a4058c
 *
Packit a4058c
 * You should have received a copy of the GNU Library General Public
Packit a4058c
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
Packit a4058c
 */
Packit a4058c
Packit a4058c
#include "config.h"
Packit a4058c
#include <X11/Xlib.h>
Packit a4058c
#include "gdk-pixbuf-xlib-private.h"
Packit a4058c
Packit a4058c
/**
Packit a4058c
 * SECTION:gdk-pixbuf-xlib-init
Packit a4058c
 * @Short_description: Initializing the gdk-pixbuf Xlib library.
Packit a4058c
 * @Title: gdk-pixbuf Xlib initialization
Packit a4058c
 * @See_also:    XlibRGB
Packit a4058c
 * 
Packit a4058c
 * In addition to the normal Gdk-specific functions, the &gdk-pixbuf;
Packit a4058c
 * package provides a small library that lets Xlib-only applications
Packit a4058c
 * use #GdkPixbuf structures and render them to X drawables.  The
Packit a4058c
 * functions in this section are used to initialize the &gdk-pixbuf;
Packit a4058c
 * Xlib library.  This library must be initialized near the beginning
Packit a4058c
 * of the program or before calling any of the other &gdk-pixbuf;
Packit a4058c
 * Xlib functions.
Packit a4058c
 */
Packit a4058c
Packit a4058c
Display *gdk_pixbuf_dpy = NULL;
Packit a4058c
int gdk_pixbuf_screen = -1;
Packit a4058c
Packit a4058c
/**
Packit a4058c
 * gdk_pixbuf_xlib_init:
Packit a4058c
 * @display: X display to use.
Packit a4058c
 * @screen_num: Screen number.
Packit a4058c
 * 
Packit a4058c
 * Initializes the gdk-pixbuf Xlib machinery by calling xlib_rgb_init().  This
Packit a4058c
 * function should be called near the beginning of your program, or before using
Packit a4058c
 * any of the gdk-pixbuf-xlib functions.
Packit a4058c
 **/
Packit a4058c
void
Packit a4058c
gdk_pixbuf_xlib_init (Display *display, int screen_num)
Packit a4058c
{
Packit a4058c
    xlib_rgb_init (display, ScreenOfDisplay (display, screen_num));
Packit a4058c
    gdk_pixbuf_dpy = display;
Packit a4058c
    gdk_pixbuf_screen = screen_num;
Packit a4058c
}
Packit a4058c
Packit a4058c
/**
Packit a4058c
 * gdk_pixbuf_xlib_init_with_depth:
Packit a4058c
 * @display: X display to use.
Packit a4058c
 * @screen_num: Screen number.
Packit a4058c
 * @prefDepth: Preferred depth for XlibRGB.
Packit a4058c
 * 
Packit a4058c
 * Similar to gdk_pixbuf_xlib_init(), but also lets you specify the preferred
Packit a4058c
 * depth for XlibRGB if you do not want it to use the default depth it picks.
Packit a4058c
 **/
Packit a4058c
void
Packit a4058c
gdk_pixbuf_xlib_init_with_depth (Display *display,
Packit a4058c
				 int screen_num, int prefDepth)
Packit a4058c
{
Packit a4058c
    xlib_rgb_init_with_depth (display, ScreenOfDisplay (display, screen_num),
Packit a4058c
			      prefDepth);
Packit a4058c
    gdk_pixbuf_dpy = display;
Packit a4058c
    gdk_pixbuf_screen = screen_num;
Packit a4058c
}