Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
I am attempting to create a new bitmap context, using the following code:
var context = new CGBitmapContext(null, (int)size.Width, (int)size.Height, 8, 0, null, CGImageAlphaInfo.Only);
Note the null handle, and null color space. This should be valid, as noted in Apple's documentation of the available flags at https://developer.apple.com/library/mac/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_context/dq_context.html#//apple_ref/doc/uid/TP30001066-CH203
As noted there, when the color space is null, a BPC of 8 with the CGImageAlphaInfo.Only flag is valid. However, I get the following exception when attempting to run this:
Argument cannot be null.
Parameter name: colorSpace
at MonoTouch.CoreGraphics.CGBitmapContext.GetHandle (MonoTouch.CoreGraphics.CGColorSpace colorSpace) [0x00006] in /Developer/MonoTouch/Source/maccore/src/CoreGraphics/CGBitmapContext.cs:54
at MonoTouch.CoreGraphics.CGBitmapContext..ctor (System.Byte data, Int32 width, Int32 height, Int32 bitsPerComponent, Int32 bytesPerRow, MonoTouch.CoreGraphics.CGColorSpace colorSpace, CGImageAlphaInfo bitmapInfo) [0x00000] in /Developer/MonoTouch/Source/maccore/src/CoreGraphics/CGBitmapContext.cs:73
--- snip ---
instead of `null`. That should give you the behaviour you're looking for.
While `CGColorSpace.Null` still exists for API compatibility you'll now be able to pass `null` for a CGColorSpace (in XI 8.12+).
Fixed in maccore/master be4919bf6e30d6ab97bea160efa30cb7915167ba
QA: unit tests added in the same revision