Home > Software design >  How do I use vImage_Buffer to manage pixels and create an image?
How do I use vImage_Buffer to manage pixels and create an image?

Time:08-03

I want to define an image as RGB(A) values in an array, then I want to use vImage_buffer to produce ultimately produce a CG/UI image.

There's a Pixel_8888 data type (an alias for (UInt8, UInt8, UInt8, UInt8)) that seems like a promising data type to use. Is this right?

So far, I start from an array [Pixel_8888] and use .withUnsafeMutableBytes which I create a vImage_Buffer which gives me a striped image.

But I can't then make an image without the striping (which is the showing each RGBA channel).

I think a step to convert from RGBA to planar is required, but I could be wrong.

CodePudding user response:

Apple have just introduced a Swift friendly wrapper around vImage_Buffer called enter image description here

  • Related