~ubuntu-branches/ubuntu/maverick/gimp/maverick-updates

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2005-12-09 19:44:52 UTC
  • Revision ID: james.westby@ubuntu.com-20051209194452-yggpemjlofpjqyf4
Tags: upstream-2.2.9
ImportĀ upstreamĀ versionĀ 2.2.9

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
; This program is free software; you can redistribute it and/or modify
 
5
; it under the terms of the GNU General Public License as published by
 
6
; the Free Software Foundation; either version 2 of the License, or
 
7
; (at your option) any later version.
 
8
 
9
; This program is distributed in the hope that it will be useful,
 
10
; but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
; GNU General Public License for more details.
 
13
 
14
; You should have received a copy of the GNU General Public License
 
15
; along with this program; if not, write to the Free Software
 
16
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
17
;
 
18
;  Bovinated Logos v0.1 04/08/98
 
19
;  by Brian McFee <keebler@wco.com>
 
20
;  Creates Cow-spotted logs.. what else?
 
21
 
 
22
(define (apply-bovinated-logo-effect img
 
23
                                     logo-layer
 
24
                                     spots-x
 
25
                                     spots-y
 
26
                                     bg-color)
 
27
  (let* ((width (car (gimp-drawable-width logo-layer)))
 
28
         (height (car (gimp-drawable-height logo-layer)))
 
29
         (bg-layer (car (gimp-layer-new img
 
30
                                        width height RGBA-IMAGE
 
31
                                        "Background" 100 NORMAL-MODE)))
 
32
         (blur-layer (car (gimp-layer-new img
 
33
                                          width height RGBA-IMAGE
 
34
                                          "Blur" 100 NORMAL-MODE))))
 
35
 
 
36
    (gimp-context-push)
 
37
 
 
38
    (script-fu-util-image-resize-from-layer img logo-layer)
 
39
    (gimp-image-add-layer img bg-layer 1)
 
40
    (gimp-image-add-layer img blur-layer 1)
 
41
 
 
42
    (gimp-selection-all img)
 
43
    (gimp-context-set-background bg-color)
 
44
    (gimp-edit-fill bg-layer BACKGROUND-FILL)
 
45
    (gimp-selection-none img)
 
46
 
 
47
    (gimp-layer-set-preserve-trans blur-layer TRUE)
 
48
    (gimp-context-set-background '(255 255 255))
 
49
    (gimp-selection-all img)
 
50
    (gimp-edit-fill blur-layer BACKGROUND-FILL)
 
51
    (gimp-edit-clear blur-layer)
 
52
    (gimp-context-set-background '(191 191 191))
 
53
    (gimp-selection-none img)
 
54
    (gimp-layer-set-preserve-trans blur-layer FALSE)
 
55
    (gimp-selection-layer-alpha logo-layer)
 
56
    (gimp-edit-fill blur-layer BACKGROUND-FILL)
 
57
    (plug-in-gauss-rle 1 img blur-layer 5.0 1 1)
 
58
    (gimp-selection-none img)
 
59
    (gimp-layer-set-preserve-trans logo-layer TRUE)
 
60
    (gimp-selection-all img)
 
61
    (plug-in-solid-noise 1 img logo-layer 0 0 23 1 spots-x spots-y)
 
62
    (gimp-brightness-contrast logo-layer 0 127)
 
63
    (gimp-selection-none img)
 
64
    (gimp-layer-set-preserve-trans logo-layer FALSE)
 
65
    (plug-in-bump-map 1 img logo-layer blur-layer
 
66
                      135 50 10 0 0 0 30 TRUE FALSE 0)
 
67
    (gimp-layer-set-offsets blur-layer 5 5)
 
68
    (gimp-invert blur-layer)
 
69
    (gimp-layer-set-opacity blur-layer 50.0)
 
70
    (gimp-image-set-active-layer img logo-layer)
 
71
 
 
72
    (gimp-context-pop)))
 
73
 
 
74
(define (script-fu-bovinated-logo-alpha img
 
75
                                        logo-layer
 
76
                                        spots-x
 
77
                                        spots-y
 
78
                                        bg-color)
 
79
  (begin
 
80
    (gimp-image-undo-group-start img)
 
81
    (apply-bovinated-logo-effect img logo-layer spots-x spots-y bg-color)
 
82
    (gimp-image-undo-group-end img)
 
83
    (gimp-displays-flush)))
 
84
 
 
85
(script-fu-register "script-fu-bovinated-logo-alpha"
 
86
                    _"Bo_vination..."
 
87
                    "Makes Cow-spotted logos"
 
88
                    "Brian McFee <keebler@wco.com>"
 
89
                    "Brian McFee"
 
90
                    "April 1998"
 
91
                    "RGBA"
 
92
                    SF-IMAGE       "Image"            0
 
93
                    SF-DRAWABLE    "Drawable"         0
 
94
                    SF-ADJUSTMENT _"Spots density X"  '(16 1 16 1 10 0 1)
 
95
                    SF-ADJUSTMENT _"Spots density Y"  '(4 1 16 1 10 0 1)
 
96
                    SF-COLOR      _"Background Color" '(255 255 255))
 
97
 
 
98
(script-fu-menu-register "script-fu-bovinated-logo-alpha"
 
99
                         _"<Image>/Script-Fu/Alpha to Logo")
 
100
 
 
101
 
 
102
(define (script-fu-bovinated-logo text
 
103
                                  size
 
104
                                  font
 
105
                                  spots-x
 
106
                                  spots-y
 
107
                                  bg-color)
 
108
  (let* ((img (car (gimp-image-new 256 256 RGB)))
 
109
         (border (/ size 4))
 
110
         (text-layer (car (gimp-text-fontname img -1 0 0 text border TRUE size PIXELS font))))
 
111
    (gimp-image-undo-disable img)
 
112
    (gimp-drawable-set-name text-layer text)
 
113
    (apply-bovinated-logo-effect img text-layer spots-x spots-y bg-color)
 
114
    (gimp-image-undo-enable img)
 
115
    (gimp-display-new img)))
 
116
 
 
117
(script-fu-register "script-fu-bovinated-logo"
 
118
                    _"Bo_vination..."
 
119
                    "Makes Cow-spotted logos"
 
120
                    "Brian McFee <keebler@wco.com>"
 
121
                    "Brian McFee"
 
122
                    "April 1998"
 
123
                    ""
 
124
                    SF-STRING     _"Text"               "Fear the Cow"
 
125
                    SF-ADJUSTMENT _"Font size (pixels)" '(80 2 1000 1 10 0 1)
 
126
                    SF-FONT       _"Font"               "RoostHeavy"
 
127
                    SF-ADJUSTMENT _"Spots density X"    '(16 1 16 1 10 0 1)
 
128
                    SF-ADJUSTMENT _"Spots density Y"    '(4 1 16 1 10 0 1)
 
129
                    SF-COLOR      _"Background color"   '(255 255 255))
 
130
 
 
131
(script-fu-menu-register "script-fu-bovinated-logo"
 
132
                         _"<Toolbox>/Xtns/Script-Fu/Logos")