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

« back to all changes in this revision

Viewing changes to plug-ins/script-fu/scripts/add-bevel.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
; add-bevel.scm version 1.04
54
54
                             work-on-copy
55
55
                             keep-bump-layer)
56
56
 
57
 
  (let* ((index 0)
58
 
         (bevelling-whole-image FALSE)
59
 
         (greyness 0)
60
 
         (thickness (abs thickness))
61
 
         (type (car (gimp-drawable-type-with-alpha drawable)))
62
 
         (image (if (= work-on-copy TRUE) (car (gimp-image-duplicate img)) img))
63
 
         (pic-layer (car (gimp-image-get-active-drawable image)))
64
 
         (offsets (gimp-drawable-offsets pic-layer))
65
 
         (width (car (gimp-drawable-width pic-layer)))
66
 
         (height (car (gimp-drawable-height pic-layer)))
 
57
  (let* (
 
58
        (index 1)
 
59
        (bevelling-whole-image FALSE)
 
60
        (greyness 0)
 
61
        (thickness (abs thickness))
 
62
        (type (car (gimp-drawable-type-with-alpha drawable)))
 
63
        (image (if (= work-on-copy TRUE) (car (gimp-image-duplicate img)) img))
 
64
        (pic-layer (car (gimp-image-get-active-drawable image)))
 
65
        (offsets (gimp-drawable-offsets pic-layer))
 
66
        (width (car (gimp-drawable-width pic-layer)))
 
67
        (height (car (gimp-drawable-height pic-layer)))
67
68
 
68
 
         ; Bumpmap has a one pixel border on each side
69
 
         (bump-layer (car (gimp-layer-new image
70
 
                                          (+ width 2)
71
 
                                          (+ height 2)
72
 
                                          GRAY
73
 
                                          "Bumpmap"
74
 
                                          100
75
 
                                          NORMAL-MODE)))
76
 
         (bevelling-whole-image TRUE)
77
 
         (select))
 
69
        ; Bumpmap has a one pixel border on each side
 
70
        (bump-layer (car (gimp-layer-new image
 
71
                                         (+ width 2)
 
72
                                         (+ height 2)
 
73
                                         GRAY
 
74
                                         "Bumpmap"
 
75
                                         100
 
76
                                         NORMAL-MODE)))
 
77
        (select)
 
78
        )
78
79
 
79
80
    (gimp-context-push)
80
81
 
103
104
              (gimp-selection-all image)
104
105
          )
105
106
        )
106
 
     )
 
107
    )
107
108
 
108
109
    ; Store it for later.
109
110
    (set! select (car (gimp-selection-save image)))
117
118
    (gimp-context-set-background '(0 0 0))
118
119
    (gimp-drawable-fill bump-layer BACKGROUND-FILL)
119
120
 
120
 
    (set! index 1)
121
121
    (while (< index thickness)
122
122
           (set! greyness (/ (* index 255) thickness))
123
123
           (gimp-context-set-background (list greyness greyness greyness))
161
161
    ; clean up
162
162
    (gimp-image-remove-channel image select)
163
163
    (if (= keep-bump-layer TRUE)
164
 
        (gimp-drawable-set-visible bump-layer 0)
165
 
        (gimp-image-remove-layer image bump-layer))
 
164
        (gimp-drawable-set-visible bump-layer 0)
 
165
        (gimp-image-remove-layer image bump-layer)
 
166
    )
166
167
 
167
168
    (gimp-image-set-active-layer image pic-layer)
168
169
 
169
170
    ; enable undo / end undo group
170
 
    (if (= work-on-copy TRUE) 
171
 
        (begin
172
 
          (gimp-display-new image)
173
 
          (gimp-image-undo-enable image))
174
 
        (gimp-image-undo-group-end image))
 
171
    (if (= work-on-copy TRUE)
 
172
      (begin
 
173
        (gimp-display-new image)
 
174
        (gimp-image-undo-enable image)
 
175
      )
 
176
      (gimp-image-undo-group-end image)
 
177
    )
175
178
 
176
179
    (gimp-displays-flush)
177
180
 
178
 
    (gimp-context-pop)))
 
181
    (gimp-context-pop)
 
182
  )
 
183
)
179
184
 
180
185
(script-fu-register "script-fu-add-bevel"
181
 
                    _"Add B_evel..."
182
 
                    "Add a bevel to an image"
183
 
                    "Andrew Donkin <ard@cs.waikato.ac.nz>"
184
 
                    "Andrew Donkin"
185
 
                    "1997/11/06"
186
 
                    "RGB* GRAY*"
187
 
                    SF-IMAGE       "Image"           0
188
 
                    SF-DRAWABLE    "Drawable"        0
189
 
                    SF-ADJUSTMENT _"Thickness"       '(5 0 30 1 2 0 0)
190
 
                    SF-TOGGLE     _"Work on copy"    TRUE
191
 
                    SF-TOGGLE     _"Keep bump layer" FALSE)
 
186
  _"Add B_evel..."
 
187
  _"Add a beveled border to an image"
 
188
  "Andrew Donkin <ard@cs.waikato.ac.nz>"
 
189
  "Andrew Donkin"
 
190
  "1997/11/06"
 
191
  "RGB* GRAY*"
 
192
  SF-IMAGE       "Image"           0
 
193
  SF-DRAWABLE    "Drawable"        0
 
194
  SF-ADJUSTMENT _"Thickness"       '(5 0 30 1 2 0 0)
 
195
  SF-TOGGLE     _"Work on copy"    TRUE
 
196
  SF-TOGGLE     _"Keep bump layer" FALSE
 
197
)
192
198
 
193
199
(script-fu-menu-register "script-fu-add-bevel"
194
 
                         _"<Image>/Script-Fu/Decor")
 
200
                         "<Image>/Filters/Decor")