~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to plug-ins/script-fu/scripts/predator.scm

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
; The GIMP -- an image manipulation program
 
1
; GIMP - The GNU Image Manipulation Program
2
2
; Copyright (C) 1995 Spencer Kimball and Peter Mattis
3
 
 
3
;
4
4
; Predator effect
5
5
; Copyright (c) 1997 Adrian Likins
6
6
; aklikins@eos.ncsu.ed
7
7
;
8
 
;  The idea here is too make the image/selection look sort of like 
 
8
;  The idea here is too make the image/selection look sort of like
9
9
;  the view the predator had in the movies. ie, kind of a thermogram
10
10
;  type of thing. Works best on colorful rgb images.
11
11
;
13
13
; it under the terms of the GNU General Public License as published by
14
14
; the Free Software Foundation; either version 2 of the License, or
15
15
; (at your option) any later version.
16
 
 
16
;
17
17
; This program is distributed in the hope that it will be useful,
18
18
; but WITHOUT ANY WARRANTY; without even the implied warranty of
19
19
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
20
; GNU General Public License for more details.
21
 
 
21
;
22
22
; You should have received a copy of the GNU General Public License
23
23
; along with this program; if not, write to the Free Software
24
24
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25
25
 
26
26
 
27
27
(define (script-fu-predator image
28
 
                            drawable
29
 
                            edge-amount
30
 
                            pixelize
31
 
                            pixel-size
32
 
                            keep-selection
33
 
                            separate-layer)
 
28
                            drawable
 
29
                            edge-amount
 
30
                            pixelize
 
31
                            pixel-size
 
32
                            keep-selection
 
33
                            separate-layer)
34
34
  (let* (
35
 
         (type (car (gimp-drawable-type-with-alpha drawable)))
36
 
         (image-width (car (gimp-image-width image)))
37
 
         (image-height (car (gimp-image-height image)))
38
 
     (active-selection)
39
 
     (from-selection)
40
 
     (selection-bounds)
41
 
     (select-offset-x)
42
 
     (select-offset-y)
43
 
     (select-width)
44
 
     (select-height)
45
 
     (effect-layer)
46
 
     (active-layer))
47
 
    
 
35
        (type (car (gimp-drawable-type-with-alpha drawable)))
 
36
        (image-width (car (gimp-image-width image)))
 
37
        (image-height (car (gimp-image-height image)))
 
38
        (active-selection)
 
39
        (from-selection)
 
40
        (selection-bounds)
 
41
        (select-offset-x)
 
42
        (select-offset-y)
 
43
        (select-width)
 
44
        (select-height)
 
45
        (effect-layer)
 
46
        (active-layer)
 
47
        )
 
48
 
48
49
    (gimp-image-undo-group-start image)
49
50
    (gimp-layer-add-alpha drawable)
50
 
    
 
51
 
51
52
    (if (= (car (gimp-selection-is-empty image)) TRUE)
52
 
        (begin
53
 
          (gimp-selection-layer-alpha drawable)
54
 
          (set! active-selection (car (gimp-selection-save image)))
55
 
          (set! from-selection FALSE))
56
 
        (begin
57
 
          
58
 
          (set! from-selection TRUE)
59
 
          (set! active-selection (car (gimp-selection-save image)))))
60
 
    
 
53
        (begin
 
54
          (gimp-selection-layer-alpha drawable)
 
55
          (set! active-selection (car (gimp-selection-save image)))
 
56
          (set! from-selection FALSE)
 
57
        )
 
58
        (begin
 
59
          (set! from-selection TRUE)
 
60
          (set! active-selection (car (gimp-selection-save image)))
 
61
        )
 
62
    )
 
63
 
61
64
    (set! selection-bounds (gimp-selection-bounds image))
62
65
    (set! select-offset-x (cadr selection-bounds))
63
66
    (set! select-offset-y (caddr selection-bounds))
64
67
    (set! select-width (- (cadr (cddr selection-bounds)) select-offset-x))
65
68
    (set! select-height (- (caddr (cddr selection-bounds)) select-offset-y))
66
 
    
 
69
 
67
70
    (if (= separate-layer TRUE)
68
 
        (begin
69
 
          (set! effect-layer (car (gimp-layer-new image
70
 
                                                select-width
71
 
                                                select-height
72
 
                                                type
73
 
                                                "glow layer"
74
 
                                                100
75
 
                                                NORMAL-MODE)))
76
 
    
77
 
          (gimp-layer-set-offsets effect-layer select-offset-x select-offset-y)
78
 
          (gimp-image-add-layer image effect-layer -1)
79
 
          (gimp-selection-none image)
80
 
          (gimp-edit-clear effect-layer)
81
 
    
82
 
          (gimp-selection-load active-selection)
83
 
          (gimp-edit-copy drawable)
84
 
          (let ((floating-sel (car (gimp-edit-paste effect-layer FALSE))))
85
 
            (gimp-floating-sel-anchor floating-sel)
86
 
            )
87
 
      (gimp-image-set-active-layer image effect-layer ))
88
 
      (set! effect-layer drawable)
 
71
        (begin
 
72
          (set! effect-layer (car (gimp-layer-new image
 
73
                                                  select-width
 
74
                                                  select-height
 
75
                                                  type
 
76
                                                  "glow layer"
 
77
                                                  100
 
78
                                                  NORMAL-MODE))
 
79
          )
 
80
 
 
81
          (gimp-layer-set-offsets effect-layer select-offset-x select-offset-y)
 
82
          (gimp-image-add-layer image effect-layer -1)
 
83
          (gimp-selection-none image)
 
84
          (gimp-edit-clear effect-layer)
 
85
 
 
86
          (gimp-selection-load active-selection)
 
87
          (gimp-edit-copy drawable)
 
88
          (let ((floating-sel (car (gimp-edit-paste effect-layer FALSE))))
 
89
            (gimp-floating-sel-anchor floating-sel)
 
90
          )
 
91
          (gimp-image-set-active-layer image effect-layer)
 
92
        )
 
93
        (set! effect-layer drawable)
89
94
    )
90
95
    (set! active-layer effect-layer)
91
96
 
92
97
    ; all the fun stuff goes here
93
98
    (if (= pixelize TRUE)
94
 
        (plug-in-pixelize 1 image active-layer pixel-size))
 
99
        (plug-in-pixelize 1 image active-layer pixel-size)
 
100
    )
95
101
    (plug-in-max-rgb 1 image active-layer 0)
96
102
    (plug-in-edge 1 image active-layer edge-amount 1 0)
97
 
    
 
103
 
98
104
    ; clean up the selection copy
99
105
    (gimp-selection-load active-selection)
100
 
    
 
106
 
101
107
    (if (= keep-selection FALSE)
102
 
        (gimp-selection-none image))
103
 
    
 
108
        (gimp-selection-none image)
 
109
    )
 
110
 
104
111
    (gimp-image-set-active-layer image drawable)
105
112
    (gimp-image-remove-channel image active-selection)
106
113
    (gimp-image-undo-group-end image)
107
 
    (gimp-displays-flush)))
 
114
    (gimp-displays-flush)
 
115
  )
 
116
)
108
117
 
109
118
(script-fu-register "script-fu-predator"
110
 
                    _"_Predator..."
111
 
                    "Looks like images from the movie Predator"
112
 
                    "Adrian Likins <adrian@gimp.org>"
113
 
                    "Adrian Likins"
114
 
                    "10/12/97"
115
 
                    "RGB*"
116
 
                    SF-IMAGE       "Image"          0
117
 
                    SF-DRAWABLE    "Drawable"       0
118
 
                    SF-ADJUSTMENT _"Edge amount"    '(2 0 24 1 1 0 0)
119
 
                    SF-TOGGLE     _"Pixelize"       TRUE
120
 
                    SF-ADJUSTMENT _"Pixel amount"   '(3 1 16 1 1 0 0)
121
 
                    SF-TOGGLE     _"Keep selection" TRUE
122
 
                    SF-TOGGLE     _"Separate layer" TRUE)
 
119
  _"_Predator..."
 
120
  _"Add a 'Predator' effect to the selected region (or alpha)"
 
121
  "Adrian Likins <adrian@gimp.org>"
 
122
  "Adrian Likins"
 
123
  "10/12/97"
 
124
  "RGB*"
 
125
  SF-IMAGE       "Image"          0
 
126
  SF-DRAWABLE    "Drawable"       0
 
127
  SF-ADJUSTMENT _"Edge amount"    '(2 0 24 1 1 0 0)
 
128
  SF-TOGGLE     _"Pixelize"       TRUE
 
129
  SF-ADJUSTMENT _"Pixel amount"   '(3 1 16 1 1 0 0)
 
130
  SF-TOGGLE     _"Keep selection" TRUE
 
131
  SF-TOGGLE     _"Separate layer" TRUE
 
132
)
123
133
 
124
134
(script-fu-menu-register "script-fu-predator"
125
 
                         _"<Image>/Script-Fu/Alchemy")
 
135
                         "<Image>/Filters/Artistic")