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

« back to all changes in this revision

Viewing changes to plug-ins/script-fu/scripts/chip-away.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
;  Supposed to look vaguely like roughly carved wood. Chipped away if you will.
5
5
;
6
 
;  Options: Text String -  the string to make the logo from
7
 
;           Font        -  which font to use
8
 
;           Font Size   -  how big
 
6
;  Options: Text String - the string to make the logo from
 
7
;           Font        - which font to use
 
8
;           Font Size   - how big
9
9
;           Chip Amount - how rought he chipping is (how spread the bump map is)
10
10
;           Blur Amount - the bump layer is blurred slighty by this amount
11
11
;           Invert      - whether or not to invert the bumpmap (gives a carved in feel)
12
12
;           Drop Shadow - whether or not to draw a drop shadow
13
13
;           Keep bump layer? - whether to keep the layer used as the bump map
14
14
;           fill bg with pattern? - whether to fill the background with the pattern or leave it white
15
 
;           Keep Backgroun - whether or not to remove the background layer
 
15
;           Keep Background - whether or not to remove the background layer
16
16
;
17
17
;  Adrian Likins  (Adrian@gimp.org)
18
18
;  Jan 11, 1998 v1
37
37
;
38
38
 
39
39
(define (apply-chip-away-logo-effect img
40
 
                                     logo-layer
41
 
                                     spread-amount
42
 
                                     blur-amount
43
 
                                     invert
44
 
                                     drop-shadow
45
 
                                     keep-bump
46
 
                                     bg-fill
47
 
                                     keep-back
48
 
                                     pattern)
49
 
  (let* ((width (car (gimp-drawable-width logo-layer)))
50
 
         (height (car (gimp-drawable-height logo-layer)))
51
 
         (bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))
52
 
         (bump-layer (car (gimp-layer-new img width height RGBA-IMAGE "Bump Layer" 100 NORMAL-MODE))))
 
40
                                     logo-layer
 
41
                                     spread-amount
 
42
                                     blur-amount
 
43
                                     invert
 
44
                                     drop-shadow
 
45
                                     keep-bump
 
46
                                     bg-fill
 
47
                                     keep-back
 
48
                                     pattern)
 
49
  (let* (
 
50
        (width (car (gimp-drawable-width logo-layer)))
 
51
        (height (car (gimp-drawable-height logo-layer)))
 
52
        (bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))
 
53
        (bump-layer (car (gimp-layer-new img width height RGBA-IMAGE "Bump Layer" 100 NORMAL-MODE)))
 
54
        )
53
55
 
54
56
    (gimp-context-push)
55
57
 
56
58
    (script-fu-util-image-resize-from-layer img logo-layer)
57
59
    (gimp-image-add-layer img bg-layer 1)
58
 
    (gimp-layer-set-preserve-trans logo-layer TRUE)
 
60
    (gimp-layer-set-lock-alpha logo-layer TRUE)
59
61
    (gimp-context-set-pattern pattern)
60
62
 
61
63
    (gimp-context-set-background '(255 255 255))
62
64
    (gimp-selection-all img)
63
65
 
64
66
    (if (= bg-fill TRUE)
65
 
        (gimp-edit-bucket-fill bg-layer 2 NORMAL-MODE 100 255 FALSE 1 1)
66
 
        (gimp-edit-fill bg-layer BACKGROUND-FILL))
 
67
        (gimp-edit-bucket-fill bg-layer
 
68
                               PATTERN-BUCKET-FILL NORMAL-MODE
 
69
                               100 255 FALSE 1 1)
 
70
        (gimp-edit-fill bg-layer BACKGROUND-FILL)
 
71
    )
67
72
 
68
73
    (gimp-image-add-layer img bump-layer 1)
69
74
 
72
77
    (gimp-selection-none img)
73
78
    (gimp-selection-layer-alpha logo-layer)
74
79
    (gimp-edit-fill bump-layer BACKGROUND-FILL)
75
 
    (gimp-edit-bucket-fill logo-layer 2 NORMAL-MODE 100 255 FALSE 1 1)
 
80
    (gimp-edit-bucket-fill logo-layer
 
81
                           PATTERN-BUCKET-FILL NORMAL-MODE 100 255 FALSE 1 1)
76
82
    (gimp-selection-none img)
77
83
 
78
 
    (gimp-layer-set-preserve-trans bump-layer FALSE)
 
84
    (gimp-layer-set-lock-alpha bump-layer FALSE)
79
85
    (plug-in-spread 1 img bump-layer spread-amount spread-amount)
80
86
    (gimp-selection-layer-alpha bump-layer)
81
87
    (plug-in-gauss-rle 1 img bump-layer blur-amount TRUE TRUE)
82
88
 
83
89
    (gimp-selection-none img)
84
90
 
85
 
    (plug-in-bump-map 1 img logo-layer bump-layer 135.00 25.0 60 0 0 0 0 TRUE invert 1)
 
91
    (plug-in-bump-map 1 img logo-layer bump-layer
 
92
                      135.00 25.0 60 0 0 0 0 TRUE invert 1)
86
93
 
87
94
    (gimp-drawable-set-visible bump-layer FALSE)
88
95
 
89
96
     (if (= drop-shadow TRUE)
90
 
        (begin
91
 
          (let* ((shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE "Shadow layer" 100 NORMAL-MODE))))
92
 
            (gimp-image-add-layer img shadow-layer 1)
93
 
            (gimp-selection-all img)
94
 
            (gimp-edit-clear shadow-layer)
95
 
            (gimp-selection-none img)
96
 
            (gimp-selection-layer-alpha logo-layer)
97
 
            (gimp-context-set-background '(0 0 0))
98
 
            (gimp-edit-fill shadow-layer BACKGROUND-FILL)
99
 
            (gimp-selection-none img)
100
 
            (plug-in-gauss-rle 1 img shadow-layer 5 TRUE TRUE)
101
 
            (gimp-layer-translate shadow-layer 6 6))))
 
97
        (begin
 
98
          (let* ((shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE "Shadow layer" 100 NORMAL-MODE))))
 
99
            (gimp-image-add-layer img shadow-layer 1)
 
100
            (gimp-selection-all img)
 
101
            (gimp-edit-clear shadow-layer)
 
102
            (gimp-selection-none img)
 
103
            (gimp-selection-layer-alpha logo-layer)
 
104
            (gimp-context-set-background '(0 0 0))
 
105
            (gimp-edit-fill shadow-layer BACKGROUND-FILL)
 
106
            (gimp-selection-none img)
 
107
            (plug-in-gauss-rle 1 img shadow-layer 5 TRUE TRUE)
 
108
            (gimp-layer-translate shadow-layer 6 6))))
102
109
 
103
110
     (if (= keep-bump FALSE)
104
 
         (gimp-image-remove-layer img bump-layer))
 
111
         (gimp-image-remove-layer img bump-layer))
105
112
 
106
113
     (if (= keep-back FALSE)
107
 
         (gimp-image-remove-layer img bg-layer))
 
114
         (gimp-image-remove-layer img bg-layer))
108
115
 
109
 
    (gimp-context-pop)))
 
116
    (gimp-context-pop)
 
117
  )
 
118
)
110
119
 
111
120
(define (script-fu-chip-away-logo-alpha img
112
 
                                        logo-layer
113
 
                                        spread-amount
114
 
                                        blur-amount
115
 
                                        invert
116
 
                                        drop-shadow
117
 
                                        keep-bump
118
 
                                        bg-fill
119
 
                                        keep-back
120
 
                                        pattern)
 
121
                                        logo-layer
 
122
                                        spread-amount
 
123
                                        blur-amount
 
124
                                        invert
 
125
                                        drop-shadow
 
126
                                        keep-bump
 
127
                                        bg-fill
 
128
                                        keep-back
 
129
                                        pattern)
121
130
  (begin
122
131
    (gimp-image-undo-group-start img)
123
132
    (apply-chip-away-logo-effect img logo-layer spread-amount blur-amount
124
 
                                 invert drop-shadow keep-bump bg-fill
125
 
                                 keep-back pattern)
 
133
                                 invert drop-shadow keep-bump bg-fill
 
134
                                 keep-back pattern)
126
135
    (gimp-image-undo-group-end img)
127
 
    (gimp-displays-flush)))
 
136
    (gimp-displays-flush)
 
137
  )
 
138
)
128
139
 
129
140
(script-fu-register "script-fu-chip-away-logo-alpha"
130
 
                    _"Chip Awa_y..."
131
 
                    "Chip away effect"
132
 
                    "Adrian Likins <adrian@gimp.org>"
133
 
                    "Adrian Likins <adrian@gimp.org>"
134
 
                    "1997"
135
 
                    "RGBA"
136
 
                    SF-IMAGE      "Image"                 0
137
 
                    SF-DRAWABLE   "Drawable"              0
138
 
                    SF-ADJUSTMENT _"Chip amount"          '(30 0 250 1 10 0 1)
139
 
                    SF-ADJUSTMENT _"Blur amount"          '(3 1 100 1 10 1 0)
140
 
                    SF-TOGGLE     _"Invert"               FALSE
141
 
                    SF-TOGGLE     _"Drop shadow"          TRUE
142
 
                    SF-TOGGLE     _"Keep bump layer"      FALSE
143
 
                    SF-TOGGLE     _"Fill BG with pattern" TRUE
144
 
                    SF-TOGGLE     _"Keep background"      TRUE
145
 
                    SF-PATTERN    _"Pattern"              "Burlwood")
 
141
  _"Chip Awa_y..."
 
142
  _"Add a chipped woodcarving effect to the selected region (or alpha)"
 
143
  "Adrian Likins <adrian@gimp.org>"
 
144
  "Adrian Likins <adrian@gimp.org>"
 
145
  "1997"
 
146
  "RGBA"
 
147
  SF-IMAGE      "Image"                 0
 
148
  SF-DRAWABLE   "Drawable"              0
 
149
  SF-ADJUSTMENT _"Chip amount"          '(30 0 250 1 10 0 1)
 
150
  SF-ADJUSTMENT _"Blur amount"          '(3 1 100 1 10 1 0)
 
151
  SF-TOGGLE     _"Invert"               FALSE
 
152
  SF-TOGGLE     _"Drop shadow"          TRUE
 
153
  SF-TOGGLE     _"Keep bump layer"      FALSE
 
154
  SF-TOGGLE     _"Fill BG with pattern" TRUE
 
155
  SF-TOGGLE     _"Keep background"      TRUE
 
156
  SF-PATTERN    _"Pattern"              "Burlwood"
 
157
)
146
158
 
147
159
(script-fu-menu-register "script-fu-chip-away-logo-alpha"
148
 
                         _"<Image>/Script-Fu/Alpha to Logo")
 
160
                         "<Image>/Filters/Alpha to Logo")
149
161
 
150
162
 
151
163
(define (script-fu-chip-away-logo text
152
 
                                  font
153
 
                                  font-size
154
 
                                  spread-amount
155
 
                                  blur-amount
156
 
                                  invert
157
 
                                  drop-shadow
158
 
                                  keep-bump
159
 
                                  bg-fill
160
 
                                  keep-back
161
 
                                  pattern)
 
164
                                  font
 
165
                                  font-size
 
166
                                  spread-amount
 
167
                                  blur-amount
 
168
                                  invert
 
169
                                  drop-shadow
 
170
                                  keep-bump
 
171
                                  bg-fill
 
172
                                  keep-back
 
173
                                  pattern)
162
174
  (let* ((img (car (gimp-image-new 256 256 RGB)))
163
 
         (text-layer (car (gimp-text-fontname img -1 0 0
164
 
                                     text 30 TRUE font-size PIXELS font))))
 
175
         (text-layer (car (gimp-text-fontname img -1 0 0
 
176
                                     text 30 TRUE font-size PIXELS font))))
165
177
    (gimp-image-undo-disable img)
166
 
    (gimp-drawable-set-name text-layer text)
167
178
    (apply-chip-away-logo-effect img text-layer spread-amount blur-amount
168
 
                                 invert drop-shadow keep-bump bg-fill
169
 
                                 keep-back pattern)
 
179
                                 invert drop-shadow keep-bump bg-fill
 
180
                                 keep-back pattern)
170
181
    (gimp-image-undo-enable img)
171
 
    (gimp-display-new img)))
 
182
    (gimp-display-new img)
 
183
  )
 
184
)
172
185
 
173
186
(script-fu-register "script-fu-chip-away-logo"
174
 
                    _"Chip Awa_y..."
175
 
                    "Chip away effect"
176
 
                    "Adrian Likins <adrian@gimp.org>"
177
 
                    "Adrian Likins <adrian@gimp.org>"
178
 
                    "1997"
179
 
                    ""
180
 
                    SF-STRING     _"Text"                 "Sloth"
181
 
                    SF-FONT       _"Font"                 "RoostHeavy"
182
 
                    SF-ADJUSTMENT _"Font size (pixels)"   '(200 2 1000 1 10 0 1)
183
 
                    SF-ADJUSTMENT _"Chip amount"          '(30 0 250 1 10 0 1)
184
 
                    SF-ADJUSTMENT _"Blur amount"          '(3 1 100 1 10 1 0)
185
 
                    SF-TOGGLE     _"Invert"               FALSE
186
 
                    SF-TOGGLE     _"Drop shadow"          TRUE
187
 
                    SF-TOGGLE     _"Keep bump layer"      FALSE
188
 
                    SF-TOGGLE     _"Fill BG with pattern" TRUE
189
 
                    SF-TOGGLE     _"Keep background"      TRUE
190
 
                    SF-PATTERN    _"Pattern"              "Burlwood")
 
187
  _"Chip Awa_y..."
 
188
  _"Create a logo resembling a chipped wood carving"
 
189
  "Adrian Likins <adrian@gimp.org>"
 
190
  "Adrian Likins <adrian@gimp.org>"
 
191
  "1997"
 
192
  ""
 
193
  SF-STRING     _"Text"                 "Sloth"
 
194
  SF-FONT       _"Font"                 "RoostHeavy"
 
195
  SF-ADJUSTMENT _"Font size (pixels)"   '(200 2 1000 1 10 0 1)
 
196
  SF-ADJUSTMENT _"Chip amount"          '(30 0 250 1 10 0 1)
 
197
  SF-ADJUSTMENT _"Blur amount"          '(3 1 100 1 10 1 0)
 
198
  SF-TOGGLE     _"Invert"               FALSE
 
199
  SF-TOGGLE     _"Drop shadow"          TRUE
 
200
  SF-TOGGLE     _"Keep bump layer"      FALSE
 
201
  SF-TOGGLE     _"Fill BG with pattern" TRUE
 
202
  SF-TOGGLE     _"Keep background"      TRUE
 
203
  SF-PATTERN    _"Pattern"              "Burlwood"
 
204
)
191
205
 
192
206
(script-fu-menu-register "script-fu-chip-away-logo"
193
 
                         _"<Toolbox>/Xtns/Script-Fu/Logos")
 
207
                         "<Toolbox>/Xtns/Logos")