~ubuntu-branches/ubuntu/vivid/gimp/vivid

« back to all changes in this revision

Viewing changes to plug-ins/script-fu/scripts/select-to-image.scm

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach
  • Date: 2012-05-08 18:50:03 UTC
  • mto: (1.1.26) (0.5.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 71.
  • Revision ID: package-import@ubuntu.com-20120508185003-tltkvbaysf8d2426
ImportĀ upstreamĀ versionĀ 2.8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
; Takes the Current selection and saves it as a seperate image.
9
9
;
10
10
;
11
 
; This program is free software; you can redistribute it and/or modify
 
11
; This program is free software: you can redistribute it and/or modify
12
12
; it under the terms of the GNU General Public License as published by
13
 
; the Free Software Foundation; either version 2 of the License, or
 
13
; the Free Software Foundation; either version 3 of the License, or
14
14
; (at your option) any later version.
15
15
;
16
16
; This program is distributed in the hope that it will be useful,
19
19
; GNU General Public License for more details.
20
20
;
21
21
; You should have received a copy of the GNU General Public License
22
 
; along with this program; if not, write to the Free Software
23
 
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
22
; along with this program.  If not, see <http://www.gnu.org/licenses/>.
24
23
 
25
24
 
26
25
(define (script-fu-selection-to-image image drawable)
39
38
        )
40
39
 
41
40
    (gimp-context-push)
 
41
    (gimp-context-set-defaults)
42
42
 
43
43
    (gimp-image-undo-disable image)
44
44
 
45
45
    (if (= (car (gimp-selection-is-empty image)) TRUE)
46
46
        (begin
47
 
          (gimp-selection-layer-alpha drawable)
 
47
          (gimp-image-select-item image CHANNEL-OP-REPLACE drawable)
48
48
          (set! active-selection (car (gimp-selection-save image)))
49
49
          (set! from-selection FALSE)
50
50
        )
61
61
    (set! new-draw (car (gimp-layer-new new-image
62
62
                                        selection-width selection-height
63
63
                                        draw-type "Selection" 100 NORMAL-MODE)))
64
 
    (gimp-image-add-layer new-image new-draw 0)
 
64
    (gimp-image-insert-layer new-image new-draw 0 0)
65
65
    (gimp-drawable-fill new-draw BACKGROUND-FILL)
66
66
 
67
67
    (let ((floating-sel (car (gimp-edit-paste new-draw FALSE))))