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,
76 if (page_width < 100) {
79 } else if (page_width < 500) {
90 ev_document_misc_paint_one_page (GdkDrawable *drawable,
95 gdk_draw_rectangle (drawable,
96 widget->style->black_gc,
102 gdk_draw_rectangle (drawable,
103 widget->style->white_gc,
105 area->x + border->left,
106 area->y + border->top,
107 area->width - (border->left + border->right),
108 area->height - (border->top + border->bottom));
109 gdk_draw_rectangle (drawable,
110 widget->style->mid_gc[widget->state],
113 area->y + area->height - (border->bottom - border->top),
114 border->bottom - border->top,
115 border->bottom - border->top);
116 gdk_draw_rectangle (drawable,
117 widget->style->mid_gc[widget->state],
119 area->x + area->width - (border->right - border->left),
121 border->right - border->left,
122 border->right - border->left);