Replace remove selection script with the improved one from http://registry.gimp.org...
authorDror Levin <spatz@gentoo.org>
Sat, 27 Mar 2010 22:19:12 +0000 (22:19 +0000)
committerDror Levin <spatz@gentoo.org>
Sat, 27 Mar 2010 22:19:12 +0000 (22:19 +0000)
Package-Manager: portage-2.2_rc67/cvs/Linux x86_64

media-plugins/gimp-resynthesizer/ChangeLog
media-plugins/gimp-resynthesizer/Manifest
media-plugins/gimp-resynthesizer/files/smart-remove.scm [new file with mode: 0644]
media-plugins/gimp-resynthesizer/gimp-resynthesizer-0.16.ebuild

index d2be0f829c37d561b901fcb53b6e9e73f318814b..a725150c01ca5780f84586e2bf4037da8753401b 100644 (file)
@@ -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)
 
index 379219fa1f747bae06b8d75081ed16b8fa20d6c4..2a097e789ad80b07015425fd218864f7ab8b167a 100644 (file)
@@ -2,18 +2,19 @@
 Hash: SHA512
 
 AUX gimp-resynthesizer-0.16-makefile.patch 655 RMD160 6e30a18c2557db54518c58481cb237e8e851e635 SHA1 525651d8e035fa26fcb5036ff50677625a4eff97 SHA256 d3f6df2e07d8312605ee3d576ff0dcad8f83c7a9963330ab1472cf67eac5ba48
+AUX smart-remove.scm 4157 RMD160 32146b8260c3f464ee6028e339f81526a524d8da SHA1 167adea804f10dc57ab339693b097d963abf878b SHA256 ae3d225cf9040c3ab50c8845bb3b62c9a05359169ce6f6a9c6e507fb61809297
 DIST resynthesizer-0.16.tar.gz 18241 RMD160 4d232918d08ae52f2e1ebed5897b40788be6c350 SHA1 9a7a6318b18d9546d712441594041c4ca47952d7 SHA256 dd24ec89f3a36f867b733c6a5c1d193b6d603251bd6553ac54b573fd655020cd
-EBUILD gimp-resynthesizer-0.16.ebuild 1112 RMD160 d817e249e7ee7df049cfb4be15240cf4a22835f6 SHA1 76c86daf2a8c3b0c791e3916832a0085eef9e62c SHA256 a45c767f653ccb7466d86a9f0116f0e0d5e8f2288efcc425c55e3360580ac23e
-MISC ChangeLog 493 RMD160 bc930d2921d4818ffb4ac10676a240432415c0ef SHA1 dfafe5d6b0283817113be0d8ebe5b85186c3e1e8 SHA256 ca5beebbfbffa2c34d6316bc92be6fb5483274849f65a12d655383590b946bba
+EBUILD gimp-resynthesizer-0.16.ebuild 1191 RMD160 418409eb4ca7a930a25b758be91fe4b98c6fe87b SHA1 d1d87f70deaa712f6b7cd9cc4b53b081667f559e SHA256 86e111bbd494c6f9b510fd8b89f92f90676a3d452bff16bf5a663f839850c30c
+MISC ChangeLog 698 RMD160 9d2dc78824a142a9efc695d7db70a9e4f879e949 SHA1 4f2a11916d2213ecb8a6762c8f23b1d172d588db SHA256 a7b9e12f741f1e485c6d78910512292489d8ec76e712fd326c316f0ed90a9450
 MISC metadata.xml 250 RMD160 08f8cb4c4b17b986418f11e803927228d83141c1 SHA1 90963367c7515b7ebd76f633f24371b11a6a7ce5 SHA256 66e248b5390ab7408117c8b0dad7faafc2f8513dbc9ccba42f3a68f4e7eeb713
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.14 (GNU/Linux)
 
-iQEcBAEBCgAGBQJLrn1kAAoJEAWF714uGAc68d8H/0bSciBMYZqgDAWEX7VWbIg9
-T5q56cSY3IMvNjEfIGXZrAqthUo2ini1q7B99uJPMzpXyosBpnNTotg5FHo/JnJN
-BbGfgDqaNTPO7mX4X6gjD2OH1kbOoa2CbQXOUras2gLk17RZ6wxxS3ETVNCiKxwQ
-a5ZJtJaqZ/nog1iVvc43Wjx+JQTUmc4mSswCT6iW5MbtGcLR/JMCdAk+JGH2JeCv
-Ryk0oG6WQl1F5Utouh2uv+bGAVukE8tlJh+PnyYgHuh3683BDpsyzUUgbhDE5pOc
-jqpVr2w71llRpSWycEXZlevGyU0htZ9aW6IeS8BqrBVVu0alpVIPq2y9zOzKY8w=
-=/XYl
+iQEcBAEBCgAGBQJLroRoAAoJEAWF714uGAc64tsH/385VlzbCy7PxvT5XP3jXoQ0
+XuQPcq2iLj8hmGBV1UtcWtMSfiHo1EbVzQNVWTYnvjRaOMGchuvnjkIKsP7xIWFC
+hf+ja06XVX7RTk95Ku2rb/MBua7S9iXzqwrWQrRtUJ4QCVlftX3Bf89MY/xVgDTT
+w1IttVNZue24HxlbZcvO8SoLmrH6sAHCyvEtPkOlI7yhJEY2ZXkqo3wRBLQuVNf5
+MFUzmcCs2tuiFc3MOUcYWuDOWNuop29NwNOn54zdJLxckiEu5UBYE7qvnRJnmoWy
+OP0+/ttblGbOxV9xlERQVYt1XPhK2X4CYopYqXSexV5zFQKYhc41wX7w22ETWAg=
+=k6Fy
 -----END PGP SIGNATURE-----
diff --git a/media-plugins/gimp-resynthesizer/files/smart-remove.scm b/media-plugins/gimp-resynthesizer/files/smart-remove.scm
new file mode 100644 (file)
index 0000000..7324ebd
--- /dev/null
@@ -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)
+)
+
index 97a73313b342031d9e5f91909b03582cf5a2ff5a..18ae2787376c197aa57433ef0431fa116cc8abe7 100644 (file)
@@ -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"
 }