~ubuntu-branches/ubuntu/hoary/gimp/hoary

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2005-04-04 14:51:23 UTC
  • Revision ID: james.westby@ubuntu.com-20050404145123-9py049eeelfymur8
Tags: upstream-2.2.2
ImportĀ upstreamĀ versionĀ 2.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
;  DROP-SHADOW-LOGO
 
2
;  draw the specified text over a background with a drop shadow
 
3
 
 
4
(define (apply-basic1-logo-effect img
 
5
                                  logo-layer
 
6
                                  bg-color
 
7
                                  text-color)
 
8
  (let* ((width (car (gimp-drawable-width logo-layer)))
 
9
         (height (car (gimp-drawable-height logo-layer)))
 
10
         (bg-layer (car (gimp-layer-new img width height RGBA-IMAGE "Background" 100 NORMAL-MODE)))
 
11
         (shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE "Shadow" 100 MULTIPLY-MODE))))
 
12
 
 
13
    (gimp-context-push)
 
14
 
 
15
    (gimp-selection-none img)
 
16
    (script-fu-util-image-resize-from-layer img logo-layer)
 
17
    (gimp-image-add-layer img shadow-layer 1)
 
18
    (gimp-image-add-layer img bg-layer 2)
 
19
    (gimp-context-set-foreground text-color)
 
20
    (gimp-layer-set-preserve-trans logo-layer TRUE)
 
21
    (gimp-edit-fill logo-layer FOREGROUND-FILL)
 
22
    (gimp-context-set-background bg-color)
 
23
    (gimp-edit-fill bg-layer BACKGROUND-FILL)
 
24
    (gimp-edit-clear shadow-layer)
 
25
    (gimp-selection-layer-alpha logo-layer)
 
26
    (gimp-context-set-background '(0 0 0))
 
27
    (gimp-selection-feather img 7.5)
 
28
    (gimp-edit-fill shadow-layer BACKGROUND-FILL)
 
29
    (gimp-selection-none img)
 
30
    (gimp-context-set-foreground '(255 255 255))
 
31
 
 
32
    (gimp-edit-blend logo-layer FG-BG-RGB-MODE MULTIPLY-MODE
 
33
                     GRADIENT-RADIAL 100 20 REPEAT-NONE FALSE
 
34
                     FALSE 0 0 TRUE
 
35
                     0 0 width height)
 
36
 
 
37
    (gimp-layer-translate shadow-layer 3 3)
 
38
 
 
39
    (gimp-context-pop)))
 
40
 
 
41
(define (script-fu-basic1-logo-alpha img
 
42
                                     logo-layer
 
43
                                     bg-color
 
44
                                     text-color)
 
45
  (begin
 
46
    (gimp-image-undo-group-start img)
 
47
    (apply-basic1-logo-effect img logo-layer bg-color text-color)
 
48
    (gimp-image-undo-group-end img)
 
49
    (gimp-displays-flush)))
 
50
 
 
51
(script-fu-register "script-fu-basic1-logo-alpha"
 
52
                    _"_Basic I..."
 
53
                    "Creates a simple logo with a drop shadow"
 
54
                    "Spencer Kimball"
 
55
                    "Spencer Kimball"
 
56
                    "1996"
 
57
                    "RGBA"
 
58
                    SF-IMAGE      "Image"             0
 
59
                    SF-DRAWABLE   "Drawable"          0
 
60
                    SF-COLOR      _"Background color" '(255 255 255)
 
61
                    SF-COLOR      _"Text color"       '(6 6 206))
 
62
 
 
63
(script-fu-menu-register "script-fu-basic1-logo-alpha"
 
64
                         _"<Image>/Script-Fu/Alpha to Logo")
 
65
 
 
66
 
 
67
(define (script-fu-basic1-logo text
 
68
                               size
 
69
                               font
 
70
                               bg-color
 
71
                               text-color)
 
72
  (let* ((img (car (gimp-image-new 256 256 RGB)))
 
73
         (text-layer (car (gimp-text-fontname img -1 0 0 text 10 TRUE size PIXELS font))))
 
74
 
 
75
    (gimp-image-undo-disable img)
 
76
    (gimp-drawable-set-name text-layer text)
 
77
    (apply-basic1-logo-effect img text-layer bg-color text-color)
 
78
    (gimp-image-undo-enable img)
 
79
    (gimp-display-new img)))
 
80
 
 
81
(script-fu-register "script-fu-basic1-logo"
 
82
                    _"_Basic I..."
 
83
                    "Creates a simple logo with a drop shadow"
 
84
                    "Spencer Kimball"
 
85
                    "Spencer Kimball"
 
86
                    "1996"
 
87
                    ""
 
88
                    SF-STRING     _"Text"               "The Gimp"
 
89
                    SF-ADJUSTMENT _"Font size (pixels)" '(100 2 1000 1 10 0 1)
 
90
                    SF-FONT       _"Font"               "Dragonwick"
 
91
                    SF-COLOR      _"Background color"   '(255 255 255)
 
92
                    SF-COLOR      _"Text color"         '(6 6 206))
 
93
 
 
94
(script-fu-menu-register "script-fu-basic1-logo"
 
95
                         _"<Toolbox>/Xtns/Script-Fu/Logos")