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

« back to all changes in this revision

Viewing changes to plug-ins/script-fu/scripts/coolmetal-logo.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:
5
5
;  This script was inspired by Rob Malda's 'coolmetal.gif' graphic
6
6
 
7
7
(define (apply-cool-metal-logo-effect img
8
 
                                      logo-layer
9
 
                                      size
10
 
                                      bg-color
11
 
                                      gradient
12
 
                                      gradient-reverse)
13
 
  (let* ((feather (/ size 5))
14
 
         (smear 7.5)
15
 
         (period (/ size 3))
16
 
         (amplitude (/ size 40))
17
 
         (shrink (+ 1 (/ size 30)))
18
 
         (depth (/ size 20))
19
 
         (width (car (gimp-drawable-width logo-layer)))
20
 
         (height (car (gimp-drawable-height logo-layer)))
21
 
         (posx (- (car (gimp-drawable-offsets logo-layer))))
22
 
         (posy (- (cadr (gimp-drawable-offsets logo-layer))))
23
 
         (img-width (+ width (* 0.15 height) 10))
24
 
         (img-height (+ (* 1.85 height) 10))
25
 
         (bg-layer (car (gimp-layer-new img img-width img-height RGB-IMAGE "Background" 100 NORMAL-MODE)))
26
 
         (shadow-layer (car (gimp-layer-new img img-width img-height RGBA-IMAGE "Shadow" 100 NORMAL-MODE)))
27
 
         (reflect-layer (car (gimp-layer-new img width height RGBA-IMAGE "Reflection" 100 NORMAL-MODE)))
28
 
         (channel 0)
29
 
         (fs 0)
30
 
         (layer-mask 0))
 
8
                                      logo-layer
 
9
                                      size
 
10
                                      bg-color
 
11
                                      gradient
 
12
                                      gradient-reverse)
 
13
  (let* (
 
14
        (feather (/ size 5))
 
15
        (smear 7.5)
 
16
        (period (/ size 3))
 
17
        (amplitude (/ size 40))
 
18
        (shrink (+ 1 (/ size 30)))
 
19
        (depth (/ size 20))
 
20
        (width (car (gimp-drawable-width logo-layer)))
 
21
        (height (car (gimp-drawable-height logo-layer)))
 
22
        (posx (- (car (gimp-drawable-offsets logo-layer))))
 
23
        (posy (- (cadr (gimp-drawable-offsets logo-layer))))
 
24
        (img-width (+ width (* 0.15 height) 10))
 
25
        (img-height (+ (* 1.85 height) 10))
 
26
        (bg-layer (car (gimp-layer-new img img-width img-height RGB-IMAGE "Background" 100 NORMAL-MODE)))
 
27
        (shadow-layer (car (gimp-layer-new img img-width img-height RGBA-IMAGE "Shadow" 100 NORMAL-MODE)))
 
28
        (reflect-layer (car (gimp-layer-new img width height RGBA-IMAGE "Reflection" 100 NORMAL-MODE)))
 
29
        (channel 0)
 
30
        (fs 0)
 
31
        (layer-mask 0)
 
32
        )
31
33
 
32
34
    (gimp-context-push)
33
35
 
36
38
    (gimp-image-add-layer img bg-layer 1)
37
39
    (gimp-image-add-layer img reflect-layer 1)
38
40
    (gimp-image-add-layer img shadow-layer 1)
39
 
    (gimp-layer-set-preserve-trans logo-layer TRUE)
 
41
    (gimp-layer-set-lock-alpha logo-layer TRUE)
40
42
 
41
43
    (gimp-context-set-background bg-color)
42
44
    (gimp-edit-fill bg-layer BACKGROUND-FILL)
47
49
    (gimp-context-set-gradient gradient)
48
50
 
49
51
    (gimp-edit-blend logo-layer CUSTOM-MODE NORMAL-MODE
50
 
                     GRADIENT-LINEAR 100 0 REPEAT-NONE gradient-reverse
51
 
                     FALSE 0 0 TRUE
52
 
                     0 0 0 (+ height 5))
 
52
                     GRADIENT-LINEAR 100 0 REPEAT-NONE gradient-reverse
 
53
                     FALSE 0 0 TRUE
 
54
                     0 0 0 (+ height 5))
53
55
 
54
56
    (gimp-rect-select img 0 (- (/ height 2) feather) img-width (* 2 feather) CHANNEL-OP-REPLACE 0 0)
55
57
    (plug-in-gauss-iir 1 img logo-layer smear TRUE TRUE)
75
77
    (set! fs (car (gimp-selection-float shadow-layer 0 0)))
76
78
    (gimp-edit-clear shadow-layer)
77
79
    (gimp-drawable-transform-perspective-default fs
78
 
                                                 (+ 5 (* 0.15 height)) (- height (* 0.15 height))
79
 
                                                 (+ 5 width (* 0.15 height)) (- height (* 0.15 height))
80
 
                                                 5 height
81
 
                                                 (+ 5 width) height
82
 
                                                 FALSE FALSE)
 
80
                      (+ 5 (* 0.15 height)) (- height (* 0.15 height))
 
81
                      (+ 5 width (* 0.15 height)) (- height (* 0.15 height))
 
82
                      5 height
 
83
                      (+ 5 width) height
 
84
                      FALSE FALSE)
83
85
    (gimp-floating-sel-anchor fs)
84
86
    (plug-in-gauss-rle 1 img shadow-layer smear TRUE TRUE)
85
87
 
88
90
    (set! fs (car (gimp-edit-paste reflect-layer FALSE)))
89
91
    (gimp-floating-sel-anchor fs)
90
92
    (gimp-drawable-transform-scale-default reflect-layer
91
 
                                           0 0 width (* 0.85 height)
92
 
                                           FALSE FALSE)
 
93
                                           0 0 width (* 0.85 height)
 
94
                                           FALSE FALSE)
93
95
    (gimp-drawable-transform-flip-simple reflect-layer ORIENTATION-VERTICAL
94
 
                                         TRUE 0 TRUE)
 
96
                                         TRUE 0 TRUE)
95
97
    (gimp-layer-set-offsets reflect-layer 5 (+ 3 height))
96
98
 
97
99
    (set! layer-mask (car (gimp-layer-create-mask reflect-layer ADD-WHITE-MASK)))
99
101
    (gimp-context-set-foreground '(255 255 255))
100
102
    (gimp-context-set-background '(0 0 0))
101
103
    (gimp-edit-blend layer-mask FG-BG-RGB-MODE NORMAL-MODE
102
 
                     GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE
103
 
                     FALSE 0 0 TRUE
104
 
                     0 (- (/ height 2)) 0 height)
 
104
                     GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE
 
105
                     FALSE 0 0 TRUE
 
106
                     0 (- (/ height 2)) 0 height)
105
107
 
106
108
    (gimp-image-remove-channel img channel)
107
109
 
108
 
    (gimp-context-pop)))
 
110
    (gimp-context-pop)
 
111
  )
 
112
)
109
113
 
110
114
 
111
115
(define (script-fu-cool-metal-logo-alpha img
112
 
                                         logo-layer
113
 
                                         size
114
 
                                         bg-color
115
 
                                         gradient
116
 
                                         gradient-reverse)
 
116
                                         logo-layer
 
117
                                         size
 
118
                                         bg-color
 
119
                                         gradient
 
120
                                         gradient-reverse)
117
121
  (begin
118
122
    (gimp-image-undo-group-start img)
119
123
    (apply-cool-metal-logo-effect img logo-layer size bg-color
120
 
                                  gradient gradient-reverse)
 
124
                                  gradient gradient-reverse)
121
125
    (gimp-image-undo-group-end img)
122
 
    (gimp-displays-flush)))
 
126
    (gimp-displays-flush)
 
127
  )
 
128
)
123
129
 
124
130
(script-fu-register "script-fu-cool-metal-logo-alpha"
125
 
                    _"Cool _Metal..."
126
 
                    "Metallic logos with reflections and perspective shadows"
127
 
                    "Spencer Kimball & Rob Malda"
128
 
                    "Spencer Kimball & Rob Malda"
129
 
                    "1997"
130
 
                    "RGBA"
131
 
                    SF-IMAGE       "Image"                0
132
 
                    SF-DRAWABLE    "Drawable"             0
133
 
                    SF-ADJUSTMENT _"Effect size (pixels)" '(100 2 1000 1 10 0 1)
134
 
                    SF-COLOR      _"Background color"     '(255 255 255)
135
 
                    SF-GRADIENT   _"Gradient"             "Horizon 1"
136
 
                    SF-TOGGLE     _"Gradient reverse"     FALSE)
 
131
  _"Cool _Metal..."
 
132
  _"Add a metallic effect to the selected region (or alpha) with reflections and perspective shadows"
 
133
  "Spencer Kimball & Rob Malda"
 
134
  "Spencer Kimball & Rob Malda"
 
135
  "1997"
 
136
  "RGBA"
 
137
  SF-IMAGE      "Image"                 0
 
138
  SF-DRAWABLE   "Drawable"              0
 
139
  SF-ADJUSTMENT _"Effect size (pixels)" '(100 2 1000 1 10 0 1)
 
140
  SF-COLOR      _"Background color"     "white"
 
141
  SF-GRADIENT   _"Gradient"             "Horizon 1"
 
142
  SF-TOGGLE     _"Gradient reverse"     FALSE
 
143
)
137
144
 
138
145
(script-fu-menu-register "script-fu-cool-metal-logo-alpha"
139
 
                         _"<Image>/Script-Fu/Alpha to Logo")
 
146
                         "<Image>/Filters/Alpha to Logo")
140
147
 
141
148
 
142
149
(define (script-fu-cool-metal-logo text
143
 
                                   size
144
 
                                   font
145
 
                                   bg-color
146
 
                                   gradient
147
 
                                   gradient-reverse)
148
 
  (let* ((img (car (gimp-image-new 256 256 RGB)))
149
 
         (text-layer (car (gimp-text-fontname img -1 0 0 text 0 TRUE
150
 
                                              size PIXELS font))))
 
150
                                   size
 
151
                                   font
 
152
                                   bg-color
 
153
                                   gradient
 
154
                                   gradient-reverse)
 
155
  (let* (
 
156
        (img (car (gimp-image-new 256 256 RGB)))
 
157
        (text-layer (car (gimp-text-fontname img -1 0 0 text 0 TRUE
 
158
                                              size PIXELS font)))
 
159
        )
151
160
    (gimp-image-undo-disable img)
152
 
    (gimp-drawable-set-name text-layer text)
153
161
    (apply-cool-metal-logo-effect img text-layer size bg-color
154
 
                                  gradient gradient-reverse)
 
162
                                  gradient gradient-reverse)
155
163
    (gimp-image-undo-enable img)
156
 
    (gimp-display-new img)))
 
164
    (gimp-display-new img)
 
165
  )
 
166
)
157
167
 
158
168
(script-fu-register "script-fu-cool-metal-logo"
159
 
                    _"Cool _Metal..."
160
 
                    "Metallic logos with reflections and perspective shadows"
161
 
                    "Spencer Kimball & Rob Malda"
162
 
                    "Spencer Kimball & Rob Malda"
163
 
                    "1997"
164
 
                    ""
165
 
                    SF-STRING     _"Text"               "Cool Metal"
166
 
                    SF-ADJUSTMENT _"Font size (pixels)" '(100 2 1000 1 10 0 1)
167
 
                    SF-FONT       _"Font"               "Crillee"
168
 
                    SF-COLOR      _"Background color"   '(255 255 255)
169
 
                    SF-GRADIENT   _"Gradient"           "Horizon 1"
170
 
                    SF-TOGGLE     _"Gradient reverse"   FALSE)
 
169
  _"Cool _Metal..."
 
170
  _"Create a metallic logo with reflections and perspective shadows"
 
171
  "Spencer Kimball & Rob Malda"
 
172
  "Spencer Kimball & Rob Malda"
 
173
  "1997"
 
174
  ""
 
175
  SF-STRING     _"Text"               "Cool Metal"
 
176
  SF-ADJUSTMENT _"Font size (pixels)" '(100 2 1000 1 10 0 1)
 
177
  SF-FONT       _"Font"               "Crillee"
 
178
  SF-COLOR      _"Background color"   "white"
 
179
  SF-GRADIENT   _"Gradient"           "Horizon 1"
 
180
  SF-TOGGLE     _"Gradient reverse"   FALSE
 
181
)
171
182
 
172
183
(script-fu-menu-register "script-fu-cool-metal-logo"
173
 
                         _"<Toolbox>/Xtns/Script-Fu/Logos")
 
184
                         "<Toolbox>/Xtns/Logos")