It is currently Mon May 20, 2013 10:20 pm


Latest GIMP Scripts & Plug-ins

All times are UTC - 5 hours [ DST ]




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

Joined: Feb 18, 2011
Posts: 1556
Location: 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


Last edited by Graechan on Thu Aug 23, 2012 8: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
 Profile  
 

 Post subject: Re: How do I break up this
PostPosted: Thu Aug 23, 2012 4:47 am  (#2) 
Offline
Gimp Scripts Editor
User avatar

Joined: Jun 22, 2010
Posts: 581
Location: Here and there
Code:
(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
 Profile  
 
 Post subject: Re: How do I break up this
PostPosted: Thu Aug 23, 2012 8:46 pm  (#3) 
Offline
Gimp Scripts Editor
User avatar

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

_________________
Image


Top
 Profile  
 
 Post subject: Re: How do I break up this[solved]
PostPosted: Thu Aug 23, 2012 10:07 pm  (#4) 
Online
Global Moderator
User avatar

Joined: May 16, 2010
Posts: 8979
Location: "Looking for my eraser" =P
So Red Green and Blue would be defined as a list?

_________________
Image
Gimp Rocks Blog
Simply Gimp Tutorials
"Once your in the cloud, you're in the net"
____________
OK, . . . . so what's the speed of dark?


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

Joined: May 22, 2008
Posts: 2078
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.

Code:
> (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.

_________________
Image


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

* Login   * Subscribe to RSS Feed


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group