## MateBG MateBG |

## Synopsis

    #include <libmateui/mate-bg.h>

                        MateBG;
    enum                MateBGColorType;
    enum                MateBGPlacement;
    #define             MATE_BG_KEY_DIR
    MateBG *           mate_bg_new                        (void);
    void                mate_bg_load_from_preferences      (MateBG *bg,
                                                             MateConfClient *client);
    void                mate_bg_save_to_preferences        (MateBG *bg,
                                                             MateConfClient *client);
    void                mate_bg_set_filename               (MateBG *bg,
                                                             const char *filename);
    void                mate_bg_set_placement              (MateBG *bg,
                                                             MateBGPlacement placement);
    void                mate_bg_set_color                  (MateBG *bg,
                                                             MateBGColorType type,
                                                             GdkColor *primary,
                                                             GdkColor *secondary);
    const gchar *       mate_bg_get_filename               (MateBG *bg);
    MateBGPlacement    mate_bg_get_placement              (MateBG *bg);
    void                mate_bg_get_color                  (MateBG *bg,
                                                             MateBGColorType *type,
                                                             GdkColor *primary,
                                                             GdkColor *secondary);
    void                mate_bg_draw                       (MateBG *bg,
                                                             GdkPixbuf *dest,
                                                             GdkScreen *screen,
                                                             gboolean is_root);
    GdkPixmap *         mate_bg_create_pixmap              (MateBG *bg,
                                                             GdkWindow *window,
                                                             int width,
                                                             int height,
                                                             gboolean root);
    gboolean            mate_bg_get_image_size             (MateBG *bg,
                                                             MateDesktopThumbnailFactory *factory,
                                                             int best_width,
                                                             int best_height,
                                                             int *width,
                                                             int *height);
    GdkPixbuf *         mate_bg_create_thumbnail           (MateBG *bg,
                                                             MateDesktopThumbnailFactory *factory,
                                                             GdkScreen *screen,
                                                             int dest_width,
                                                             int dest_height);
    gboolean            mate_bg_is_dark                    (MateBG *bg,
                                                             int dest_width,
                                                             int dest_height);
    void                mate_bg_set_pixmap_as_root         (GdkScreen *screen,
                                                             GdkPixmap *pixmap);

## Object Hierarchy

      GObject
       +----MateBG

## Signals

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

## Description

## Details

### MateBG

    typedef struct _MateBG MateBG;

### enum MateBGColorType

    typedef enum {
    	MATE_BG_COLOR_SOLID,
    	MATE_BG_COLOR_H_GRADIENT,
    	MATE_BG_COLOR_V_GRADIENT
    } MateBGColorType;

### enum MateBGPlacement

    typedef enum {
    	MATE_BG_PLACEMENT_TILED,
    	MATE_BG_PLACEMENT_ZOOMED,
    	MATE_BG_PLACEMENT_CENTERED,
    	MATE_BG_PLACEMENT_SCALED,
    	MATE_BG_PLACEMENT_FILL_SCREEN,
    	MATE_BG_PLACEMENT_SPANNED
    } MateBGPlacement;

### MATE_BG_KEY_DIR

    #define MATE_BG_KEY_DIR "/desktop/mate/background"

### mate_bg_new ()

    MateBG *           mate_bg_new                        (void);

Returns : |

### mate_bg_load_from_preferences ()

    void                mate_bg_load_from_preferences      (MateBG *bg,
                                                             MateConfClient *client);

`bg` : |
`client` : |

### mate_bg_save_to_preferences ()

    void                mate_bg_save_to_preferences        (MateBG *bg,
                                                             MateConfClient *client);

`bg` : |
`client` : |

### mate_bg_set_filename ()

    void                mate_bg_set_filename               (MateBG *bg,
                                                             const char *filename);

`bg` : |
`filename` : |

### mate_bg_set_placement ()

    void                mate_bg_set_placement              (MateBG *bg,
                                                             MateBGPlacement placement);

`bg` : |
`placement` : |

### mate_bg_set_color ()

    void                mate_bg_set_color                  (MateBG *bg,
                                                             MateBGColorType type,
                                                             GdkColor *primary,
                                                             GdkColor *secondary);

`bg` : |
`type` : |
`primary` : |
`secondary` : |

### mate_bg_get_filename ()

    const gchar *       mate_bg_get_filename               (MateBG *bg);

`bg` : |
Returns : |

### mate_bg_get_placement ()

    MateBGPlacement    mate_bg_get_placement              (MateBG *bg);

`bg` : |
Returns : |

### mate_bg_get_color ()

    void                mate_bg_get_color                  (MateBG *bg,
                                                             MateBGColorType *type,
                                                             GdkColor *primary,
                                                             GdkColor *secondary);

`bg` : |
`type` : |
`primary` : |
`secondary` : |

### mate_bg_draw ()

    void                mate_bg_draw                       (MateBG *bg,
                                                             GdkPixbuf *dest,
                                                             GdkScreen *screen,
                                                             gboolean is_root);

`bg` : |
`dest` : |
`screen` : |
`is_root` : |

### mate_bg_create_pixmap ()

    GdkPixmap *         mate_bg_create_pixmap              (MateBG *bg,
                                                             GdkWindow *window,
                                                             int width,
                                                             int height,
                                                             gboolean root);

`bg` : |
`window` : |
`width` : |
`height` : |
`root` : |
Returns : |

### mate_bg_get_image_size ()

    gboolean            mate_bg_get_image_size             (MateBG *bg,
                                                             MateDesktopThumbnailFactory *factory,
                                                             int best_width,
                                                             int best_height,
                                                             int *width,
                                                             int *height);

`bg` : |
`factory` : |
`best_width` : |
`best_height` : |
`width` : |
`height` : |
Returns : |

### mate_bg_create_thumbnail ()

    GdkPixbuf *         mate_bg_create_thumbnail           (MateBG *bg,
                                                             MateDesktopThumbnailFactory *factory,
                                                             GdkScreen *screen,
                                                             int dest_width,
                                                             int dest_height);

`bg` : |
`factory` : |
`screen` : |
`dest_width` : |
`dest_height` : |
Returns : |

### mate_bg_is_dark ()

    gboolean            mate_bg_is_dark                    (MateBG *bg,
                                                             int dest_width,
                                                             int dest_height);

`bg` : |
`dest_width` : |
`dest_height` : |
Returns : |

### mate_bg_set_pixmap_as_root ()

    void                mate_bg_set_pixmap_as_root         (GdkScreen *screen,
                                                             GdkPixmap *pixmap);

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). `pixmap` should come from a call to `mate_bg_create_pixmap()`.

`screen` : | the GdkScreen to change root background on
`pixmap` : | the GdkPixmap to set root background from

## Signal Details

### The `"changed"` signal

    void                user_function                      (MateBG *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                      (MateBG *bg,
                                                            gpointer user_data)      : Run Last

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