## gnome-bg

gnome-bg

## Synopsis

    GnomeBG *           gnome_bg_new                        (void);
    void                gnome_bg_load_from_preferences      (GnomeBG *bg,
                                                             GSettings *settings);
    void                gnome_bg_save_to_preferences        (GnomeBG *bg,
                                                             GSettings *settings);
    void                gnome_bg_set_filename               (GnomeBG *bg,
                                                             const char *filename);
    void                gnome_bg_set_placement              (GnomeBG *bg,
                                                             GDesktopBackgroundStyle placement);
    void                gnome_bg_set_color                  (GnomeBG *bg,
                                                             GDesktopBackgroundShading type,
                                                             GdkColor *primary,
                                                             GdkColor *secondary);
    void                gnome_bg_set_draw_background        (GnomeBG *bg,
                                                             gboolean draw_background);
    GDesktopBackgroundStyle gnome_bg_get_placement          (GnomeBG *bg);
    gboolean            gnome_bg_get_draw_background        (GnomeBG *bg);
    void                gnome_bg_get_color                  (GnomeBG *bg,
                                                             GDesktopBackgroundShading *type,
                                                             GdkColor *primary,
                                                             GdkColor *secondary);
    const gchar *       gnome_bg_get_filename               (GnomeBG *bg);
    void                gnome_bg_draw                       (GnomeBG *bg,
                                                             GdkPixbuf *dest,
                                                             GdkScreen *screen,
                                                             gboolean is_root);
    cairo_surface_t *   gnome_bg_create_surface             (GnomeBG *bg,
                                                             GdkWindow *window,
                                                             int width,
                                                             int height,
                                                             gboolean root);
    gboolean            gnome_bg_get_image_size             (GnomeBG *bg,
                                                             GnomeDesktopThumbnailFactory *factory,
                                                             int best_width,
                                                             int best_height,
                                                             int *width,
                                                             int *height);
    GdkPixbuf *         gnome_bg_create_thumbnail           (GnomeBG *bg,
                                                             GnomeDesktopThumbnailFactory *factory,
                                                             GdkScreen *screen,
                                                             int dest_width,
                                                             int dest_height);
    gboolean            gnome_bg_is_dark                    (GnomeBG *bg,
                                                             int dest_width,
                                                             int dest_height);
    gboolean            gnome_bg_has_multiple_sizes         (GnomeBG *bg);
    gboolean            gnome_bg_changes_with_time          (GnomeBG *bg);
    GdkPixbuf *         gnome_bg_create_frame_thumbnail     (GnomeBG *bg,
                                                             GnomeDesktopThumbnailFactory *factory,
                                                             GdkScreen *screen,
                                                             int dest_width,
                                                             int dest_height,
                                                             int frame_num);
    void                gnome_bg_set_surface_as_root        (GdkScreen *screen,
                                                             cairo_surface_t *surface);
    GnomeBGCrossfade *  gnome_bg_set_surface_as_root_with_crossfade
                                                            (GdkScreen *screen,
                                                             cairo_surface_t *surface);
    cairo_surface_t *   gnome_bg_get_surface_from_root      (GdkScreen *screen);
                        GnomeBG;
                        GnomeBGClass;

## Object Hierarchy

      GObject
       +----GnomeBG

## Signals

      "changed"                                        : Run Last
      "transitioned"                                   : Run Last

## Description

## Details

### gnome_bg_new ()

    GnomeBG *           gnome_bg_new                        (void);

### gnome_bg_load_from_preferences ()

    void                gnome_bg_load_from_preferences      (GnomeBG *bg,
                                                             GSettings *settings);

### gnome_bg_save_to_preferences ()

    void                gnome_bg_save_to_preferences        (GnomeBG *bg,
                                                             GSettings *settings);

### gnome_bg_set_filename ()

    void                gnome_bg_set_filename               (GnomeBG *bg,
                                                             const char *filename);

### gnome_bg_set_placement ()

    void                gnome_bg_set_placement              (GnomeBG *bg,
                                                             GDesktopBackgroundStyle placement);

### gnome_bg_set_color ()

    void                gnome_bg_set_color                  (GnomeBG *bg,
                                                             GDesktopBackgroundShading type,
                                                             GdkColor *primary,
                                                             GdkColor *secondary);

### gnome_bg_set_draw_background ()

    void                gnome_bg_set_draw_background        (GnomeBG *bg,
                                                             gboolean draw_background);

### gnome_bg_get_placement ()

    GDesktopBackgroundStyle gnome_bg_get_placement          (GnomeBG *bg);

### gnome_bg_get_draw_background ()

    gboolean            gnome_bg_get_draw_background        (GnomeBG *bg);

### gnome_bg_get_color ()

    void                gnome_bg_get_color                  (GnomeBG *bg,
                                                             GDesktopBackgroundShading *type,
                                                             GdkColor *primary,
                                                             GdkColor *secondary);

### gnome_bg_get_filename ()

    const gchar *       gnome_bg_get_filename               (GnomeBG *bg);

### gnome_bg_draw ()

    void                gnome_bg_draw                       (GnomeBG *bg,
                                                             GdkPixbuf *dest,
                                                             GdkScreen *screen,
                                                             gboolean is_root);

### gnome_bg_create_surface ()

    cairo_surface_t *   gnome_bg_create_surface             (GnomeBG *bg,
                                                             GdkWindow *window,
                                                             int width,
                                                             int height,
                                                             gboolean root);

Create a surface that can be set as background for `window`. If `is_root` is TRUE, the surface created will be created by a temporary X server connection so that if someone calls XKillClient on it, it won't affect the application who created it.

`bg` : | GnomeBG

### gnome_bg_get_image_size ()

    gboolean            gnome_bg_get_image_size             (GnomeBG *bg,
                                                             GnomeDesktopThumbnailFactory *factory,
                                                             int best_width,
                                                             int best_height,
                                                             int *width,
                                                             int *height);

### gnome_bg_create_thumbnail ()

    GdkPixbuf *         gnome_bg_create_thumbnail           (GnomeBG *bg,
                                                             GnomeDesktopThumbnailFactory *factory,
                                                             GdkScreen *screen,
                                                             int dest_width,
                                                             int dest_height);

Returns : | a GdkPixbuf showing the background as a thumbnail. [transfer full]

### gnome_bg_is_dark ()

    gboolean            gnome_bg_is_dark                    (GnomeBG *bg,
                                                             int dest_width,
                                                             int dest_height);

### gnome_bg_has_multiple_sizes ()

    gboolean            gnome_bg_has_multiple_sizes         (GnomeBG *bg);

### gnome_bg_changes_with_time ()

    gboolean            gnome_bg_changes_with_time          (GnomeBG *bg);

### gnome_bg_create_frame_thumbnail ()

    GdkPixbuf *         gnome_bg_create_frame_thumbnail     (GnomeBG *bg,
                                                             GnomeDesktopThumbnailFactory *factory,
                                                             GdkScreen *screen,
                                                             int dest_width,
                                                             int dest_height,
                                                             int frame_num);

Creates a thumbnail for a certain frame, where 'frame' is somewhat vaguely defined as 'suitable point to show while single-stepping through the slideshow'.

Returns : | the newly created thumbnail or or NULL if frame_num is out of bounds. [transfer full]

### gnome_bg_set_surface_as_root ()

    void                gnome_bg_set_surface_as_root        (GdkScreen *screen,
                                                             cairo_surface_t *surface);

Set the root pixmap, and properties pointing to it. We do this atomically with a server grab to make sure that we won't leak the pixmap if somebody else it setting it at the same time. (This assumes that they follow the same conventions we do). `surface` should come from a call to `gnome_bg_create_surface()`.

`screen` : | the GdkScreen to change root background on
`surface` : | the cairo_surface_t to set root background from. Must be an xlib surface backing a pixmap.

### gnome_bg_set_surface_as_root_with_crossfade ()

    GnomeBGCrossfade *  gnome_bg_set_surface_as_root_with_crossfade
                                                            (GdkScreen *screen,
                                                             cairo_surface_t *surface);

Set the root pixmap, and properties pointing to it. This function differs from `gnome_bg_set_surface_as_root()` in that it adds a subtle crossfade animation from the current root pixmap to the new one.

`screen` : | the GdkScreen to change root background on
`surface` : | the cairo xlib surface to set root background from
Returns : | a GnomeBGCrossfade object. [transfer full]

### gnome_bg_get_surface_from_root ()

    cairo_surface_t *   gnome_bg_get_surface_from_root      (GdkScreen *screen);

This function queries the _XROOTPMAP_ID property from the root window associated with `screen` to determine the current root window background pixmap and returns a copy of it. If the _XROOTPMAP_ID is not set, then a black surface is returned.

`screen` : | a GdkScreen
Returns : | a cairo_surface_t if successful or `NULL`

### GnomeBG

    typedef struct _GnomeBG GnomeBG;

### GnomeBGClass

    typedef struct _GnomeBGClass GnomeBGClass;

## Signal Details

### The `"changed"` signal

    void                user_function                      (GnomeBG *bg,
                                                            gpointer user_data)      : Run Last

`bg` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.

### The `"transitioned"` signal

    void                user_function                      (GnomeBG *bg,
                                                            gpointer user_data)      : Run Last

`bg` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.