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,
16 GdkPixbuf *source_pixbuf)
22 int width_r, height_r;
24 rotation = rotation % 360;
28 g_return_val_if_fail (GDK_IS_PIXBUF (source_pixbuf), NULL);
31 width_r = gdk_pixbuf_get_width (source_pixbuf);
32 height_r = gdk_pixbuf_get_height (source_pixbuf);
34 if (rotation == 0 || rotation == 180) {
37 } else if (rotation == 90 || rotation == 270) {
41 g_assert_not_reached ();
45 /* make sure no one is passing us garbage */
46 g_assert (width_r >= 0 && height_r >= 0);
48 retval = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
53 /* make it black and fill in the middle */
54 data = gdk_pixbuf_get_pixels (retval);
55 rowstride = gdk_pixbuf_get_rowstride (retval);
57 gdk_pixbuf_fill (retval, 0x000000ff);
58 for (i = 1; i < height_r + 1; i++)
59 memset (data + (rowstride * i) + 4, 0xffffffff, width_r * 4);
61 /* copy the source pixbuf */
63 gdk_pixbuf_copy_area (source_pixbuf, 0, 0,
69 data [(width_r + 2) * 4 + 3] = 0;
70 data [(width_r + 3) * 4 + 3] = 0;
71 data [(width_r + 2) * 4 + (rowstride * 1) + 3] = 0;
72 data [(width_r + 3) * 4 + (rowstride * 1) + 3] = 0;
74 data [(height_r + 2) * rowstride + 3] = 0;
75 data [(height_r + 3) * rowstride + 3] = 0;
76 data [(height_r + 2) * rowstride + 4 + 3] = 0;
77 data [(height_r + 3) * rowstride + 4 + 3] = 0;
83 ev_document_misc_get_page_border_size (gint page_width,
91 if (page_width < 100) {
94 } else if (page_width < 500) {
105 ev_document_misc_paint_one_page (GdkDrawable *drawable,
111 gdk_draw_rectangle (drawable,
113 widget->style->text_gc[widget->state] : widget->style->dark_gc[widget->state],
119 gdk_draw_rectangle (drawable,
120 widget->style->white_gc,
122 area->x + border->left,
123 area->y + border->top,
124 area->width - (border->left + border->right),
125 area->height - (border->top + border->bottom));
126 gdk_draw_rectangle (drawable,
127 widget->style->mid_gc[widget->state],
130 area->y + area->height - (border->bottom - border->top),
131 border->bottom - border->top,
132 border->bottom - border->top);
133 gdk_draw_rectangle (drawable,
134 widget->style->mid_gc[widget->state],
136 area->x + area->width - (border->right - border->left),
138 border->right - border->left,
139 border->right - border->left);