2 #include "ev-document-misc.h"
5 /* Returns a new GdkPixbuf that is suitable for placing in the thumbnail view.
6 * It is four pixels wider and taller than the source. If source_pixbuf is not
7 * NULL, then it will fill the return pixbuf with the contents of
12 ev_document_misc_get_thumbnail_frame (int width,
14 GdkPixbuf *source_pixbuf)
22 g_return_val_if_fail (GDK_IS_PIXBUF (source_pixbuf), NULL);
25 width = gdk_pixbuf_get_width (source_pixbuf);
26 height = gdk_pixbuf_get_height (source_pixbuf);
29 /* make sure no one is passing us garbage */
30 g_assert (width > 0 && height > 0);
32 retval = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
37 /* make it black and fill in the middle */
38 data = gdk_pixbuf_get_pixels (retval);
39 rowstride = gdk_pixbuf_get_rowstride (retval);
41 gdk_pixbuf_fill (retval, 0x000000ff);
42 for (i = 1; i < height + 1; i++)
43 memset (data + (rowstride * i) + 4, 0xffffffff, width * 4);
45 /* copy the source pixbuf */
47 gdk_pixbuf_copy_area (source_pixbuf, 0, 0,
53 data [(width + 2) * 4 + 3] = 0;
54 data [(width + 3) * 4 + 3] = 0;
55 data [(width + 2) * 4 + (rowstride * 1) + 3] = 0;
56 data [(width + 3) * 4 + (rowstride * 1) + 3] = 0;
58 data [(height + 2) * rowstride + 3] = 0;
59 data [(height + 3) * rowstride + 3] = 0;
60 data [(height + 2) * rowstride + 4 + 3] = 0;
61 data [(height + 3) * rowstride + 4 + 3] = 0;