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

« back to all changes in this revision

Viewing changes to plug-ins/script-fu/scripts/spinning-globe.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
;
 
2
; anim_sphere
 
3
;
 
4
;
 
5
; Chris Gutteridge (cjg@ecs.soton.ac.uk)
 
6
; At ECS Dept, University of Southampton, England.
 
7
; This program is free software; you can redistribute it and/or modify
 
8
; it under the terms of the GNU General Public License as published by
 
9
; the Free Software Foundation; either version 2 of the License, or
 
10
; (at your option) any later version.
 
11
 
12
; This program is distributed in the hope that it will be useful,
 
13
; but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
; GNU General Public License for more details.
 
16
 
17
; You should have received a copy of the GNU General Public License
 
18
; along with this program; if not, write to the Free Software
 
19
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
20
 
 
21
 
 
22
; Define the function:
 
23
 
 
24
(define (script-fu-spinning-globe inImage 
 
25
                                  inLayer 
 
26
                                  inFrames 
 
27
                                  inFromLeft 
 
28
                                  inTransparent 
 
29
                                  inIndex 
 
30
                                  inCopy)
 
31
  (let* (
 
32
        (theImage (if (= inCopy TRUE)
 
33
                            (car (gimp-image-duplicate inImage))
 
34
                            inImage))
 
35
        (theLayer (car (gimp-image-get-active-layer theImage)))
 
36
        (n 0)
 
37
        (ang (* (/ 360 inFrames) 
 
38
                (if (= inFromLeft TRUE) 1 -1) ))
 
39
        (theFrame)
 
40
        )
 
41
 
 
42
  (gimp-layer-add-alpha theLayer)
 
43
  
 
44
  (while (> inFrames n)
 
45
         (set! n (+ n 1))
 
46
         (set! theFrame (car (gimp-layer-copy theLayer FALSE)))
 
47
         (gimp-image-add-layer theImage theFrame 0)
 
48
         (gimp-drawable-set-name theFrame 
 
49
                              (string-append "Anim Frame: " 
 
50
                                             (number->string (- inFrames n) 10)
 
51
                                             " (replace)"))
 
52
         (plug-in-map-object RUN-NONINTERACTIVE
 
53
                             theImage theFrame 
 
54
                                        ; mapping
 
55
                             1
 
56
                                        ; viewpoint
 
57
                             0.5 0.5 2.0
 
58
                                        ; object pos 
 
59
                             0.5 0.5 0.0
 
60
                                        ; first axis
 
61
                             1.0 0.0 0.0
 
62
                                        ; 2nd axis
 
63
                             0.0 1.0 0.0
 
64
                                        ; axis rotation
 
65
                             0.0 (* n ang) 0.0
 
66
                                        ; light (type, color)
 
67
                             0 '(255 255 255)
 
68
                                        ; light position
 
69
                             -0.5 -0.5 2.0
 
70
                                        ; light direction
 
71
                             -1.0 -1.0 1.0
 
72
                                        ; material (amb, diff, refl, spec, high)
 
73
                             0.3 1.0 0.5 0.0 27.0
 
74
                                       ; antialias 
 
75
                             TRUE 
 
76
                                       ; tile
 
77
                             FALSE
 
78
                                       ; new image 
 
79
                             FALSE 
 
80
                                       ; transparency
 
81
                             inTransparent 
 
82
                                       ; radius
 
83
                             0.25
 
84
                                       ; unused parameters
 
85
                             1.0 1.0 1.0 1.0
 
86
                             -1 -1 -1 -1 -1 -1 -1 -1)
 
87
         ; end while: 
 
88
         )
 
89
  (gimp-image-remove-layer theImage theLayer)
 
90
  (plug-in-autocrop RUN-NONINTERACTIVE theImage theFrame)
 
91
  
 
92
  (if (= inIndex 0)
 
93
      ()
 
94
      (gimp-image-convert-indexed theImage FS-DITHER MAKE-PALETTE inIndex
 
95
                                  FALSE FALSE ""))
 
96
 
 
97
  (if (= inCopy TRUE)
 
98
      (begin  
 
99
        (gimp-image-clean-all theImage)
 
100
        (gimp-display-new theImage))
 
101
      ())
 
102
 
 
103
  (gimp-displays-flush)
 
104
  )
 
105
)
 
106
 
 
107
(script-fu-register "script-fu-spinning-globe"
 
108
                    _"_Spinning Globe..."
 
109
                    "Maps the image on an animated spinning globe"
 
110
                    "Chris Gutteridge"
 
111
                    "1998, Chris Gutteridge / ECS dept, University of Southampton, England."
 
112
                    "16th April 1998"
 
113
                    "RGB* GRAY*"
 
114
                    SF-IMAGE       "The Image"               0
 
115
                    SF-DRAWABLE    "The Layer"               0
 
116
                    SF-ADJUSTMENT _"Frames"                  '(10 1 360 1 10 0 1)
 
117
                    SF-TOGGLE     _"Turn from left to right" FALSE
 
118
                    SF-TOGGLE     _"Transparent background"  TRUE
 
119
                    SF-ADJUSTMENT _"Index to n colors (0 = remain RGB)" '(63 0 256 1 10 0 1)
 
120
                    SF-TOGGLE     _"Work on copy"            TRUE)
 
121
 
 
122
(script-fu-menu-register "script-fu-spinning-globe"
 
123
                         _"<Image>/Script-Fu/Animators")