You need to say something like:

(set! the-image-id (car (gimp-image-new 10 10 GRAY)))
(set! the-layer-id (car (gimp-layer-new the-image-id 10 10 GRAYA_IMAGE "a named layer" 
100 NORMAL)))
(gimp-image-add-layer the-image-id the-layer-id -1)

In my opinion the PDB documentation isn't helpful in this case, because
the mnemonics are wrong, but paying close attention to the details will
show you what went bad:

The value of GRAY_IMAGE (which you're using in gimp-image-new) is 2,
which corresponds to an image type of GIMP_INDEXED -- which is obviously
not what you wanted.  Then when you tried to add the, correctly created,
layer, it complained.

Helvetix

On Sat, Jun 07, 2003 at 04:47:54PM -0400, Douglas Lewan wrote:
> All,
> 
> I've just started hacking in the Gimp via scheme and clearly don't 
> understand (gimp-image-add-layer).
> 
> What I've read suggests that the following ought to get me a new layer 
> in an image.
> 
> => (set! the-image-id (car (gimp-image-new 10 10 GRAY_IMAGE)))
> 
> 0
> => (set! the-layer-id (car (gimp-layer-new the-image-id 10 10 GRAY_IMAGE "a 
> named layer" 100 NORMAL)))
> 
> 2
> => (gimp-image-add-layer the-image-id the-layer-id -1)
> 
> ERROR: Procedural database execution failed:
>    (gimp_image_add_layer 0 2 -1)
> 
> A "procedural database execution failure" suggests that something quite 
> fundamental is going on.  (It's not just me getting types or syntax 
> confused.)
> 
> Can anyone help?  Can anyone tell me how I might investigate this 
> intelligently?
> 
> Thanks.
> -- 
> ,Doug
> Douglas Lewan
> email: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> cell: 908 7207 908
> 
>        Design: The activity of preparing for a
>        design review.
> 
_______________________________________________
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer

Reply via email to