2 #include "ev-document-misc.h"
6 /* Returns a new GdkPixbuf that is suitable for placing in the thumbnail view.
7 * It is four pixels wider and taller than the source. If source_pixbuf is not
8 * NULL, then it will fill the return pixbuf with the contents of
13 ev_document_misc_get_thumbnail_frame (int width,
15 GdkPixbuf *source_pixbuf)
23 g_return_val_if_fail (GDK_IS_PIXBUF (source_pixbuf), NULL);
26 width = gdk_pixbuf_get_width (source_pixbuf);
27 height = gdk_pixbuf_get_height (source_pixbuf);
30 /* make sure no one is passing us garbage */
31 g_assert (width > 0 && height > 0);
33 retval = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
38 /* make it black and fill in the middle */
39 data = gdk_pixbuf_get_pixels (retval);
40 rowstride = gdk_pixbuf_get_rowstride (retval);
42 gdk_pixbuf_fill (retval, 0x000000ff);
43 for (i = 1; i < height + 1; i++)
44 memset (data + (rowstride * i) + 4, 0xffffffff, width * 4);
46 /* copy the source pixbuf */
48 gdk_pixbuf_copy_area (source_pixbuf, 0, 0,
54 data [(width + 2) * 4 + 3] = 0;
55 data [(width + 3) * 4 + 3] = 0;
56 data [(width + 2) * 4 + (rowstride * 1) + 3] = 0;
57 data [(width + 3) * 4 + (rowstride * 1) + 3] = 0;
59 data [(height + 2) * rowstride + 3] = 0;
60 data [(height + 3) * rowstride + 3] = 0;
61 data [(height + 2) * rowstride + 4 + 3] = 0;
62 data [(height + 3) * rowstride + 4 + 3] = 0;
68 ev_document_misc_get_page_border_size (gint page_width,
75 g_assert (left_border);
76 g_assert (right_border);
77 g_assert (top_border);
78 g_assert (bottom_border);
82 if (page_width < 100) {
85 } else if (page_width < 500) {