Retired Document
Important: This document may not represent best practices for current development. Links to downloads and other resources may no longer be valid.
CGBitmapContextCreate Supported Color Spaces
Q:
What color spaces does CGBitmapContextCreate
support?
A: CGBitmapContextCreate
supports the following combinations for the colorspace
(CS), bitsPerComponent
(BPC), and alphaInfo
parameters:
CS | BPC | alphaInfo | Resulting Bits and Description |
---|---|---|---|
NULL | 8 | kCGImageAlphaOnly | AAAAAAAA 8 bits per pixel alpha-only destination. Color data is thrown away. Useful for generating alpha-only bitmaps and masks. Available in Mac OS X 10.3 and later. |
Gray | 8 | kCGImageAlphaNone | WWWWWWWW 8 bits per pixel grayscale channel. |
RGB | 5 | kCGImageAlphaNoneSkipFirst | -RRRRRGGGGGBBBBB 16 bits per pixel, 5 bits per RGB component. |
RGB | 8 | kCGImageAlphaNoneSkipFirst | --------RRRRRRRRRGGGGGGGGBBBBBBBB 32 bits per pixel, 8 bits per RGB component where first 8 bits are ignored. |
RGB | 8 | kCGImageAlphaNoneSkipLast | RRRRRRRRRGGGGGGGGBBBBBBBB-------- 32 bits per pixel, 8 bits per RGB component where last 8 bits are ignored. |
RGB | 8 | kCGImageAlphaPremultipliedFirst | AAAAAAAARRRRRRRRRGGGGGGGGBBBBBBBB 32 bits per pixel, 8 bits per ARGB component with premultiplied alpha. |
RGB | 8 | kCGImageAlphaPremultipliedLast | RRRRRRRRRGGGGGGGGBBBBBBBBAAAAAAAA 32 bits per pixel, 8 bits per RGBA component with premultiplied alpha. |
CMYK | 8 | kCGImageAlphaNone | CCCCCCCCMMMMMMMMYYYYYYYYKKKKKKKK 32 bits per pixel, 8 bits per CMYK component without alpha. Available in Mac OS X 10.3 and later. |
Bit | Description |
---|---|
W | White |
A | Alpha |
R | Red |
G | Green |
B | Blue |
C | Cyan |
M | Magenta |
Y | Yellow |
K | Black |
- | Skip |
Document Revision History
Date | Notes |
---|---|
2014-03-06 | Updated to point to the Quartz 2D Programming Guide, minor text changes. |
2007-07-18 | Updated to point to the Quartz 2D Programming Guide, minor text changes. |
2005-10-04 | Updated to point to the Q&A describing how to properly create color spaces. Added a note that this Q&A is only valid for formats introduced in 10.3 and earlier. |
2004-09-09 | Removed two combinations in the Gray color space that had been incorrectly documented as supported. |
2004-02-20 | New document that lists the color space and alpha info combinations currently supported by CGBitmapContextCreate. |
Copyright © 2007 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2007-07-18