1 /*
2  * ROX-Filer, filer for the ROX desktop project
3  * By Thomas Leonard, <tal197@users.sourceforge.net>.
4  */
5 
6 #ifndef _PIXMAP_H
7 #define _PIXMAP_H
8 
9 #include <gtk/gtk.h>
10 
11 extern GFSCache *pixmap_cache;
12 extern GFSCache *desktop_icon_cache;
13 
14 extern MaskedPixmap *im_error;
15 extern MaskedPixmap *im_unknown;
16 
17 extern MaskedPixmap *im_exec_file;
18 extern MaskedPixmap *im_appdir;
19 
20 extern MaskedPixmap *im_dirs;
21 
22 extern GtkIconSize mount_icon_size;
23 
24 /* If making the huge size larger, be sure to update SMALL_IMAGE_THRESHOLD! */
25 #define HUGE_WIDTH 96
26 #define HUGE_HEIGHT 96
27 
28 #define ICON_HEIGHT 52
29 #define ICON_WIDTH 48
30 
31 #define SMALL_HEIGHT 18
32 #define SMALL_WIDTH 22
33 
34 typedef struct _MaskedPixmapClass MaskedPixmapClass;
35 
36 struct _MaskedPixmapClass {
37 	GObjectClass parent;
38 };
39 
40 /* When a MaskedPixmap is created we load the image from disk and
41  * scale the pixbuf down to the 'huge' size (if it's bigger).
42  * The 'normal' pixmap and mask are created automatically - you have
43  * to request the other sizes.
44  *
45  * Note that any of the masks be also be NULL if the image has no
46  * mask.
47  */
48 struct _MaskedPixmap
49 {
50 	GObject		object;
51 
52 	GdkPixbuf	*src_pixbuf;	/* Limited to 'huge' size */
53 
54 	/* If huge_pixbuf is NULL then call pixmap_make_huge() */
55 	GdkPixbuf	*huge_pixbuf;
56 	int		huge_width, huge_height;
57 
58 	GdkPixbuf	*pixbuf;	/* Normal size image, always valid */
59 	int		width, height;
60 
61 	/* If sm_pixbuf is NULL then call pixmap_make_small() */
62 	GdkPixbuf	*sm_pixbuf;
63 	int		sm_width, sm_height;
64 };
65 
66 void pixmaps_init(void);
67 void pixmap_make_huge(MaskedPixmap *mp);
68 void pixmap_make_small(MaskedPixmap *mp);
69 MaskedPixmap *load_pixmap(const char *name);
70 void pixmap_background_thumb(const gchar *path, GFunc callback, gpointer data);
71 MaskedPixmap *pixmap_try_thumb(const gchar *path, gboolean can_load);
72 MaskedPixmap *masked_pixmap_new(GdkPixbuf *full_size);
73 GdkPixbuf *scale_pixbuf(GdkPixbuf *src, int max_w, int max_h);
74 
75 #endif /* _PIXMAP_H */
76