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

« back to all changes in this revision

Viewing changes to plug-ins/script-fu/scripts/chalk.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
; This program is free software; you can redistribute it and/or modify
5
5
; it under the terms of the GNU General Public License as published by
6
6
; the Free Software Foundation; either version 2 of the License, or
7
7
; (at your option) any later version.
8
 
 
8
;
9
9
; This program is distributed in the hope that it will be useful,
10
10
; but WITHOUT ANY WARRANTY; without even the implied warranty of
11
11
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
12
; GNU General Public License for more details.
13
 
 
13
;
14
14
; You should have received a copy of the GNU General Public License
15
15
; along with this program; if not, write to the Free Software
16
16
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
18
; chalk.scm  version 0.11  10/10/97
19
19
;
20
20
; Copyright (C) 1997 Manish Singh <msingh@uclink4.berkeley.edu>
21
 
;  
 
21
;
22
22
; Makes a logo with a chalk-like text effect.
23
23
 
24
24
(define (apply-chalk-logo-effect img
25
 
                                 logo-layer
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 RGB-IMAGE
31
 
                                        "Background" 100 NORMAL-MODE))))
 
25
                                 logo-layer
 
26
                                 bg-color)
 
27
  (let* (
 
28
        (width (car (gimp-drawable-width logo-layer)))
 
29
        (height (car (gimp-drawable-height logo-layer)))
 
30
        (bg-layer (car (gimp-layer-new img
 
31
                                       width height RGB-IMAGE
 
32
                                       "Background" 100 NORMAL-MODE)))
 
33
        )
32
34
 
33
35
    (gimp-context-push)
34
36
 
39
41
    (gimp-edit-fill bg-layer BACKGROUND-FILL)
40
42
 
41
43
    ; the actual effect
42
 
    (gimp-layer-set-preserve-trans logo-layer FALSE)
 
44
    (gimp-layer-set-lock-alpha logo-layer FALSE)
43
45
    (plug-in-gauss-rle 1 img logo-layer 2.0 1 1)
44
46
    (plug-in-spread 1 img logo-layer 5.0 5.0)
45
47
    (plug-in-ripple 1 img logo-layer 27 2 0 0 0 TRUE TRUE)
53
55
    (gimp-edit-clear logo-layer)
54
56
    (gimp-selection-none img)
55
57
 
56
 
    (gimp-context-pop)))
 
58
    (gimp-context-pop)
 
59
  )
 
60
)
57
61
 
58
62
 
59
63
(define (script-fu-chalk-logo-alpha img
60
 
                                    logo-layer
61
 
                                    bg-color)
 
64
                                    logo-layer
 
65
                                    bg-color)
62
66
  (begin
63
67
    (gimp-image-undo-group-start img)
64
68
    (apply-chalk-logo-effect img logo-layer bg-color)
65
69
    (gimp-image-undo-group-end img)
66
 
    (gimp-displays-flush)))
 
70
    (gimp-displays-flush)
 
71
  )
 
72
)
67
73
 
68
74
(script-fu-register "script-fu-chalk-logo-alpha"
69
 
                    _"_Chalk..."
70
 
                    "Chalk scribbled logos"
71
 
                    "Manish Singh <msingh@uclink4.berkeley.edu>"
72
 
                    "Manish Singh"
73
 
                    "October 1997"
74
 
                    "RGBA"
75
 
                    SF-IMAGE     "Image"            0
76
 
                    SF-DRAWABLE  "Drawable"         0
77
 
                    SF-COLOR    _"Background color" '(0 0 0))
 
75
  _"_Chalk..."
 
76
  _"Create a chalk drawing effect for the selected region (or alpha)"
 
77
  "Manish Singh <msingh@uclink4.berkeley.edu>"
 
78
  "Manish Singh"
 
79
  "October 1997"
 
80
  "RGBA"
 
81
  SF-IMAGE     "Image"            0
 
82
  SF-DRAWABLE  "Drawable"         0
 
83
  SF-COLOR    _"Background color" "black"
 
84
)
78
85
 
79
86
(script-fu-menu-register "script-fu-chalk-logo-alpha"
80
 
                         _"<Image>/Script-Fu/Alpha to Logo")
 
87
                         "<Image>/Filters/Alpha to Logo")
81
88
 
82
89
 
83
90
(define (script-fu-chalk-logo text
84
 
                              size
85
 
                              font
86
 
                              bg-color
87
 
                              chalk-color)
88
 
  (let* ((img (car (gimp-image-new 256 256 RGB)))
89
 
         (border (/ size 4))
90
 
         (text-layer (car (gimp-text-fontname img -1 0 0 text border TRUE size PIXELS font))))
 
91
                              size
 
92
                              font
 
93
                              bg-color
 
94
                              chalk-color)
 
95
  (let* (
 
96
        (img (car (gimp-image-new 256 256 RGB)))
 
97
        (border (/ size 4))
 
98
        (text-layer (car (gimp-text-fontname img -1 0 0 text border TRUE size PIXELS font)))
 
99
        )
91
100
 
92
101
    (gimp-context-push)
93
102
 
94
103
    (gimp-image-undo-disable img)
95
 
    (gimp-drawable-set-name text-layer text)
96
104
    (gimp-context-set-foreground chalk-color)
97
 
    (gimp-layer-set-preserve-trans text-layer TRUE)
 
105
    (gimp-layer-set-lock-alpha text-layer TRUE)
98
106
    (gimp-edit-fill text-layer FOREGROUND-FILL)
99
107
    (apply-chalk-logo-effect img text-layer bg-color)
100
108
    (gimp-image-undo-enable img)
101
109
    (gimp-display-new img)
102
110
 
103
 
    (gimp-context-pop)))
 
111
    (gimp-context-pop)
 
112
  )
 
113
)
104
114
 
105
115
(script-fu-register "script-fu-chalk-logo"
106
 
                    _"_Chalk..."
107
 
                    "Chalk scribbled logos"
108
 
                    "Manish Singh <msingh@uclink4.berkeley.edu>"
109
 
                    "Manish Singh"
110
 
                    "October 1997"
111
 
                    ""
112
 
                    SF-STRING     _"Text"               "CHALK"
113
 
                    SF-ADJUSTMENT _"Font size (pixels)" '(150 2 1000 1 10 0 1)
114
 
                    SF-FONT       _"Font"               "Cooper"
115
 
                    SF-COLOR      _"Background color"   '(0 0 0)
116
 
                    SF-COLOR      _"Chalk color"        '(255 255 255))
 
116
  _"_Chalk..."
 
117
  _"Create a logo resembling chalk scribbled on a blackboard"
 
118
  "Manish Singh <msingh@uclink4.berkeley.edu>"
 
119
  "Manish Singh"
 
120
  "October 1997"
 
121
  ""
 
122
  SF-STRING     _"Text"               "CHALK"
 
123
  SF-ADJUSTMENT _"Font size (pixels)" '(150 2 1000 1 10 0 1)
 
124
  SF-FONT       _"Font"               "Cooper"
 
125
  SF-COLOR      _"Background color"   "black"
 
126
  SF-COLOR      _"Chalk color"        "white"
 
127
)
117
128
 
118
129
(script-fu-menu-register "script-fu-chalk-logo"
119
 
                         _"<Toolbox>/Xtns/Script-Fu/Logos")
 
130
                         "<Toolbox>/Xtns/Logos")