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

« back to all changes in this revision

Viewing changes to plug-ins/script-fu/scripts/beveled-pattern-button.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
; Beveled pattern button for web pages
38
38
  (cadr (cddr extents)))
39
39
 
40
40
(define (script-fu-beveled-pattern-button
41
 
         text text-size font text-color pattern pressed)
42
 
  (let* ((text-extents (gimp-text-get-extents-fontname
43
 
                        text text-size PIXELS font))
44
 
         (ascent (text-ascent text-extents))
45
 
         (descent (text-descent text-extents))
46
 
 
47
 
         (xpadding 8)
48
 
         (ypadding 6)
49
 
 
50
 
         (width (+ (* 2 xpadding)
51
 
                   (text-width text-extents)))
52
 
         (height (+ (* 2 ypadding)
53
 
                    (+ ascent descent)))
54
 
 
55
 
         (img (car (gimp-image-new width height RGB)))
56
 
         (background (car (gimp-layer-new img width height RGBA-IMAGE "Background" 100 NORMAL-MODE)))
57
 
         (bumpmap (car (gimp-layer-new img width height RGBA-IMAGE "Bumpmap" 100 NORMAL-MODE)))
58
 
         (textl (car
59
 
                 (gimp-text-fontname
60
 
                  img -1 0 0 text 0 TRUE text-size PIXELS font))))
 
41
         text text-size font text-color pattern pressed)
 
42
  (let* (
 
43
        (text-extents (gimp-text-get-extents-fontname
 
44
                       text text-size PIXELS font))
 
45
        (ascent (text-ascent text-extents))
 
46
        (descent (text-descent text-extents))
 
47
 
 
48
        (xpadding 8)
 
49
        (ypadding 6)
 
50
 
 
51
        (width (+ (* 2 xpadding)
 
52
                  (text-width text-extents)))
 
53
        (height (+ (* 2 ypadding)
 
54
                   (+ ascent descent)))
 
55
 
 
56
        (img (car (gimp-image-new width height RGB)))
 
57
        (background (car (gimp-layer-new img width height RGBA-IMAGE "Background" 100 NORMAL-MODE)))
 
58
        (bumpmap (car (gimp-layer-new img width height RGBA-IMAGE "Bumpmap" 100 NORMAL-MODE)))
 
59
        (textl (car
 
60
                (gimp-text-fontname
 
61
                 img -1 0 0 text 0 TRUE text-size PIXELS font)))
 
62
        )
61
63
 
62
64
    (gimp-context-push)
63
65
 
93
95
    ; Color and position text
94
96
 
95
97
    (gimp-context-set-background text-color)
96
 
    (gimp-layer-set-preserve-trans textl TRUE)
 
98
    (gimp-layer-set-lock-alpha textl TRUE)
97
99
    (gimp-edit-fill textl BACKGROUND-FILL)
98
100
 
99
101
    (gimp-layer-set-offsets textl
100
 
                            xpadding
101
 
                            (+ ypadding descent))
 
102
                            xpadding
 
103
                            (+ ypadding descent))
102
104
 
103
105
    ; Clean up
104
106
 
109
111
    (gimp-image-undo-enable img)
110
112
    (gimp-display-new img)
111
113
 
112
 
    (gimp-context-pop)))
 
114
    (gimp-context-pop)
 
115
  )
 
116
)
113
117
 
114
118
 
115
119
(script-fu-register "script-fu-beveled-pattern-button"
116
 
                    _"B_utton..."
117
 
                    "Beveled pattern button"
118
 
                    "Federico Mena Quintero"
119
 
                    "Federico Mena Quintero"
120
 
                    "July 1997"
121
 
                    ""
122
 
                    SF-STRING     _"Text"               "Hello world!"
123
 
                    SF-ADJUSTMENT _"Font size (pixels)" '(32 2 1000 1 10 0 1)
124
 
                    SF-FONT       _"Font"               "Sans"
125
 
                    SF-COLOR      _"Text color"         '(0 0 0)
126
 
                    SF-PATTERN    _"Pattern"            "Wood"
127
 
                    SF-TOGGLE     _"Pressed"            FALSE)
 
120
  _"B_utton..."
 
121
  _"Create a beveled pattern button for webpages"
 
122
  "Federico Mena Quintero"
 
123
  "Federico Mena Quintero"
 
124
  "July 1997"
 
125
  ""
 
126
  SF-STRING     _"Text"               "Hello world!"
 
127
  SF-ADJUSTMENT _"Font size (pixels)" '(32 2 1000 1 10 0 1)
 
128
  SF-FONT       _"Font"               "Sans"
 
129
  SF-COLOR      _"Text color"         "black"
 
130
  SF-PATTERN    _"Pattern"            "Wood"
 
131
  SF-TOGGLE     _"Pressed"            FALSE
 
132
)
128
133
 
129
134
(script-fu-menu-register "script-fu-beveled-pattern-button"
130
 
                         _"<Toolbox>/Xtns/Script-Fu/Web Page Themes/Beveled Pattern")
 
135
                         "<Toolbox>/Xtns/Web Page Themes/Beveled Pattern")