summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDror Levin <spatz@gentoo.org>2010-03-27 22:19:12 +0000
committerDror Levin <spatz@gentoo.org>2010-03-27 22:19:12 +0000
commitd3f764e184b62670fc724dba82aa3f617a6a0468 (patch)
tree419215c7f0f75c1ee1032976c2c4537f61160928 /media-plugins/gimp-resynthesizer
parentInitial import, bug 126220. Thanks to Maurizio Pucci and Jouni Rinne. (diff)
downloadgentoo-2-d3f764e184b62670fc724dba82aa3f617a6a0468.tar.gz
gentoo-2-d3f764e184b62670fc724dba82aa3f617a6a0468.tar.bz2
gentoo-2-d3f764e184b62670fc724dba82aa3f617a6a0468.zip
Replace remove selection script with the improved one from http://registry.gimp.org/node/15118.
(Portage version: 2.2_rc67/cvs/Linux x86_64)
Diffstat (limited to 'media-plugins/gimp-resynthesizer')
-rw-r--r--media-plugins/gimp-resynthesizer/ChangeLog7
-rw-r--r--media-plugins/gimp-resynthesizer/files/smart-remove.scm111
-rw-r--r--media-plugins/gimp-resynthesizer/gimp-resynthesizer-0.16.ebuild6
3 files changed, 121 insertions, 3 deletions
diff --git a/media-plugins/gimp-resynthesizer/ChangeLog b/media-plugins/gimp-resynthesizer/ChangeLog
index d2be0f829c37..a725150c01ca 100644
--- a/media-plugins/gimp-resynthesizer/ChangeLog
+++ b/media-plugins/gimp-resynthesizer/ChangeLog
@@ -1,6 +1,11 @@
# ChangeLog for media-plugins/gimp-resynthesizer
# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/media-plugins/gimp-resynthesizer/ChangeLog,v 1.1 2010/03/27 21:49:16 spatz Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-plugins/gimp-resynthesizer/ChangeLog,v 1.2 2010/03/27 22:19:12 spatz Exp $
+
+ 27 Mar 2010; Dror Levin <spatz@gentoo.org> gimp-resynthesizer-0.16.ebuild,
+ +files/smart-remove.scm:
+ Replace remove selection script with the improved one from
+ http://registry.gimp.org/node/15118.
*gimp-resynthesizer-0.16 (27 Mar 2010)
diff --git a/media-plugins/gimp-resynthesizer/files/smart-remove.scm b/media-plugins/gimp-resynthesizer/files/smart-remove.scm
new file mode 100644
index 000000000000..7324ebd56741
--- /dev/null
+++ b/media-plugins/gimp-resynthesizer/files/smart-remove.scm
@@ -0,0 +1,111 @@
+
+; Smart Remove
+
+; Smart selection eraser.
+; Requires resynthesizer plug-in.
+; Paul Harrison (pfh@logarithmic.net)
+
+; Versions
+; lloyd konneker lkk 3/29/2009 Fix passing workLayerID to plugin.
+; Other non-functional changes: comments, error checking, menu item, blurb, license
+;
+
+; License:
+;
+; 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 of the License, 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.
+;
+; The GNU Public License is available at
+; http://www.gnu.org/copyleft/gpl.html
+
+; lkk comment: creates stencil selection in a temp dupe image to pass as source drawable to plugin
+
+
+(define (script-fu-smart-remove img layer corpus-border)
+ (cond
+ ((= 0 (car (gimp-selection-bounds img)))
+ (gimp-message "To use this script-fu, first select the region you wish to remove.")
+ )
+ (#t (let*
+ (
+ (dupe (car (gimp-image-duplicate img)))
+ (channel (car (gimp-selection-save dupe)))
+ (workLayerID -1) ; lkk
+ )
+
+ ; lkk flatten (so stencil gets everything visible) and to activate a layer in dupe
+ ; (gimp-message-set-handler 1) ; debug messages to console
+ (gimp-image-flatten dupe) ; lkk !!! flatten, activates layer, but deletes alpha
+ (set! workLayerID (car (gimp-image-get-active-layer dupe)))
+ (cond ((= -1 workLayerID)
+ (gimp-message "Failed get active layer")
+ ) )
+ ; lkk plugin requires equal count of channels, target and source. Plugin should be changed to relax this reqt.
+ (cond ((= 1 (car (gimp-drawable-has-alpha layer)))
+ ;debug (gimp-message "Adding alpha")
+ (if (not (car (gimp-layer-add-alpha workLayerID))) (gimp-message "Failed add alpha") )
+ ) )
+
+
+ ; lkk comment: grow selection, invert, save to channel2, cut a hole size of orig selection
+ ; lkk in the grown selection in channel2, select channel2, un invert
+ (gimp-selection-grow dupe corpus-border)
+ (gimp-selection-invert dupe)
+ (let*
+ (
+ (old-background (car (gimp-context-get-background)))
+ (channel2 (car (gimp-selection-save dupe)))
+ )
+
+ (gimp-selection-load channel)
+ (gimp-context-set-background '(255 255 255))
+ (if (not (car (gimp-edit-clear channel2))) (gimp-message "Failed edit clear") )
+ (gimp-context-set-background old-background)
+ (gimp-selection-load channel2)
+ )
+
+ (gimp-selection-invert dupe)
+ ; lkk comment: crop the dupe to size of stencil to save memory
+ (let*
+ (
+ (bounds (gimp-selection-bounds dupe))
+ (x1 (nth 1 bounds))
+ (y1 (nth 2 bounds))
+ (x2 (nth 3 bounds))
+ (y2 (nth 4 bounds))
+ )
+
+ (gimp-image-crop dupe (- x2 x1) (- y2 y1) x1 y1)
+ )
+
+ (gimp-selection-invert dupe) ; lkk !!! plugin requires inverted selection
+ ;(gimp-display-new dupe) ; debug to see the stencil as passed to plugin
+ ;(gimp-displays-flush) ; debug
+
+ ; lkk originally 7th param was layer (the in layer), which only SEEMED to work. Should be the stencil.
+ (plug-in-resynthesizer 1 img layer 0 0 1 workLayerID -1 -1 0.0 0.117 16 500)
+
+ (gimp-image-delete dupe)
+ (gimp-displays-flush)
+) ) ))
+
+(script-fu-register "script-fu-smart-remove"
+ "<Image>/Filters/Enhance/Heal selection..."
+ "Extend surrounding texture to cover the selection. Works best with homogenous, not regular surroundings. \
+Requires separate resynthesizer plug-in."
+ "Paul Harrison (pfh@logarithmic.net)"
+ "Copyright 2000 Paul Harrison, 2009 Lloyd Konneker"
+ "13/9/2000"
+ "RGB* GRAY*"
+ SF-IMAGE "Input Image" 0
+ SF-DRAWABLE "Input Layer" 0
+ SF-ADJUSTMENT "Radius to take texture from" '(50 7 1000 1.0 1.0 0 1)
+)
+
diff --git a/media-plugins/gimp-resynthesizer/gimp-resynthesizer-0.16.ebuild b/media-plugins/gimp-resynthesizer/gimp-resynthesizer-0.16.ebuild
index 97a73313b342..18ae2787376c 100644
--- a/media-plugins/gimp-resynthesizer/gimp-resynthesizer-0.16.ebuild
+++ b/media-plugins/gimp-resynthesizer/gimp-resynthesizer-0.16.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/media-plugins/gimp-resynthesizer/gimp-resynthesizer-0.16.ebuild,v 1.1 2010/03/27 21:49:16 spatz Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-plugins/gimp-resynthesizer/gimp-resynthesizer-0.16.ebuild,v 1.2 2010/03/27 22:19:12 spatz Exp $
EAPI=2
@@ -25,6 +25,7 @@ S="${WORKDIR}/${MY_P}"
src_prepare() {
epatch "${FILESDIR}/${P}-makefile.patch"
+ cp "${FILESDIR}/smart-remove.scm" "${S}" || die
tc-export CXX
}
@@ -42,5 +43,6 @@ src_install() {
pkg_postinst() {
elog "The Resynthesizer plugin is accessible from the menu:"
elog "* Filters -> Map -> Resynthesize"
- elog "* Filters -> Enhance -> Smart enlarge/sharpen/remove selection"
+ elog "* Filters -> Enhance -> Smart enlarge/sharpen"
+ elog "* Filters -> Enhance -> Heal selection"
}