Hi Conal,

On Wed, 29 Aug 2007 09:42:15 +0900, Conal Elliott <[EMAIL PROTECTED]> wrote:
> Is there any reason for imageCreateFromPixelArray to be in IO?  I want to
> use it as a pure function (via unsafePerformIO), and I'm wondering if there
> are any gotchas.   - Conal

I think it's just implementation reason.

imageCreateFromPixelArray create pixelBuffer and set pixelBuffer
color interanally, and then create image by pixelBuffer.


imageCreateFromPixelArray :: Array Point Color -> IO (Image ())
imageCreateFromPixelArray pixels
   = let (Point x y) = snd (bounds pixels)
     in imageCreateFromPixels (sz (x+1) (y+1)) (elems pixels)

imageCreateFromPixels :: Size -> [Color] -> IO (Image ())
imageCreateFromPixels size colors
   = do pb <- pixelBufferCreate size
        pixelBufferSetPixels pb colors
        imageCreateFromPixelBuffer pb   -- image deletes pixel buffer

http://darcs.haskell.org/wxhaskell/wxcore/src/Graphics/UI/WXCore/Image.hs


So I think we can use this function as a safe one.

Best Regards,

-- 
shelarcy <shelarcy    hotmail.co.jp>
http://page.freett.com/shelarcy/

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
wxhaskell-users mailing list
wxhaskell-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxhaskell-users

Reply via email to