From: Michael Neumann Date: 2004-12-07T22:07:07+09:00 Subject: Re: Ruby 2.0 Gavin Sinclair wrote: > On Tuesday, December 7, 2004, 12:15:42 AM, Michael wrote: > > >>Gavin Sinclair wrote: >> >>>On Monday, December 6, 2004, 10:43:50 PM, Michael wrote: >>> >>> >>> >>>>ruby -rcomplex >>>>-e'c,m,w,h=Complex(-0.75,0.136),50,200,100;puts"P6\n"+\ >>>>"#{w} >>>>#{h}\n255";(0...h).each{|j|(0...w).each{|i|n,z=0,Complex(0.9*i/w,\ >>>>0.9*j/h);while n<=m&&(z-c).abs<=2;z=z*z+c;n+=1 end;print [20+n*10,0,\ >>>>rand*99].pack("C*")}}'|display >>> >>> >>>Running that on Cygwin, I get >>> >>>display: unable to open X server `'. >>>-e:4:in `write': Broken pipe (Errno::EPIPE) >>> from -e:4:in `print' >>> from -e:4 >>> from -e:2:in `each' >>> from -e:2 >>> from -e:2:in `each' >>> from -e:2 >>> >>>Probably a platform issue, but I gotta say I'm a bit surprised. > > >>Probably due to 'display'. The ruby code generates a .pnm image, which >>is then displayed using 'display' (ImageMagick). > > > But the code doesn't require rmagick, does it? no it doesn't require rmagick. it generates the pnm image itself (and this in 4 lines ;-). The "display" command is there only to view the pnm image, oterhwise it would print the image on STDOUT. Regards, Michael