From 068284dad2eb718fa5cbb275cab5a8f6efdcb653 Mon Sep 17 00:00:00 2001 From: Adrian Likins Date: Tue, 16 Dec 1997 00:02:55 +0000 Subject: [PATCH] removed a few old tips from gimp_tips.txt updated add-bevel.scm --- ChangeLog | 7 +++ gimp_tips.txt | 6 +-- plug-ins/script-fu/scripts/add-bevel.scm | 67 ++++++++++++++++++------ 3 files changed, 62 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index a9d4aa4478..d83b52f37a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Mon Dec 15 19:03:59 EST 1997 Adrian Likins + + * fixed a few broken tips in gimp_tips.txt + + * updated add-bevel.scm + + Sun Dec 14 19:47:59 PST 1997 Manish Singh * Configured in the flame plugin by default diff --git a/gimp_tips.txt b/gimp_tips.txt index d3f2cc8610..ddae170675 100644 --- a/gimp_tips.txt +++ b/gimp_tips.txt @@ -44,7 +44,9 @@ You can change the name of a layer by double-clicking on its name in the Layers dialog box. The layer named "Background" is special. You can't add transparency -or a layer mask to it. To add transparency, you must first "Add alpha" to the layer by right-clicking in the layers dialog and selecting "Add alpha to layer". +or a layer mask to it. To add transparency, you must first +"Add alpha" to the layer by right-clicking in the layers dialog + and selecting "Add alpha to layer". When using a drawing tool (Paintbrush, Airbrush, or Pencil), Shift-click will draw a straight line from your last drawing point to your current @@ -69,8 +71,6 @@ All the old channel operations have been replaced with the more powerful and flexible Layer and Layer Mode operations. They may take getting used to, but they are simply a better way to operate. -Brushes and patterns are viewed in small sections. You can drag them -around inside their little cells to view the whole brush or pattern. You can use the middle mouse button to pan around the image, if it's larger than its display window. diff --git a/plug-ins/script-fu/scripts/add-bevel.scm b/plug-ins/script-fu/scripts/add-bevel.scm index c29a9c4dc6..29abd0f0b2 100644 --- a/plug-ins/script-fu/scripts/add-bevel.scm +++ b/plug-ins/script-fu/scripts/add-bevel.scm @@ -1,8 +1,8 @@ ; The GIMP -- an image manipulation program ; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; -; add-bevel.scm version 1.00 -; Time-stamp: <97/09/05 14:31:31 ard> +; add-bevel.scm version 1.03 +; Time-stamp: <1997-12-16 09:17:24 ard> ; ; This program is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by @@ -22,7 +22,7 @@ ; Contains code from add-shadow.scm by Sven Neumann ; (neumanns@uni-duesseldorf.de) (thanks Sven). ; -; Adds a bevel to an image. +; Adds a bevel to an image. See http://www.cs.waikato.ac.nz/~ard/gimp/ ; ; If there is a selection, it is bevelled. ; Otherwise if there is an alpha channel, the selection is taken from it @@ -33,6 +33,18 @@ ; leave a cut-out. Then use Sven's add-shadow for that ; floating-bumpmapped-texture cliche. +; +; 1.01: now works on offset layers. +; 1.02: has crop-pixel-border option to trim one pixel off each edge of the +; bevelled image. Bumpmapping leaves edge pixels unchanged, which +; looks bad. Oddly, this is not apparant in the GIMP - you have to +; save the image and load it into another viewer. First noticed in +; Nutscrape. +; Changed path (removed "filters/"). +; 1.03: adds one-pixel border before bumpmapping, and removes it after. +; Got rid of the crop-pixel-border option (no longer reqd). +; + ; ; BUMPMAP NOTES: ; @@ -40,8 +52,10 @@ ; wrong bumpmap.c this script will either bomb (good) or produce a ; naff image (bad). ; -; As distributed this script expects bumpmap 2.03 or later. +; As distributed this script expects bumpmap 2.03 (shipped with Gimp 0.99.11) +; or later. +; ; BUGS ; ; Doesn't allow undoing the operation. Why not? @@ -57,12 +71,14 @@ keep-bump-layer) (let* ((index 0) + (bevelling-whole-image FALSE) (greyness 0) (thickness (abs thickness)) (type (car (gimp-drawable-type-with-alpha drawable))) (image (if (= work-on-copy TRUE) (car (gimp-channel-ops-duplicate img)) img)) - (width (car (gimp-image-width image))) - (height (car (gimp-image-height image))) + (pic-layer (car (gimp-image-active-drawable image))) + (width (car (gimp-drawable-width pic-layer))) + (height (car (gimp-drawable-height pic-layer))) (old-bg (car (gimp-palette-get-background))) (bump-layer (car (gimp-layer-new image width @@ -72,6 +88,12 @@ 100 NORMAL))) ) + ; + ; If the layer we're bevelling is offset from the image's origin, we + ; have to do the same to the bumpmap + (let ((offsets (gimp-drawable-offsets pic-layer))) + (gimp-layer-set-offsets bump-layer (car offsets) (cadr offsets)) + ) (gimp-image-disable-undo image) @@ -79,12 +101,17 @@ ; ; Set the selection to the area we want to bevel. ; - (set! pic-layer (car (gimp-image-active-drawable image))) (if (eq? 0 (car (gimp-selection-bounds image))) - (if (not (eq? 0 (car (gimp-drawable-has-alpha pic-layer)))) ; Wish I knew Scheme - (gimp-selection-layer-alpha image pic-layer) - (gimp-selection-all image) - ) + (begin + (set! bevelling-whole-image TRUE) ; ...so we can restore things properly, and crop. + (gimp-image-resize image (+ width 2) (+ height 2) 1 1) + (if (not (eq? 0 (car (gimp-drawable-has-alpha pic-layer)))) ; Wish I knew Scheme + (gimp-selection-layer-alpha image pic-layer) + (begin + (gimp-selection-all image) + ) + ) + ) ) ; Store it for later. @@ -134,6 +161,13 @@ ; (plug-in-bump-map 1 image pic-layer bump-layer 125 45 3 0 0 TRUE FALSE 1) (plug-in-bump-map 1 image pic-layer bump-layer 125 45 3 0 0 0 0 TRUE FALSE 1) + ; + ; Shave one pixel off each edge + ; + (if (= bevelling-whole-image TRUE) + (gimp-crop image width height 1 1) + ) + (if (= work-on-copy FALSE) (gimp-image-disable-undo image)) ;------------------------------------------------------------ @@ -141,12 +175,15 @@ ; Restore things ; (gimp-palette-set-background old-bg) - (gimp-selection-load image select) - ; they can Select->Invert then Edit->Clear for a cutout. + (if (= bevelling-whole-image TRUE) + (gimp-selection-none image) ; No selection to start with + (gimp-selection-load image select) + ) + ; If they started with a selection, they can Select->Invert then + ; Edit->Clear for a cutout. ; clean up (gimp-image-remove-channel image select) - (gimp-image-set-active-layer image pic-layer) (if (= keep-bump-layer TRUE) (begin (gimp-image-add-layer image bump-layer 1) @@ -169,7 +206,7 @@ "Add a bevel to an image." "Andrew Donkin (ard@cs.waikato.ac.nz)" "Andrew Donkin" - "1997/07/17" + "1997/11/06" "RGB RGBA GRAY GRAYA" SF-IMAGE "Image" 0 SF-DRAWABLE "Drawable" 0