Last active
August 29, 2015 14:01
-
-
Save PadraigK/1362baef8b1912f78d09 to your computer and use it in GitHub Desktop.
How do I pixels?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB(); | |
CGContextRef bmContext = CGBitmapContextCreate(NULL, width, height, 8, 4 * width, cs, (CGBitmapInfo) kCGImageAlphaNoneSkipLast); | |
CGContextDrawImage(bmContext, (CGRect){.origin.x = 0.0f, .origin.y = 0.0f, .size.width = width, .size.height = height}, imageRep); | |
CGColorSpaceRelease(cs); | |
RGBAPixel *pixels = (RGBAPixel*)CGBitmapContextGetData(bmContext); | |
// Outputting the first 10 pixels on different hardware (iPad Air, iPhone 5, Simulator) gives slightly differing pixel values. | |
// I am confuse. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's most likely because these devices all have different color spaces/profiles.