Blame batch/inserticon-gimp2_2.scm

093028b
 ; Copies the specified rectangle from/to the specified drawable
093028b
; This file is free software; the Free Software Foundation    
093028b
; gives unlimited permission to copy, distribute and modify it.
093028b
;
093028b
;
093028b
(define (dune-copy-rectangle dest-img dest-drawable dest-x dest-y
093028b
         img drawable x1 y1 width height)
093028b
  (gimp-rect-select img (- x1 16) y1 width height 2 0 0)
093028b
;  (gimp-edit-copy drawable)
093028b
;  (set! floating-sel (car (gimp-edit-paste dest-img dest-drawable 0)))
093028b
;  (gimp-rect-select img x1 y1 width height 2 0 0)
093028b
;  (gimp-edit-copy img drawable)
093028b
;  (gimp-layer-set-offsets floating-sel dest-x dest-y)   
093028b
;  (gimp-edit-paste dest-img dest-drawable 0)
093028b
;  (gimp-floating-sel-anchor floating-sel)   
093028b
;  (gimp-selection-none img)
093028b
)
093028b
093028b
(define (script-fu-new-duneInsertIcon-batch inFilename inPosition)
093028b
093028b
 (set! iconImage (car (gimp-file-load 1 inFilename inFilename))) 
093028b
093028b
 (set! iconWidth (car (gimp-image-width iconImage)))
093028b
093028b
 (set! iconHeight (car (gimp-image-height iconImage)))
093028b
093028b
 ; create new layer in image
093028b
 (set! theLayer (car (gimp-layer-new iconImage iconWidth iconHeight 
093028b
                                     0 "layer 1" 100 0) ) ) 
093028b
093028b
 (set! theImageWidth (+ iconWidth 16))
093028b
093028b
 (set! theImageHeight iconHeight)
093028b
093028b
 (set! theImage iconImage)
093028b
093028b
 (gimp-image-resize theImage theImageWidth theImageHeight 0 0) 
093028b
093028b
 (set! saveLayer (car (gimp-image-flatten theImage)))
093028b
 
093028b
 (file-bmp-save 1 theImage saveLayer inFilename inFilename)
093028b
093028b
 (set! iconImage (car (gimp-file-load 1 inFilename inFilename))) 
093028b
093028b
 (set! theLayer (car (gimp-layer-new iconImage (+ 16 iconWidth) iconHeight 
093028b
                                     1 "layer 1" 100 0) ) ) 
093028b
093028b
 (set! position (- (* 16 inPosition) 16))
093028b
093028b
 (set! width (- iconWidth position))
093028b
093028b
 (dune-copy-rectangle theImage theLayer position 0
093028b
                      theImage theLayer (+ 16 position) 0 width iconHeight)
093028b
093028b
 (gimp-display-new theImage)
093028b
) 
093028b
093028b
(script-fu-register 
093028b
  "script-fu-new-duneInsertIcon-batch" 
093028b
  "<Toolbox>/Xtns/Script-Fu/my/NewInsertIconbatch" 
093028b
  "copy a icon file and include a new icon" 
093028b
  "copyright 2004, J. \"MUFTI\" Scheurich, Gnu Public License (GPL)" 
093028b
  "MUFTI"
093028b
  "2004" 
093028b
  "" 
093028b
  SF-FILENAME "Filename:"    "node_icons.bmp" 
093028b
  SF-VALUE "Position to include new icon" "4" 
093028b
)