<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 15, 2017, at 11:07 AM, Nevin Brackett-Rozinsky via swift-users &lt;<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-family: Alegreya-Regular; font-size: 15px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Ideally I’d like to create the bitmap image without having to allocate a second buffer. The sole purpose of the Float array is for creating this image, so I’d like to directly use its bytes as the pixels data. I expect this will involve some Unsafe[…] APIs in Swift, though I don’t know exactly how.</div></div></blockquote><div><br class=""></div><div>AFAIK there aren’t any pixmap formats that use floats. If you want to produce ARGB pixels, then emit your data in that format, i.e. as a [UInt8]. No unsafe stuff needed.</div><br class=""><blockquote type="cite" class=""><div style="font-family: Alegreya-Regular; font-size: 15px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">And yes, I am on an Apple platform. Despite reading boatloads of Core Graphics documentation, I still can’t make heads or tails out of how to turn a pre-existing array into the backing data for a bitmap image. This part is only Swift-related in the sense that I am trying to do it in Swift, so if there’s a better place to ask/learn about it I’d appreciate being pointed there.</div></blockquote><br class=""></div><div>Either Apple’s developer forums, or the cocoa-dev mailing list hosted at <a href="http://lists.apple.com" class="">http://lists.apple.com</a>.</div><div><br class=""></div><div>—Jens</div><br class=""></body></html>