That's it , my first code-snippet typed and tested complete in the gui-server-console 0.4 , and direct copied with ctrl-C / ctrl-V to this forum.; rgb-tst.lsp 13jun2007 dmemos gui-server 0.4
( set 'cmax 1.0 )
( set 'cmin 0.0 )
( set 'cdelta ( div ( sub cmax cmin) 10 ))
( set 'drgb ( dup cdelta 3 ))
( set 'white ( dup cmax 3 ))
( set 'black ( dup cmin 3 ))
( set 'red ( list cmax cmin cmin ))
( set 'green ( list cmin cmax cmin ))
( set 'blue ( list cmin cmin cmax ))
( define ( limit rgbx)
( if ( <rgbx> rgbx cmax) cmax rgbx ))
( define ( rgb-add rgb1 rgb2 )
( map limit ( map add rgb1 rgb2)))
( define ( rgb-sub rgb1 rgb2 )
( map limit ( map sub rgb1 rgb2)))
( define ( rgb-complement rgb1 )
( rgb-sub white rgb1 ))
( set 'yellow ( rgb-add red green ))
( set 'cyan ( rgb-add green blue ))
( set 'magenta ( rgb-add red blue ))
( define ( rgb-lighter rgb1 i )
( if ( = nil i ) (set 'i 1 ))
( rgb-add rgb1 ( map mul drgb ( list i i i ))))
( define ( rgb-darker rgb1 i )
( if ( = nil i ) (set 'i 1 ))
( rgb-sub rgb1 ( map mul drgb ( list i i i ))))
( set 'darkgrey ( rgb-lighter black 3 ))
( set 'lightgrey ( rgb-darker white ))
Remarks :
- great feeling :-)
- the bracket-help doesn't work correctly
- while working in the gui console , the newlisp-console shows a lot of messages "dispatch events" "process events" ending with "unknown source"
- on Windows2k the newlisp uses 1.5MB and Java 31MB - alot for java but no problem on my old machine ;-)
I've reached page 60 of Cormullions Introduction-to-newLISP so i don't know if the answer is there .
Question :
How the heck can i get rid of the brackets of a list ( 0.0 0.0 1.0 ), so that i can use my rgb-value in this way
( gs-set-background 'frame yellow ) ?