mirror of https://github.com/GNOME/gimp.git
applied slightly modified patch from Aurimas Ju?ka which fixes bug #167260
2007-04-17 Sven Neumann <sven@gimp.org> * plug-ins/script-fu/scripts/neon-logo.scm: applied slightly modified patch from Aurimas Ju?ka which fixes bug #167260 by not allowing the selection to shrink too much. svn path=/trunk/; revision=22263
This commit is contained in:
parent
e198e7cba3
commit
ef339861d7
|
@ -1,3 +1,9 @@
|
|||
2007-04-17 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* plug-ins/script-fu/scripts/neon-logo.scm: applied slightly
|
||||
modified patch from Aurimas Juška which fixes bug #167260 by not
|
||||
allowing the selection to shrink too much.
|
||||
|
||||
2007-04-17 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/config/gimprc.c
|
||||
|
|
|
@ -1,5 +1,22 @@
|
|||
; NEON
|
||||
; Create a text effect that simulates neon lighting
|
||||
; GIMP - The GNU Image Manipulation Program
|
||||
; Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
;
|
||||
; 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.
|
||||
;
|
||||
; 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
;
|
||||
; NEON
|
||||
; Create a text effect that simulates neon lighting
|
||||
|
||||
(define (apply-neon-logo-effect img
|
||||
tube-layer
|
||||
|
@ -56,9 +73,12 @@
|
|||
0
|
||||
(begin
|
||||
(cond
|
||||
((= max-val R) (set! hue (/ (- G B) (* 1.0 delta))))
|
||||
((= max-val G) (set! hue (+ 2 (/ (- B R) (* 1.0 delta)))))
|
||||
((= max-val B) (set! hue (+ 4 (/ (- R G) (* 1.0 delta)))))
|
||||
((= max-val R)
|
||||
(set! hue (/ (- G B) (* 1.0 delta))))
|
||||
((= max-val G)
|
||||
(set! hue (+ 2 (/ (- B R) (* 1.0 delta)))))
|
||||
((= max-val B)
|
||||
(set! hue (+ 4 (/ (- R G) (* 1.0 delta)))))
|
||||
)
|
||||
(set! hue (* hue 60))
|
||||
(if (< hue 0) (set! hue (+ hue 360)))
|
||||
|
@ -84,16 +104,44 @@
|
|||
(shadow-offy (/ size 10))
|
||||
(width (car (gimp-drawable-width tube-layer)))
|
||||
(height (car (gimp-drawable-height tube-layer)))
|
||||
(glow-layer (car (gimp-layer-new img width height RGBA-IMAGE "Neon Glow" 100 NORMAL-MODE)))
|
||||
(bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))
|
||||
(glow-layer (car (gimp-layer-new img width height RGBA-IMAGE
|
||||
"Neon Glow" 100 NORMAL-MODE)))
|
||||
(bg-layer (car (gimp-layer-new img width height RGB-IMAGE
|
||||
"Background" 100 NORMAL-MODE)))
|
||||
(shadow-layer (if (= shadow TRUE)
|
||||
(car (gimp-layer-new img width height RGBA-IMAGE "Shadow" 100 NORMAL-MODE))
|
||||
(car (gimp-layer-new img width height RGBA-IMAGE
|
||||
"Shadow" 100 NORMAL-MODE))
|
||||
0))
|
||||
(selection 0)
|
||||
(max_shrink 0)
|
||||
)
|
||||
|
||||
(gimp-context-push)
|
||||
|
||||
; ensure that we don't shrink selection so much
|
||||
; that we create an empty selection.
|
||||
(gimp-selection-layer-alpha tube-layer)
|
||||
(while (= (car (gimp-selection-is-empty img)) FALSE)
|
||||
(begin
|
||||
(gimp-selection-shrink img 1)
|
||||
(set! max_shrink (+ max_shrink 1))
|
||||
; escape early if we know that we can perform
|
||||
; as much shrink steps as we want
|
||||
(if (> max_shrink shrink)
|
||||
(gimp-selection-none img))
|
||||
)
|
||||
)
|
||||
(if (= (car (gimp-selection-is-empty img)) TRUE)
|
||||
(if (> max_shrink 0)
|
||||
(set! max_shrink (- max_shrink 1))))
|
||||
; clamp upper bounds to valid shrink step range
|
||||
(if (> shrink max_shrink)
|
||||
(set! shrink max_shrink))
|
||||
(if (> inc-shrink (/ max_shrink 3))
|
||||
(set! inc-shrink (/ max_shrink 3)))
|
||||
(if (> shadow-shrink max_shrink)
|
||||
(set! shadow-shrink max_shrink))
|
||||
|
||||
(script-fu-util-image-resize-from-layer img tube-layer)
|
||||
(gimp-image-add-layer img bg-layer 1)
|
||||
(if (not (= shadow 0))
|
||||
|
@ -122,9 +170,11 @@
|
|||
(gimp-edit-clear tube-layer)
|
||||
|
||||
(gimp-selection-none img)
|
||||
(if (not (= feather1 0)) (plug-in-gauss-rle 1 img tube-layer feather1 TRUE TRUE))
|
||||
(if (not (= feather1 0))
|
||||
(plug-in-gauss-rle 1 img tube-layer feather1 TRUE TRUE))
|
||||
(gimp-selection-load selection)
|
||||
(if (not (= feather2 0)) (plug-in-gauss-rle 1 img tube-layer feather2 TRUE TRUE))
|
||||
(if (not (= feather2 0))
|
||||
(plug-in-gauss-rle 1 img tube-layer feather2 TRUE TRUE))
|
||||
|
||||
(gimp-selection-feather img inc-shrink)
|
||||
(gimp-selection-shrink img inc-shrink)
|
||||
|
|
Loading…
Reference in New Issue