I agree it would be nice to have a tidy API for this but in the mean time you can define the constants yourself:
public static final int kCGImageAlphaNone = 0; /* For example, RGB. */
public static final int kCGImageAlphaPremultipliedLast = 1; /* For example, premultiplied RGBA */
public static final int kCGImageAlphaPremultipliedFirst = 2; /* For example, premultiplied ARGB */
public static final int kCGImageAlphaLast = 3; /* For example, non-premultiplied RGBA */
public static final int kCGImageAlphaFirst = 4; /* For example, non-premultiplied ARGB */
public static final int kCGImageAlphaNoneSkipLast = 5; /* For example, RBGX. */
public static final int kCGImageAlphaNoneSkipFirst = 6; /* For example, XRGB. */
public static final int kCGImageAlphaOnly = 7; /* No color data, alpha data only */
public static final int kCGBitmapAlphaInfoMask = 0x1F;
public static final int kCGBitmapFloatComponents = (1 << 8);
public static final int kCGBitmapByteOrderMask = 0x7000;
public static final int kCGBitmapByteOrderDefault = (0 << 12);
public static final int kCGBitmapByteOrder16Little = (1 << 12);
public static final int kCGBitmapByteOrder32Little = (2 << 12);
public static final int kCGBitmapByteOrder16Big = (3 << 12);
public static final int kCGBitmapByteOrder32Big = (4 << 12);
// from
https://developer.apple.com/library/mac/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_context/dq_context.html // Table 2-1 Pixel formats supported for bitmap graphics contexts (iOS only)
// CS Pixel format and bitmap information constant
// Null 8 bpp, 8 bpc, kCGImageAlphaOnly
// Gray 8 bpp, 8 bpc,kCGImageAlphaNone
// Gray 8 bpp, 8 bpc,kCGImageAlphaOnly
// RGB 16 bpp, 5 bpc, kCGImageAlphaNoneSkipFirst
// RGB 32 bpp, 8 bpc, kCGImageAlphaNoneSkipFirst
// RGB 32 bpp, 8 bpc, kCGImageAlphaNoneSkipLast
// RGB 32 bpp, 8 bpc, kCGImageAlphaPremultipliedFirst
// RGB 32 bpp, 8 bpc, kCGImageAlphaPremultipliedLast
public static CGBitmapInfo bitmapInfo(boolean withAlpha) {
return new CGBitmapInfo(withAlpha ? kCGImageAlphaPremultipliedLast : kCGImageAlphaNoneSkipLast);
}
Please note I put a complete set of constants there for reference; some will not work on iOS and/or in all circumstances.
HTH,
Max