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

« back to all changes in this revision

Viewing changes to plug-ins/script-fu/scripts/basic2-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
1
;  HIGHLIGHT-DROP-SHADOW-LOGO
2
2
;  draw the specified text over a background with a drop shadow and a highlight
3
3
 
4
 
(define (color-highlight color)
5
 
  (let ((r (car color))
6
 
        (g (cadr color))
7
 
        (b (caddr color)))
8
 
 
9
 
    (set! r (+ r (* (- 255 r) 0.75)))
10
 
    (set! g (+ g (* (- 255 g) 0.75)))
11
 
    (set! b (+ b (* (- 255 b) 0.75)))
12
 
    (list r g b)))
13
 
 
14
4
(define (apply-basic2-logo-effect img
15
 
                                  logo-layer
16
 
                                  bg-color
17
 
                                  text-color)
18
 
  (let* ((width (car (gimp-drawable-width logo-layer)))
19
 
         (height (car (gimp-drawable-height logo-layer)))
20
 
         (posx (- (car (gimp-drawable-offsets logo-layer))))
21
 
         (posy (- (cadr (gimp-drawable-offsets logo-layer))))
22
 
         (bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))
23
 
         (highlight-layer (car (gimp-layer-copy logo-layer TRUE)))
24
 
         (shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE "Shadow" 100 MULTIPLY-MODE))))
 
5
                                  logo-layer
 
6
                                  bg-color
 
7
                                  text-color)
 
8
 
 
9
  (define (color-highlight color)
 
10
    (let (
 
11
         (r (car color))
 
12
         (g (cadr color))
 
13
         (b (caddr color))
 
14
         )
 
15
 
 
16
      (set! r (+ r (* (- 255 r) 0.75)))
 
17
      (set! g (+ g (* (- 255 g) 0.75)))
 
18
      (set! b (+ b (* (- 255 b) 0.75)))
 
19
      (list r g b)
 
20
    )
 
21
  )
 
22
 
 
23
  (let* (
 
24
        (width (car (gimp-drawable-width logo-layer)))
 
25
        (height (car (gimp-drawable-height logo-layer)))
 
26
        (posx (- (car (gimp-drawable-offsets logo-layer))))
 
27
        (posy (- (cadr (gimp-drawable-offsets logo-layer))))
 
28
        (bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))
 
29
        (highlight-layer (car (gimp-layer-copy logo-layer TRUE)))
 
30
        (shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE "Shadow" 100 MULTIPLY-MODE)))
 
31
        )
25
32
 
26
33
    (gimp-context-push)
27
34
 
31
38
    (gimp-image-add-layer img shadow-layer 1)
32
39
    (gimp-image-add-layer img highlight-layer 1)
33
40
    (gimp-context-set-foreground text-color)
34
 
    (gimp-layer-set-preserve-trans logo-layer TRUE)
 
41
    (gimp-layer-set-lock-alpha logo-layer TRUE)
35
42
    (gimp-edit-fill logo-layer FOREGROUND-FILL)
36
43
    (gimp-edit-clear shadow-layer)
37
44
    (gimp-context-set-foreground (color-highlight text-color))
38
 
    (gimp-layer-set-preserve-trans highlight-layer TRUE)
 
45
    (gimp-layer-set-lock-alpha highlight-layer TRUE)
39
46
    (gimp-edit-fill highlight-layer FOREGROUND-FILL)
40
47
    (gimp-context-set-background bg-color)
41
48
    (gimp-drawable-fill bg-layer BACKGROUND-FILL)
47
54
    (gimp-context-set-foreground '(255 255 255))
48
55
 
49
56
    (gimp-edit-blend logo-layer FG-BG-RGB-MODE MULTIPLY-MODE
50
 
                     GRADIENT-RADIAL 100 20 REPEAT-NONE FALSE
51
 
                     FALSE 0 0 TRUE
52
 
                     0 0 width height)
 
57
                     GRADIENT-RADIAL 100 20 REPEAT-NONE FALSE
 
58
                     FALSE 0 0 TRUE
 
59
                     0 0 width height)
53
60
 
54
61
    (gimp-layer-translate shadow-layer 3 3)
55
62
    (gimp-layer-translate highlight-layer (- posx 2) (- posy 2))
56
63
    (gimp-drawable-set-name highlight-layer "Highlight")
57
64
 
58
 
    (gimp-context-pop)))
 
65
    (gimp-context-pop)
 
66
  )
 
67
)
59
68
 
60
69
(define (script-fu-basic2-logo-alpha img
61
 
                                     logo-layer
62
 
                                     bg-color
63
 
                                     text-color)
 
70
                                     logo-layer
 
71
                                     bg-color
 
72
                                     text-color)
64
73
  (begin
65
74
    (gimp-image-undo-group-start img)
66
75
    (apply-basic2-logo-effect img logo-layer bg-color text-color)
67
76
    (gimp-image-undo-group-end img)
68
 
    (gimp-displays-flush)))
 
77
    (gimp-displays-flush)
 
78
  )
 
79
)
69
80
 
70
81
(script-fu-register "script-fu-basic2-logo-alpha"
71
 
                    _"B_asic II..."
72
 
                    "Creates a simple logo with a shadow and a highlight"
73
 
                    "Spencer Kimball"
74
 
                    "Spencer Kimball"
75
 
                    "1996"
76
 
                    "RGBA"
77
 
                    SF-IMAGE      "Image" 0
78
 
                    SF-DRAWABLE   "Drawable" 0
79
 
                    SF-COLOR      _"Background color" '(255 255 255)
80
 
                    SF-COLOR      _"Text color" '(206 6 50))
81
 
 
82
 
(script-fu-menu-register "script-fu-basic2-logo-alpha"
83
 
                         _"<Image>/Script-Fu/Alpha to Logo")
84
 
 
 
82
    _"B_asic II..."
 
83
    _"Add a shadow and a highlight to the selected region (or alpha)"
 
84
    "Spencer Kimball"
 
85
    "Spencer Kimball"
 
86
    "1996"
 
87
    "RGBA"
 
88
    SF-IMAGE      "Image"             0
 
89
    SF-DRAWABLE   "Drawable"          0
 
90
    SF-COLOR      _"Background color" "white"
 
91
    SF-COLOR      _"Text color"       '(206 6 50)
 
92
)
85
93
 
86
94
(define (script-fu-basic2-logo text
87
 
                               size
88
 
                               font
89
 
                               bg-color
90
 
                               text-color)
91
 
  (let* ((img (car (gimp-image-new 256 256 RGB)))
92
 
         (text-layer (car (gimp-text-fontname img -1 0 0 text 10 TRUE size PIXELS font))))
 
95
                               size
 
96
                               font
 
97
                               bg-color
 
98
                               text-color)
 
99
  (let* (
 
100
        (img (car (gimp-image-new 256 256 RGB)))
 
101
        (text-layer (car (gimp-text-fontname img -1 0 0 text 10 TRUE size PIXELS font)))
 
102
        )
93
103
 
94
104
    (gimp-image-undo-disable img)
95
 
    (gimp-drawable-set-name text-layer text)
96
105
    (apply-basic2-logo-effect img text-layer bg-color text-color)
97
106
    (gimp-image-undo-enable img)
98
 
    (gimp-display-new img)))
 
107
    (gimp-display-new img)
 
108
  )
 
109
)
 
110
 
 
111
(script-fu-menu-register "script-fu-basic2-logo-alpha"
 
112
                         "<Image>/Filters/Alpha to Logo")
99
113
 
100
114
(script-fu-register "script-fu-basic2-logo"
101
 
                    _"B_asic II..."
102
 
                    "Creates a simple logo with a shadow and a highlight"
103
 
                    "Spencer Kimball"
104
 
                    "Spencer Kimball"
105
 
                    "1996"
106
 
                    ""
107
 
                    SF-STRING     _"Text"               "SCRIPT-FU"
108
 
                    SF-ADJUSTMENT _"Font size (pixels)" '(150 2 1000 1 10 0 1)
109
 
                    SF-FONT       _"Font"               "Sans Bold"
110
 
                    SF-COLOR      _"Background color"   '(255 255 255)
111
 
                    SF-COLOR      _"Text color"         '(206 6 50))
 
115
    _"B_asic II..."
 
116
    _"Create a simple logo with a shadow and a highlight"
 
117
    "Spencer Kimball"
 
118
    "Spencer Kimball"
 
119
    "1996"
 
120
    ""
 
121
    SF-STRING     _"Text"               "SCRIPT-FU"
 
122
    SF-ADJUSTMENT _"Font size (pixels)" '(150 2 1000 1 10 0 1)
 
123
    SF-FONT       _"Font"               "Sans Bold"
 
124
    SF-COLOR      _"Background color"   "white"
 
125
    SF-COLOR      _"Text color"         '(206 6 50)
 
126
)
112
127
 
113
128
(script-fu-menu-register "script-fu-basic2-logo"
114
 
                         _"<Toolbox>/Xtns/Script-Fu/Logos")
 
129
                         "<Toolbox>/Xtns/Logos")