<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:'times new roman', 'new york', times, serif;font-size:12pt"><div>Hi,</div><div>Now that I've understood how to generate raster points of a line in Haskell - the next thing I want to do is generate a pnm file with it. I've done it in perl as of now. In perl, I can have a scalar variable $x contain a string of 256*256*3 bytes (for 24-bit 256x256 image) and set pixels using substr on LHS. I was wondering how I could do something similar in Haskell?</div><div><br></div><div><div>sub setPixel{</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>my($x,$y,$red,$green,$blue)=@_;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>my$pixel=pack "CCC",$red,$green,$blue;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>my$offset=$WIDTH*$y*3 + $x*3;</div><div><span class="Apple-tab-span"
style="white-space:pre">        </span>substr($image,$offset,3) = $pixel;</div><div>}</div><div><br></div><div>Regards,</div><div>Kashyap</div><div><br></div></div><div style="position:fixed"></div></div><br>
</body></html>