I want to fill an VImage buffer with black color. I have found that using vImageBufferFill_ARGB8888(<#const vImage_Buffer *dest#>, <#const uint8_t *color#>, <#vImage_Flags flags#>)
I can fill the buffer but I am not sure how to pass the color information. I am new to Mac development and All I know are NSColor
or CGColor
but this method need to pass in the color info in const uint8_t
format which I assume is a reference. Could someone help me with an example as I couldn't find one for Objective C anywhere.
Asked
Active
Viewed 176 times
0

prabhu
- 1,158
- 1
- 12
- 27
-
1`ARGB8888` says it all - `A` = Alpha, `R` = Red, `G` = Green, `B` = Blue, `8888` = each is one byte (0..255). Red color for example is - `0xFF, 0xFF, 0x00, 0x00`. The pointer should point to four consequent bytes in a memory filled with the color component values. Not sure if `A` is the first or last byte. Test it and you'll see. – zrzka Aug 03 '20 at 12:50
-
2See [vImageBufferFill_ARGB8888](https://developer.apple.com/documentation/accelerate/1533131-vimagebufferfill_argb8888?language=objc), click on [Pixel_8888](https://developer.apple.com/documentation/accelerate/pixel_8888?language=objc). "For example, `uint8_t[4] = { alpha, red, green, blue }` for ARGB data." – Willeke Aug 03 '20 at 13:17
-
thank you guys. Thats exactly what I wanted :) – prabhu Aug 03 '20 at 13:46