2 #include "ev-document-misc.h"
4 /* Returns a new GdkPixbuf that is suitable for placing in the thumbnail view.
5 * It is four pixels wider and taller than the source. If source_pixbuf is not
6 * NULL, then it will fill the return pixbuf with the contents of
9 ev_document_misc_get_thumbnail_frame (int width,
11 GdkPixbuf *source_pixbuf)
18 g_return_val_if_fail (GDK_IS_PIXBUF (source_pixbuf), NULL);
21 width = gdk_pixbuf_get_width (source_pixbuf);
22 height = gdk_pixbuf_get_height (source_pixbuf);
25 /* make sure no one is passing us garbage */
26 g_assert (width > 0 && height > 0);
28 retval = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
32 gdk_pixbuf_fill (retval, 0x000000ff);
34 gdk_pixbuf_copy_area (source_pixbuf, 0, 0,
40 data = gdk_pixbuf_get_pixels (retval);
41 rowstride = gdk_pixbuf_get_rowstride (retval);
42 data [(width + 2) * 4 + 3] = 0;
43 data [(width + 3) * 4 + 3] = 0;
44 data [(width + 2) * 4 + (rowstride * 1) + 3] = 0;
45 data [(width + 3) * 4 + (rowstride * 1) + 3] = 0;
47 data [(height + 2) * rowstride + 3] = 0;
48 data [(height + 3) * rowstride + 3] = 0;
49 data [(height + 2) * rowstride + 4 + 3] = 0;
50 data [(height + 3) * rowstride + 4 + 3] = 0;