0

Hello I am trying to convert a bunch of layers ( drawables + masks ) into a 2d list for random access using list-ref. I have failed and I cant see where I am going wrong. The cmyk-list contains garbage. All drawables have been tested with this example template (gimp-invert magenta-layer-copy) before creating the list Your help, comments appreciated.

(set! layerList (cadr (gimp-image-get-layers image)))           
(set! number-of-layers (vector-length layerList))

(set! cyan-layer-copy       (aref layerList (- number-of-layers 4)))
(set! cyan-mask-copy        (car (gimp-layer-get-mask cyan-layer-copy)))
(set! magenta-layer-copy    (aref layerList (- number-of-layers 3)))
(set! magenta-mask-copy     (car (gimp-layer-get-mask magenta-layer-copy)))
(set! yellow-layer-copy     (aref layerList (- number-of-layers 2)))
(set! yellow-mask-copy      (car (gimp-layer-get-mask yellow-layer-copy)))
(set! alpha-layer-copy      (aref layerList (- number-of-layers 1)))

(set! cmyk-list     '((cyan-layer-copy cyan-mask-copy)
                    (magenta-layer-copy magenta-mask-copy)
                    (yellow-layer-copy yellow-mask-copy)
                    (alpha-layer-copy  0)))                             
  • 1
    I don't know what your real problem (with the images) is - and I don't know enough scheme to answer this - but maybe you should be using Python instead? The language does not usually jump between you and your idea. like this. – jsbueno Mar 22 '16 at 23:51
  • Thanks jsbueno. All that I am trying to accomplish is make a 2d list of layers cmyk-list. The crux of the issue is the layer value returned by list operations car, cdr, layer-ref etc is no longer being recognized as a valid layer!. I suspect my deref syntax is awry . Thanks for the suggestion of python-fu. – user3103574 Mar 23 '16 at 08:01
  • I am getting better results by breaking up cmyk-list into two lists cmyk-layer-list and cmyk-mask-list and using ( list-ref cmyk-layer-list layer-index) and (list-ref cmyk-mask-list layer-index). Its hokey in the sense I have to make two calls ( to two different lists - rather than one 2d list, like I have illustrated in the problem above ). I have some ideas and wil give the 2d list a shot for a couple of days and will post results here. – user3103574 Mar 24 '16 at 14:58

0 Answers0