Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/backend
diff options
context:
space:
mode:
authorJonathan Blandford <jrb@redhat.com>2005-01-05 07:35:14 (GMT)
committer Jonathan Blandford <jrb@src.gnome.org>2005-01-05 07:35:14 (GMT)
commit0e58d20fc6c22fc95b8236d3d53079c062a0041d (patch)
treed8a4592298ca1ec061e310720c85eebb497c7dce /backend
parent2b344d828d68b28027426df8ce71e4d034a0ebba (diff)
New misc file to do simple drop shadows.
Wed Jan 5 02:33:06 2005 Jonathan Blandford <jrb@redhat.com> * backend/ev-document-misc.[ch]: New misc file to do simple drop shadows. * pdf/xpdf/pdf-document.cc: use the drop shadows in both types of thumbnails..
Diffstat (limited to 'backend')
-rw-r--r--backend/Makefile.am2
-rw-r--r--backend/ev-document-misc.c53
-rw-r--r--backend/ev-document-misc.h37
3 files changed, 92 insertions, 0 deletions
diff --git a/backend/Makefile.am b/backend/Makefile.am
index 1e77a35..e2c3245 100644
--- a/backend/Makefile.am
+++ b/backend/Makefile.am
@@ -21,6 +21,8 @@ libevbackend_la_SOURCES= \
ev-document-find.h \
ev-ps-exporter.c \
ev-ps-exporter.h \
+ ev-document-misc.h \
+ ev-document-misc.c \
$(NULL)
BUILT_SOURCES= \
diff --git a/backend/ev-document-misc.c b/backend/ev-document-misc.c
new file mode 100644
index 0000000..ca818b7
--- /dev/null
+++ b/backend/ev-document-misc.c
@@ -0,0 +1,53 @@
+
+#include "ev-document-misc.h"
+
+/* Returns a new GdkPixbuf that is suitable for placing in the thumbnail view.
+ * It is four pixels wider and taller than the source. If source_pixbuf is not
+ * NULL, then it will fill the return pixbuf with the contents of
+ * source_pixbuf. */
+GdkPixbuf *
+ev_document_misc_get_thumbnail_frame (int width,
+ int height,
+ GdkPixbuf *source_pixbuf)
+{
+ GdkPixbuf *retval;
+ guchar *data;
+ gint rowstride;
+
+ if (source_pixbuf)
+ g_return_val_if_fail (GDK_IS_PIXBUF (source_pixbuf), NULL);
+
+ if (source_pixbuf) {
+ width = gdk_pixbuf_get_width (source_pixbuf);
+ height = gdk_pixbuf_get_height (source_pixbuf);
+ }
+
+ /* make sure no one is passing us garbage */
+ g_assert (width > 0 && height > 0);
+
+ retval = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
+ TRUE, 8,
+ width + 4,
+ height + 4);
+ gdk_pixbuf_fill (retval, 0x000000ff);
+ if (source_pixbuf)
+ gdk_pixbuf_copy_area (source_pixbuf, 0, 0,
+ width,
+ height,
+ retval,
+ 1, 1);
+ /* Add the corner */
+ data = gdk_pixbuf_get_pixels (retval);
+ rowstride = gdk_pixbuf_get_rowstride (retval);
+ data [(width + 2) * 4 + 3] = 0;
+ data [(width + 3) * 4 + 3] = 0;
+ data [(width + 2) * 4 + (rowstride * 1) + 3] = 0;
+ data [(width + 3) * 4 + (rowstride * 1) + 3] = 0;
+
+ data [(height + 2) * rowstride + 3] = 0;
+ data [(height + 3) * rowstride + 3] = 0;
+ data [(height + 2) * rowstride + 4 + 3] = 0;
+ data [(height + 3) * rowstride + 4 + 3] = 0;
+
+ return retval;
+}
diff --git a/backend/ev-document-misc.h b/backend/ev-document-misc.h
new file mode 100644
index 0000000..1fae363
--- /dev/null
+++ b/backend/ev-document-misc.h
@@ -0,0 +1,37 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */
+/*
+ * Copyright (C) 2000-2003 Marco Pesenti Gritti
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Id$
+ */
+
+#ifndef EV_DOCUMENT_MISC_H
+#define EV_DOCUMENT_MISC_H
+
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+G_BEGIN_DECLS
+
+
+GdkPixbuf *ev_document_misc_get_thumbnail_frame (int width,
+ int height,
+ GdkPixbuf *source_pixbuf);
+
+G_END_DECLS
+
+#endif /* EV_DOCUMENT_MISC_H */