;; This is a short function intended to demonstrate that the "gimp-copy-visible" function
;; does not work from an updated projection.
;; It is not intended to perform any useful purpose. :-)


(define (script-fu-tst-visibility img drawable)
;;  (gimp-image-undo-group-start img)
  (let* (
    (layers ()) ;; list of visible layers
    (FG-layer (aref (cadr (gimp-image-get-layers img)) 0)) ;; A text layer with an anti-aliased font
    (BG-layer (aref (cadr (gimp-image-get-layers img)) 1)) ;; The background layer
    (float) ;; temp float layer
    )
    (gimp-drawable-set-visible FG-layer 0) ;; make FG hidden
    (gimp-drawable-set-visible BG-layer 1) ;; make BG visible
    (gimp-selection-all img) 
;;    (gimp-displays-flush)  ;; THIS IS REQUIRED FOR NEXT LINE TO FUNCTION PROPERLY
    (gimp-edit-copy-visible img) ;; THIS SHOULD ONLY COPY VISIBLE LAYERS!
    (set! float (car (gimp-edit-paste BG-layer 0)))
    (gimp-floating-sel-anchor float)
    )
;;  (gimp-image-undo-group-end img)
  )
(script-fu-register "script-fu-tst-visibility"
              "<Image>/Script-Fu/Test Layer Visibility"
              "Converts Anti-aliased text layer to GIFable layer"
              "Saul Goode"
              "Saul Goode"
              "2006-2-26"
              "RGB*, GRAY*"
              SF-IMAGE "Image" 0
              SF-DRAWABLE "Layer" 0
              )