~ubuntu-branches/ubuntu/breezy/gimp/breezy

« back to all changes in this revision

Viewing changes to plug-ins/script-fu/scripts/alien-glow-bullet.scm

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2005-10-04 19:04:46 UTC
  • Revision ID: james.westby@ubuntu.com-20051004190446-ukh32kwk56s4sjhu
Tags: upstream-2.2.8
ImportĀ upstreamĀ versionĀ 2.2.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
; The GIMP -- an image manipulation program
 
2
; Copyright (C) 1995 Spencer Kimball and Peter Mattis
 
3
 
4
; Alien Glow themed bullets for web pages
 
5
; Copyright (c) 1997 Adrian Likins
 
6
; aklikins@eos.ncsu.edu 
 
7
;
 
8
; This program is free software; you can redistribute it and/or modify
 
9
; it under the terms of the GNU General Public License as published by
 
10
; the Free Software Foundation; either version 2 of the License, or
 
11
; (at your option) any later version.
 
12
 
13
; This program is distributed in the hope that it will be useful,
 
14
; but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
; GNU General Public License for more details.
 
17
 
18
; You should have received a copy of the GNU General Public License
 
19
; along with this program; if not, write to the Free Software
 
20
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
21
 
 
22
(define (center-ellipse img
 
23
                        cx
 
24
                        cy
 
25
                        rx
 
26
                        ry
 
27
                        op
 
28
                        aa
 
29
                        feather
 
30
                        frad)
 
31
  (gimp-ellipse-select img (- cx rx) (- cy ry) (+ rx rx) (+ ry ry)
 
32
                       op aa feather frad))
 
33
 
 
34
 
 
35
(define (script-fu-alien-glow-bullet radius
 
36
                                     glow-color
 
37
                                     bg-color
 
38
                                     flatten)
 
39
  (let* ((img (car (gimp-image-new radius radius RGB)))
 
40
         (border (/ radius 4))
 
41
         (diameter (* radius 2))
 
42
         (half-radius (/ radius 2))
 
43
         (blend-start (+ half-radius (/ half-radius 2)))
 
44
         (bullet-layer (car (gimp-layer-new img
 
45
                                            diameter diameter RGBA-IMAGE
 
46
                                            "Ruler" 100 NORMAL-MODE)))
 
47
         (glow-layer (car (gimp-layer-new img diameter diameter RGBA-IMAGE
 
48
                                          "ALien Glow" 100 NORMAL-MODE)))
 
49
         (bg-layer (car (gimp-layer-new img diameter diameter RGB-IMAGE
 
50
                                        "Background" 100 NORMAL-MODE))))
 
51
 
 
52
    (gimp-context-push)
 
53
 
 
54
    (gimp-image-undo-disable img)
 
55
    (gimp-image-resize img diameter diameter 0 0)
 
56
    (gimp-image-add-layer img bg-layer 1)
 
57
    (gimp-image-add-layer img glow-layer -1)
 
58
    (gimp-image-add-layer img bullet-layer -1)
 
59
 
 
60
    ; (gimp-layer-set-preserve-trans ruler-layer TRUE)
 
61
    (gimp-context-set-background bg-color)
 
62
    (gimp-edit-fill bg-layer BACKGROUND-FILL)
 
63
    (gimp-edit-clear glow-layer)
 
64
    (gimp-edit-clear bullet-layer)
 
65
 
 
66
    (center-ellipse img radius radius half-radius half-radius
 
67
                    CHANNEL-OP-REPLACE TRUE FALSE 0)
 
68
    
 
69
    ; (gimp-rect-select img (/ height 2) (/ height 2) length height CHANNEL-OP-REPLACE FALSE 0)
 
70
    (gimp-context-set-foreground '(90 90 90))
 
71
    (gimp-context-set-background '(0 0 0))
 
72
 
 
73
    (gimp-edit-blend bullet-layer FG-BG-RGB-MODE NORMAL-MODE
 
74
                     GRADIENT-RADIAL 100 0 REPEAT-NONE FALSE
 
75
                     FALSE 0 0 TRUE
 
76
                     blend-start blend-start
 
77
                     (+ half-radius radius) (+ half-radius radius))
 
78
 
 
79
    (gimp-context-set-foreground glow-color)
 
80
    (gimp-selection-grow img border)
 
81
    (gimp-selection-feather img  border)
 
82
    (gimp-edit-fill glow-layer FOREGROUND-FILL)
 
83
    (gimp-selection-none img)
 
84
    (if (>= radius 16)
 
85
        (plug-in-gauss-rle 1 img glow-layer 25 TRUE TRUE)
 
86
        (plug-in-gauss-rle 1 img glow-layer 12 TRUE TRUE))
 
87
 
 
88
    (if (= flatten TRUE)
 
89
        (gimp-image-flatten img))
 
90
    (gimp-image-undo-enable img)
 
91
    (gimp-display-new img)
 
92
 
 
93
    (gimp-context-pop)))
 
94
 
 
95
(script-fu-register "script-fu-alien-glow-bullet"
 
96
                    _"_Bullet..."
 
97
                    "Create a Bullet with an Alien Glow theme for web pages"
 
98
                    "Adrian Likins"
 
99
                    "Adrian Likins"
 
100
                    "1997"
 
101
                    ""
 
102
                    SF-ADJUSTMENT _"Radius"           '(16 1 100 1 10 0 1)
 
103
                    SF-COLOR      _"Glow color"       '(63 252 0)
 
104
                    SF-COLOR      _"Background color" '(0 0 0)
 
105
                    SF-TOGGLE     _"Flatten image"    TRUE)
 
106
 
 
107
(script-fu-menu-register "script-fu-alien-glow-bullet"
 
108
                         _"<Toolbox>/Xtns/Script-Fu/Web Page Themes/Alien Glow")