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

« back to all changes in this revision

Viewing changes to plug-ins/script-fu/scripts/comic-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:
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
; This program is free software; you can redistribute it and/or modify
5
5
; it under the terms of the GNU General Public License as published by
6
6
; the Free Software Foundation; either version 2 of the License, or
7
7
; (at your option) any later version.
8
 
 
8
;
9
9
; This program is distributed in the hope that it will be useful,
10
10
; but WITHOUT ANY WARRANTY; without even the implied warranty of
11
11
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
12
; GNU General Public License for more details.
13
 
 
13
;
14
14
; You should have received a copy of the GNU General Public License
15
15
; along with this program; if not, write to the Free Software
16
16
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
20
;  Creates snazzy-looking text, inspired by watching a Maxx marathon :)
21
21
 
22
22
(define (apply-comic-logo-effect img
23
 
                                 logo-layer
24
 
                                 gradient
25
 
                                 gradient-reverse
26
 
                                 ol-width
27
 
                                 ol-color
28
 
                                 bg-color)
29
 
  (let* ((width (car (gimp-drawable-width logo-layer)))
30
 
         (height (car (gimp-drawable-height logo-layer)))
31
 
         (posx (- (car (gimp-drawable-offsets logo-layer))))
32
 
         (posy (- (cadr (gimp-drawable-offsets logo-layer))))
33
 
         (bg-layer (car (gimp-layer-new img width height RGBA-IMAGE
34
 
                                        "Background" 100 NORMAL-MODE)))
35
 
         (white-layer (car (gimp-layer-copy logo-layer 1)))
36
 
         (black-layer (car (gimp-layer-copy logo-layer 1))))
 
23
                                 logo-layer
 
24
                                 gradient
 
25
                                 gradient-reverse
 
26
                                 ol-width
 
27
                                 ol-color
 
28
                                 bg-color)
 
29
  (let* (
 
30
        (width (car (gimp-drawable-width logo-layer)))
 
31
        (height (car (gimp-drawable-height logo-layer)))
 
32
        (posx (- (car (gimp-drawable-offsets logo-layer))))
 
33
        (posy (- (cadr (gimp-drawable-offsets logo-layer))))
 
34
        (bg-layer (car (gimp-layer-new img width height RGBA-IMAGE
 
35
                                       "Background" 100 NORMAL-MODE)))
 
36
        (white-layer (car (gimp-layer-copy logo-layer 1)))
 
37
        (black-layer (car (gimp-layer-copy logo-layer 1)))
 
38
        )
37
39
 
38
40
    (gimp-context-push)
39
41
 
45
47
    (gimp-image-add-layer img black-layer 1)
46
48
    (gimp-layer-translate black-layer posx posy)
47
49
    (gimp-drawable-set-name black-layer "Black")
48
 
  
 
50
 
49
51
    (gimp-selection-all img)
50
52
    (gimp-context-set-background bg-color)
51
53
    (gimp-edit-fill bg-layer BACKGROUND-FILL)
52
54
    (gimp-selection-none img)
53
55
 
54
 
    (gimp-layer-set-preserve-trans white-layer TRUE)
 
56
    (gimp-layer-set-lock-alpha white-layer TRUE)
55
57
    (gimp-context-set-background ol-color)
56
58
    (gimp-selection-all img)
57
59
    (gimp-edit-fill white-layer BACKGROUND-FILL)
58
 
    (gimp-layer-set-preserve-trans white-layer FALSE)
 
60
    (gimp-layer-set-lock-alpha white-layer FALSE)
59
61
    (plug-in-spread 1 img white-layer (* 3 ol-width) (* 3 ol-width))
60
62
    (plug-in-gauss-rle 1 img white-layer (* 2 ol-width) 1 1)
61
63
    (plug-in-threshold-alpha 1 img white-layer 0)
62
 
    (gimp-layer-set-preserve-trans white-layer TRUE)
 
64
    (gimp-layer-set-lock-alpha white-layer TRUE)
63
65
    (gimp-edit-fill white-layer BACKGROUND-FILL)
64
66
    (gimp-selection-none img)
65
67
 
66
68
    (gimp-context-set-background '(0 0 0))
67
 
    (gimp-layer-set-preserve-trans black-layer TRUE)
 
69
    (gimp-layer-set-lock-alpha black-layer TRUE)
68
70
    (gimp-selection-all img)
69
71
    (gimp-edit-fill black-layer BACKGROUND-FILL)
70
72
    (gimp-selection-none img)
71
 
    (gimp-layer-set-preserve-trans black-layer FALSE)
 
73
    (gimp-layer-set-lock-alpha black-layer FALSE)
72
74
    (plug-in-gauss-rle 1 img black-layer ol-width 1 1)
73
75
    (plug-in-threshold-alpha 1 img black-layer 0)
74
76
 
75
77
    (gimp-context-set-gradient gradient)
76
 
    (gimp-layer-set-preserve-trans logo-layer TRUE)
 
78
    (gimp-layer-set-lock-alpha logo-layer TRUE)
77
79
    (gimp-selection-all img)
78
80
 
79
81
    (gimp-edit-blend logo-layer CUSTOM-MODE NORMAL-MODE
80
 
                     GRADIENT-LINEAR 100 0 REPEAT-NONE gradient-reverse
81
 
                     FALSE 0 0 TRUE
82
 
                     0 (* height 0.3) 0 (* height 0.78))
 
82
                     GRADIENT-LINEAR 100 0 REPEAT-NONE gradient-reverse
 
83
                     FALSE 0 0 TRUE
 
84
                     0 (* height 0.3) 0 (* height 0.78))
83
85
 
84
86
    (plug-in-noisify 1 img logo-layer 0 0.20 0.20 0.20 0.20)
85
87
    (gimp-selection-none img)
86
 
    (gimp-layer-set-preserve-trans logo-layer FALSE)
 
88
    (gimp-layer-set-lock-alpha logo-layer FALSE)
87
89
    (gimp-brightness-contrast logo-layer 0 30)
88
90
    (plug-in-threshold-alpha 1 img logo-layer 60)
89
91
    (gimp-image-set-active-layer img logo-layer)
90
92
 
91
 
    (gimp-context-pop)))
 
93
    (gimp-context-pop)
 
94
  )
 
95
)
92
96
 
93
97
(define (script-fu-comic-logo-alpha img
94
 
                                    logo-layer
95
 
                                    gradient
96
 
                                    gradient-reverse
97
 
                                    ol-width
98
 
                                    ol-color
99
 
                                    bg-color)
 
98
                                    logo-layer
 
99
                                    gradient
 
100
                                    gradient-reverse
 
101
                                    ol-width
 
102
                                    ol-color
 
103
                                    bg-color)
100
104
  (begin
101
105
    (gimp-image-undo-group-start img)
102
106
    (apply-comic-logo-effect img logo-layer
103
 
                             gradient gradient-reverse
104
 
                             ol-width ol-color bg-color)
 
107
                             gradient gradient-reverse
 
108
                             ol-width ol-color bg-color)
105
109
    (gimp-image-undo-group-end img)
106
 
    (gimp-displays-flush)))
 
110
    (gimp-displays-flush)
 
111
  )
 
112
)
107
113
 
108
114
(script-fu-register "script-fu-comic-logo-alpha"
109
 
                    _"Comic Boo_k..."
110
 
                    "Comic-book Style Logos"
111
 
                    "Brian McFee <keebler@wco.com>"
112
 
                    "Brian McFee"
113
 
                    "April 1998"
114
 
                    "RGBA"
115
 
                    SF-IMAGE       "Image"            0
116
 
                    SF-DRAWABLE    "Drawable"         0
117
 
                    SF-GRADIENT   _"Gradient"         "Incandescent"
118
 
                    SF-TOGGLE     _"Gradient reverse" FALSE
119
 
                    SF-ADJUSTMENT _"Outline size"     '(5 1 100 1 10 0 1)
120
 
                    SF-COLOR      _"Outline color"    '(255 255 255)
121
 
                    SF-COLOR      _"Background color" '(255 255 255))
 
115
  _"Comic Boo_k..."
 
116
  _"Add a comic-book effect to the selected region (or alpha) by outlining and filling with a gradient"
 
117
  "Brian McFee <keebler@wco.com>"
 
118
  "Brian McFee"
 
119
  "April 1998"
 
120
  "RGBA"
 
121
  SF-IMAGE      "Image"             0
 
122
  SF-DRAWABLE   "Drawable"          0
 
123
  SF-GRADIENT   _"Gradient"         "Incandescent"
 
124
  SF-TOGGLE     _"Gradient reverse" FALSE
 
125
  SF-ADJUSTMENT _"Outline size"     '(5 1 100 1 10 0 1)
 
126
  SF-COLOR      _"Outline color"    "white"
 
127
  SF-COLOR      _"Background color" "white"
 
128
)
122
129
 
123
130
(script-fu-menu-register "script-fu-comic-logo-alpha"
124
 
                         _"<Image>/Script-Fu/Alpha to Logo")
 
131
                         "<Image>/Filters/Alpha to Logo")
125
132
 
126
133
 
127
134
(define (script-fu-comic-logo text
128
 
                              size
129
 
                              font
130
 
                              gradient
131
 
                              gradient-reverse
132
 
                              ol-width
133
 
                              ol-color
134
 
                              bg-color)
 
135
                              size
 
136
                              font
 
137
                              gradient
 
138
                              gradient-reverse
 
139
                              ol-width
 
140
                              ol-color
 
141
                              bg-color)
135
142
  (let* ((img (car (gimp-image-new 256 256 RGB)))
136
143
         (border (/ size 4))
137
 
         (text-layer (car (gimp-text-fontname
138
 
                           img -1 0 0 text border TRUE size PIXELS font))))
 
144
         (text-layer (car (gimp-text-fontname
 
145
                           img -1 0 0 text border TRUE size PIXELS font))))
139
146
    (gimp-image-undo-disable img)
140
 
    (gimp-drawable-set-name text-layer text)
141
147
    (apply-comic-logo-effect img text-layer gradient gradient-reverse
142
 
                             ol-width ol-color bg-color)
 
148
                             ol-width ol-color bg-color)
143
149
    (gimp-image-undo-enable img)
144
 
    (gimp-display-new img)))
 
150
    (gimp-display-new img)
 
151
  )
 
152
)
145
153
 
146
154
(script-fu-register "script-fu-comic-logo"
147
 
                    _"Comic Boo_k..."
148
 
                    "Comic-book Style Logos"
149
 
                    "Brian McFee <keebler@wco.com>"
150
 
                    "Brian McFee"
151
 
                    "April 1998"
152
 
                    ""
153
 
                    SF-STRING     _"Text"               "Moo"
154
 
                    SF-ADJUSTMENT _"Font size (pixels)" '(85 2 1000 1 10 0 1)
155
 
                    SF-FONT       _"Font"               "Tribeca"
156
 
                    SF-GRADIENT   _"Gradient"           "Incandescent"
157
 
                    SF-TOGGLE     _"Gradient reverse"   FALSE
158
 
                    SF-ADJUSTMENT _"Outline size"       '(5 1 100 1 10 0 1)
159
 
                    SF-COLOR      _"Outline color"      '(255 255 255)
160
 
                    SF-COLOR      _"Background color"   '(255 255 255))
 
155
  _"Comic Boo_k..."
 
156
  _"Create a comic-book style logo by outlining and filling with a gradient"
 
157
  "Brian McFee <keebler@wco.com>"
 
158
  "Brian McFee"
 
159
  "April 1998"
 
160
  ""
 
161
  SF-STRING     _"Text"               "Moo"
 
162
  SF-ADJUSTMENT _"Font size (pixels)" '(85 2 1000 1 10 0 1)
 
163
  SF-FONT       _"Font"               "Tribeca"
 
164
  SF-GRADIENT   _"Gradient"           "Incandescent"
 
165
  SF-TOGGLE     _"Gradient reverse"   FALSE
 
166
  SF-ADJUSTMENT _"Outline size"       '(5 1 100 1 10 0 1)
 
167
  SF-COLOR      _"Outline color"      "white"
 
168
  SF-COLOR      _"Background color"   "white"
 
169
)
161
170
 
162
171
(script-fu-menu-register "script-fu-comic-logo"
163
 
                         _"<Toolbox>/Xtns/Script-Fu/Logos")
 
172
                         "<Toolbox>/Xtns/Logos")