Package: gnome-screenshot Version: 3.8.2-1 Severity: wishlist Tags: patch Dear Maintainer,
while gnome-screenshot has a filter option, the two present filters (border and shadow) are not resembling current postprocessing trends, likely exposing GNOME users to ridicule when publishing their pictures on the social web. I therefore implemented a third filter that adds a vintage look to screenshots. Screenhot taken with patched gnome-screenshot, vintage filter applied: <http://daten.dieweltistgarnichtso.net/pics/screenshots/emacs-vintage.png> Upstream bug report: <https://bugzilla.gnome.org/show_bug.cgi?id=705847> -- System Information: Debian Release: jessie/sid APT prefers testing APT policy: (500, 'testing'), (500, 'stable'), (1, 'experimental') Architecture: i386 (i686) Kernel: Linux 3.2.0-3-686-pae (SMP w/1 CPU core) Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages gnome-screenshot depends on: ii dconf-gsettings-backend [gsettings-backend] 0.12.1-3 ii libc6 2.17-7 ii libcairo2 1.12.14-4 ii libcanberra-gtk3-0 0.30-2 ii libcanberra0 0.30-2 ii libgdk-pixbuf2.0-0 2.28.2-1 ii libglib2.0-0 2.36.3-3 ii libgtk-3-0 3.4.2-6 ii libx11-6 2:1.6.0-1 ii libxext6 2:1.3.2-1 gnome-screenshot recommends no packages. gnome-screenshot suggests no packages. -- no debconf information
>From 1db07e0d52f70935103fc12013fb6b01f0992109 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp <n...@dieweltistgarnichtso.net> Date: Sat, 10 Aug 2013 19:14:58 +0200 Subject: [PATCH] screenshot: add vintage filter --- src/gnome-screenshot.1 | 6 +++-- src/screenshot-application.c | 5 +++- src/screenshot-interactive-dialog.c | 10 +++++-- src/screenshot-shadow.c | 49 +++++++++++++++++++++++++++++++++++ src/screenshot-shadow.h | 1 + 5 files changed, 66 insertions(+), 5 deletions(-) diff --git a/src/gnome-screenshot.1 b/src/gnome-screenshot.1 index d07e853..ad82dd0 100644 --- a/src/gnome-screenshot.1 +++ b/src/gnome-screenshot.1 @@ -1,4 +1,4 @@ -.TH "GNOME-SCREENSHOT" "1" "May 14, 2013" "" "" +.TH "GNOME-SCREENSHOT" "1" "August 10, 2013" "" "" .SH NAME gnome-screenshot \- capture the screen, a window, or an user-defined area and save the snapshot image to a file. .SH SYNOPSIS @@ -37,7 +37,9 @@ Take the screenshot after the specified delay [in seconds]. Add an effect to the outside of the screenshot border. \fIEFFECT\fR can be ``shadow'' (adding drop shadow), ``border'' (adding rectangular -space around the screenshot) or ``none'' (no effect). +space around the screenshot), ``vintage'' (desaturating +the screenshot slightly, tinting it and adding +rectangular space around it) or ``none'' (no effect). Default is ``none''. .TP \fB-i, --interactive\fR diff --git a/src/screenshot-application.c b/src/screenshot-application.c index 3cdddf5..7cfea8c 100644 --- a/src/screenshot-application.c +++ b/src/screenshot-application.c @@ -524,6 +524,9 @@ finish_prepare_screenshot (ScreenshotApplication *self, case 'b': /* border */ screenshot_add_border (&screenshot); break; + case 'v': /* vintage */ + screenshot_add_vintage (&screenshot); + break; case 'n': /* none */ default: break; @@ -643,7 +646,7 @@ screenshot_application_local_command_line (GApplication *app, { "remove-border", 'B', 0, G_OPTION_ARG_NONE, &disable_border_arg, N_("Remove the window border from the screenshot"), NULL }, { "include-pointer", 'p', 0, G_OPTION_ARG_NONE, &include_pointer_arg, N_("Include the pointer with the screenshot"), NULL }, { "delay", 'd', 0, G_OPTION_ARG_INT, &delay_arg, N_("Take screenshot after specified delay [in seconds]"), N_("seconds") }, - { "border-effect", 'e', 0, G_OPTION_ARG_STRING, &border_effect_arg, N_("Effect to add to the border (shadow, border or none)"), N_("effect") }, + { "border-effect", 'e', 0, G_OPTION_ARG_STRING, &border_effect_arg, N_("Effect to add to the border (shadow, border, vintage or none)"), N_("effect") }, { "interactive", 'i', 0, G_OPTION_ARG_NONE, &interactive_arg, N_("Interactively set options"), NULL }, { "file", 'f', 0, G_OPTION_ARG_FILENAME, &file_arg, N_("Save screenshot directly to this file"), N_("filename") }, { NULL }, diff --git a/src/screenshot-interactive-dialog.c b/src/screenshot-interactive-dialog.c index cb4f12d..fa29d2f 100644 --- a/src/screenshot-interactive-dialog.c +++ b/src/screenshot-interactive-dialog.c @@ -3,6 +3,7 @@ * Copyright (C) 2001 Jonathan Blandford <j...@alum.mit.edu> * Copyright (C) 2006 Emmanuele Bassi <eba...@gnome.org> * Copyright (C) 2008, 2011 Cosimo Cecchi <cosi...@gnome.org> + * Copyright (C) 2013 Nils Dagsson Moskopp <n...@dieweltistgarnichtso.net> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -47,7 +48,8 @@ enum typedef enum { SCREENSHOT_EFFECT_NONE, SCREENSHOT_EFFECT_SHADOW, - SCREENSHOT_EFFECT_BORDER + SCREENSHOT_EFFECT_BORDER, + SCREENSHOT_EFFECT_VINTAGE } ScreenshotEffectType; #define TARGET_TOGGLE_DESKTOP 0 @@ -153,7 +155,8 @@ typedef struct { static const ScreenshotEffect effects[] = { { SCREENSHOT_EFFECT_NONE, N_("None"), "none" }, { SCREENSHOT_EFFECT_SHADOW, N_("Drop shadow"), "shadow" }, - { SCREENSHOT_EFFECT_BORDER, N_("Border"), "border" } + { SCREENSHOT_EFFECT_BORDER, N_("Border"), "border" }, + { SCREENSHOT_EFFECT_VINTAGE, N_("Vintage"), "vintage" } }; static guint n_effects = G_N_ELEMENTS (effects); @@ -198,6 +201,9 @@ create_effects_combo (void) gtk_combo_box_set_active (GTK_COMBO_BOX (retval), SCREENSHOT_EFFECT_BORDER); break; + case 'v': /* vintage */ + gtk_combo_box_set_active (GTK_COMBO_BOX (retval), + SCREENSHOT_EFFECT_VINTAGE); case 'n': /* none */ gtk_combo_box_set_active (GTK_COMBO_BOX (retval), SCREENSHOT_EFFECT_NONE); diff --git a/src/screenshot-shadow.c b/src/screenshot-shadow.c index abb0a48..194ba31 100644 --- a/src/screenshot-shadow.c +++ b/src/screenshot-shadow.c @@ -1,6 +1,7 @@ /* screenshot-shadow.c - part of GNOME Screenshot * * Copyright (C) 2001-2006 Jonathan Blandford <j...@alum.mit.edu> + * Copyright (C) 2013 Nils Dagsson Moskopp <n...@dieweltistgarnichtso.net> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public @@ -34,6 +35,12 @@ #define OUTLINE_OFFSET 0 #define OUTLINE_OPACITY 1.0 +#define VINTAGE_SATURATION 0.8 +#define VINTAGE_OVERLAY_COLOR 0xFFFBF2A3 +#define VINTAGE_SOURCE_ALPHA 192 +#define VINTAGE_OUTLINE_COLOR 0xFFEEEEEE +#define VINTAGE_OUTLINE_RADIUS 24 + #define dist(x0, y0, x1, y1) sqrt(((x0) - (x1))*((x0) - (x1)) + ((y0) - (y1))*((y0) - (y1))) typedef struct { @@ -233,3 +240,45 @@ screenshot_add_border (GdkPixbuf **src) g_object_unref (*src); *src = dest; } + +void +screenshot_add_vintage (GdkPixbuf **src) +{ + GdkPixbuf *dest; + static ConvFilter *filter = NULL; + + if (!filter) + filter = create_outline_filter (VINTAGE_OUTLINE_RADIUS); + + dest = create_effect (*src, filter, + VINTAGE_OUTLINE_RADIUS, + OUTLINE_OFFSET, OUTLINE_OPACITY); + + if (dest == NULL) + return; + + gdk_pixbuf_fill(dest, VINTAGE_OUTLINE_COLOR); + gdk_pixbuf_composite (*src, dest, + VINTAGE_OUTLINE_RADIUS, VINTAGE_OUTLINE_RADIUS, + gdk_pixbuf_get_width (*src), + gdk_pixbuf_get_height (*src), + VINTAGE_OUTLINE_RADIUS, VINTAGE_OUTLINE_RADIUS, 1.0, 1.0, + GDK_INTERP_HYPER, 255); + g_object_unref (*src); + *src = dest; + + gdk_pixbuf_saturate_and_pixelate(*src, *src, + VINTAGE_SATURATION, FALSE); + dest = gdk_pixbuf_composite_color_simple(*src, + gdk_pixbuf_get_width(*src), + gdk_pixbuf_get_height(*src), + GDK_INTERP_BILINEAR, + VINTAGE_SOURCE_ALPHA, 64, + VINTAGE_OVERLAY_COLOR, VINTAGE_OVERLAY_COLOR); + + if (dest == NULL) + return; + + g_object_unref (*src); + *src = dest; +} diff --git a/src/screenshot-shadow.h b/src/screenshot-shadow.h index cac37db..932e687 100644 --- a/src/screenshot-shadow.h +++ b/src/screenshot-shadow.h @@ -24,5 +24,6 @@ void screenshot_add_shadow (GdkPixbuf **src); void screenshot_add_border (GdkPixbuf **src); +void screenshot_add_vintage (GdkPixbuf **src); #endif /* __SCREENSHOT_SHADOW_H__ */ -- 1.7.10.4