On 06/08/06, Bulat Ziganshin <[EMAIL PROTECTED]> wrote:
more used than average lib. btw, is it possible to rewrite this
algorithm in more high-level way using FPS, of course with more or
less good speed?
Using Data.ByteString, I see no noticeable decrease in performance.
data C = R|G|B deriving Show
...
B.useAsCStringLen image $ \ (src,len) ->
copyBytes dst (castPtr src) len
print $ B.foldl sum_rgb (0,0,0,R) image
...
sum_rgb (r,g,b,s) px
= r `seq` g `seq` b `seq` case s of
R -> (r+px, g, b, G)
G -> (r, g+px, b, B)
_ -> (r, g, b+px, R)
Fantastic library.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe