> On Mar 15, 2017, at 11:07 AM, Nevin Brackett-Rozinsky via swift-users 
> <swift-users@swift.org> wrote:
> 
> 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.

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.

> 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.

Either Apple’s developer forums, or the cocoa-dev mailing list hosted at 
http://lists.apple.com <http://lists.apple.com/>.

—Jens

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to