Here's another draft. I do not know if anyone else has been able to run this code (needs j602 and opengl), or cares to, but this is as much an attempt on my part to resolve emailing issues as it is to explain or propagate the code.
Steps I have taken here include making sure no lines are longer than 72 characters and making sure that @ is never followed by a letter (I use @: instead). Anyways, here's a draft. I think it looks ok with send/undo so lets see how the mailing list and archival system treats it: coclass 'colourchoice' require 'jzopengl' coinsert 'jzopengl' Note 'wd' p - parent window s - scrollbar -- S will be numeric value 0..255 repesents distance along white/black diagonal c - color display ) NB. object constructor create=:3 :0 ogl=: ''conew'jzopengl' wd 'pc p;' wd 'xywh 0 0 10 256; cc s scrollbarv bottommove;' S=: 127 wd 'set s 0 ',(":S),' 255 39;' wd 'xywh 10 0 256 256; cc c isigraph opengl rightmove bottommove;' wd 'pas 0 0; pshow;' ) NB. event handlers p_close=: destroy p_c_paint=: 3 :0 rc__ogl'' glClear GL_COLOR_BUFFER_BIT draw L:0 S {:: IMAGES show__ogl'' ) p_s_button=: 3 :0 S=: 0 ". s wd 'setinvalid c' ) p_c_mbldown=: 3 :0 trac 1 ) p_c_mmove=: 3 :0 trac TRACK ) p_c_mblup=: 3 :0 trac 0 ) NB. implementation destroy=: 3 :0 destroy__ogl'' wd'pclose' codestroy'' ) NB. projection onto plane tangent to white/black axis of colour cube X0=: 1 _1 1 * %: 1 5 1%6 Y0=: _1 0 1 * %: %2 coords=: +/ .*"1&(X0,:Y0)"1 rms=: +/ &.: *:"1 NB. "root mean square" NB. use gift wrapping algorithm to find drawable order NB. http://en.wikipedia.org/wiki/Gift_wrapping_algorithm split1=: ,:@{. ; }. car=: 0 {:: [ NB. ordered on convex hull cdr=: 1 {:: [ NB. not ordered yet NB. pick next corner based on angle: choose=: cdr #~ [: (= >./) -@^.@:rms@(cdr -"1 {:@:car) giftwrap=: i. 0 {:: (((car,]) ; cdr-.]) choose)^:(#@:cdr)@:split1 CORNERPAIRS=: (#:i.8) {~ ~./:"1~8 8#:I.,1=rms-"1/~#:i.8 CORNERVERTS=: (([ +"1 (85%~i.86) */ -~)/)"2 CORNERPAIRS NB. 256 = 86+85+85 COLOURSLICE=: (rms <@((giftwrap@:coords{])^:(2<#))@~./. ]),/CORNERVERTS PALETTES=: (,. coords)&.> COLOURSLICE NB. make white and black slices be non-empty to avoid errors: PALETTES=: (<1 1 1 __ __ >."1 >254{PALETTES) 255} PALETTES PALETTES=: (<0 0 0 _ _ <."1 >1{PALETTES) 0} PALETTES decorate=:3 :0 NB. add small rectangles of solid color on edges of color slices cy=.3{."1 y ey=.3 4{"1 y vy=. ey-"1(+/%#)ey vec=. -(*-/ .* vy)*0,.0,.0,.0.01*(%rms)(vy-1|.vy)+/ .*0 _1,:1 0 y;(y,"1 2 (vec+y),:"1 (1|.y));(vec+y),"1 2 (vec+1|.y),:"1 (1|.y) ) NB. also: put white first ("on top") IMAGES=: decorate&.> |.PALETTES corner=: 3 :0 glColor3d 3{.y glVertex2d 3 4{y ) draw=: 3 :0"2 glBegin GL_POLYGON corner"1 y glEnd'' ) TRACK=: 0 trac=: 3 :0 if. y+.TRACK do. smoutput y,TRACK,2 {. 0".sysdata end. TRACK=: y ) smoutput ''conew'colourchoice' Thanks, -- Raul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm