It is currently Mon Apr 15, 2024 8:08 am


All times are UTC - 5 hours [ DST ]


Switch to mobile style

Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: How do I break up this[solved]
PostPosted: Thu Aug 23, 2012 2:25 am  (#1) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
I have this Gimp color '(160 150 140) and I would like to change to Red=160, Green=150 and Blue=140 so that I can use in Gmic Script. Any help would be greatly appreciated.

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Last edited by Graechan on Thu Aug 23, 2012 7:47 pm, edited 1 time in total.

Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: How do I break up this
PostPosted: Thu Aug 23, 2012 3:47 am  (#2) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
(set! Red (car '(160 150 14)))
(set! Green (cadr '(160 150 14)))
(set! Blue (caddr '(160 150 14)))


See http://www.scheme.com/tspl3/objects.html#g102

Kevin


Top
 Post subject: Re: How do I break up this
PostPosted: Thu Aug 23, 2012 7:46 pm  (#3) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
Thank you Kevin, that worked a treat. it was late last night for me and my brain had frozen (typically) :oops:

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: How do I break up this[solved]
PostPosted: Thu Aug 23, 2012 9:07 pm  (#4) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
So Red Green and Blue would be defined as a list?

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: How do I break up this[solved]
PostPosted: Fri Aug 24, 2012 4:19 pm  (#5) 
Offline
GimpChat Founder
User avatar

Joined: May 22, 2008
Posts: 5242
Location: Gimpville
In this case, Red, Green and Blue are variables that take on the values of elements in the list.

You can verify the return values in GIMP's interactive script-fu console.

> (car '(160 150 14))
160
> (cadr '(160 150 14))
150
> (caddr '(160 150 14))
14

A basic linked list consists of elements which contain data and a pointer (or pointers) to the next element(s) in the list. Surprisingly, wiki has a pretty good good explanation of this data structure.

_________________
“If you reach for the stars, you just might land on a decently sized hill.” - Stuart Hill


Top
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) Gimp 2.10.38 & 2.99.19 may break all my old GEGL plugins - update here

1

No new posts Attachment(s) By 2025-2026 many GEGL plugins of mine will break (easy fix)

3

No new posts Attachment(s) About namespaces in GEGL Plugins (old GEGL effects will break)

3



* Login  



Powered by phpBB3 © phpBB Group