I’m using JuicyPixels to load PNGs fron on-disk, and I need a pointer to the raw pixel data. It is stored as a UArray in JuicyPixels. How do I get said pointer? Is it as simple as “casting” to a StorableArray? If so, how?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use
thawinIO:This copies the entire array, but probably more efficiently than hand-written code to do the same. If you know you’re not going to access the
UArrayagain, then you can useunsafeThaw, but with current library implementations, it’s still likely to cause a complete copy. (The array types that have a non-copying implementation ofunsafeThaware listed in its documentation.)There might be an unportable way to get at the raw pointer underlying a
UArray, but I couldn’t find one inGHC.Exts.