RSS/Atom feed Twitter
Site is read-only, email is disabled

Help! Problem with gimp-curves-spline procedure

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

3 of 3 messages available
Toggle history

Please log in to manage your subscriptions.

Help! Problem with gimp-curves-spline procedure Adir Kol 09 May 10:44
  Help! Problem with gimp-curves-spline procedure Kevin Cozens 09 May 15:56
   Help! Problem with gimp-curves-spline procedure Adir Kol 09 May 19:50
Adir Kol
2012-05-09 10:44:30 UTC (almost 12 years ago)

Help! Problem with gimp-curves-spline procedure

Hi All,
I've been trying to make gimp-curves-spline get variable (which is number) instead of number and I get error.

For example - when I do:
*(gimp-curves-spline drawable 0 6 #(0 0 0 15 255 255))*

everything works well as it should be.

but if I do: *(define spoint 15)*
*(gimp-curves-spline drawable 0 6 #(0 0 0 spoint 255 255))*

I get an error: *Error: Item 4 in vector is not a number (argument 4 for function gimp-curves-spline) #( 0 0 0 spoint 255 255 )* As you can see, all I did was replacing the number 15 with a variable (which is a number)
I also check it is a number by the *number?* type predicate

Any thoughts?

Kevin Cozens
2012-05-09 15:56:44 UTC (almost 12 years ago)

Help! Problem with gimp-curves-spline procedure

On 12-05-09 06:44 AM, Adir Kol wrote:

*(define spoint 15)*
*(gimp-curves-spline drawable 0 6 #(0 0 0 spoint 255 255))*

I get an error: *Error: Item 4 in vector is not a number (argument 4 for function gimp-curves-spline) #( 0 0 0 spoint 255 255 )*

Putting a variable name in a list (or vector in this case) and expecting the value held by the variable to become part of the list (or vector) is an often made error when writing Scheme scripts. The syntax #( objects ) is a vector containing the listed objects. It is *not* an expression that evaluates to a list. To put it another way, it will not use the value or contents of "spoint" in the vector. The "spoint" reference was treated as a symbol.

It is easy to solve the problem by using the "list" procedure, but in your case you want a vector so you need one additional procedure call.

Use the following: (list->vector (list 0 0 0 spoint 255 255))

Adir Kol
2012-05-09 19:50:48 UTC (almost 12 years ago)

Help! Problem with gimp-curves-spline procedure

Thanks Kevin!
This would be the 2d time you're helping me :)

On Wed, May 9, 2012 at 6:56 PM, Kevin Cozens wrote:

On 12-05-09 06:44 AM, Adir Kol wrote:

*(define spoint 15)*
*(gimp-curves-spline drawable 0 6 #(0 0 0 spoint 255 255))*

I get an error: *Error: Item 4 in vector is not a number (argument 4 for function gimp-curves-spline) #( 0 0 0 spoint 255 255 )*

Putting a variable name in a list (or vector in this case) and expecting the value held by the variable to become part of the list (or vector) is an often made error when writing Scheme scripts. The syntax #( objects ) is a vector containing the listed objects. It is *not* an expression that evaluates to a list. To put it another way, it will not use the value or contents of "spoint" in the vector. The "spoint" reference was treated as a symbol.

It is easy to solve the problem by using the "list" procedure, but in your case you want a vector so you need one additional procedure call.

Use the following: (list->vector (list 0 0 0 spoint 255 255))

-- Cheers!

Kevin.

http://www.ve3syb.ca/ |"Nerds make the shiny things that distract
Owner of Elecraft K2 #2172 | the mouth-breathers, and that's why we're
| powerful!" #include | --Chris Hardwick ______________________________**_________________ gimp-user-list mailing list
gimp-user-list@gnome.org
http://mail.gnome.org/mailman/**listinfo/gimp-user-list