The Shape of Everything
A website mostly about Mac stuff, written by August "Gus" Mueller
» Acorn
» Retrobatch
» Mastodon
» Micro.blog
» Instagram
» Github
» Maybe Pizza?
» Archives
» Feed
» Micro feed
» Retrobatch
» Mastodon
» Micro.blog
» Github
» Maybe Pizza?
» Archives
» Feed
» Micro feed
Pixel Memory Layout between Core Graphics and Core Image / IOSurface
The Core Image format kCIFormatBGRA8 means the pixel data will be ordered BGRA in memory (alpha last). To match that with Core Graphics, you'll have to use kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Little. Yes, it's alpha first for CG but last for CI.
Which doesn't make sense, until you stare at it for a long time. It's right there though. Alpha first (ARGB), but little endian for a 32 bit word. Not 16 bit, which at first glance you might assume to be the case. Which I did.