Created attachment 16713 [details]
Test project where the bug can be observed
We have a custom renderer for ContentView, which draws a rounded corners view.
The color is set in PCL, so on iOS it should be converted from Forms.Color to CGColor for drawing.
We found out, that converting the color using extension method toCGColor() and method toUIColor().CGColor produces different results on iOS 9.3 (on other versions the colors are converted equally). And the result, produced by toCGColor() is the wrong one (comparing to setting the color as background for ContentView).
You can reproduce this by running attached test project on a device or a simulator with iOS version 9.3.
iOS 9.3 added support for color management, which may be causing this.
I can confirm that this is happening.
iOS 8.4 screenshot: https://www.dropbox.com/s/kdnra6sahx180e3/Screenshot%202016-07-19%2016.41.17.png?dl=0
iOS 9.3 screenshot: https://www.dropbox.com/s/4ohjawait073ll9/Screenshot%202016-07-19%2016.42.20.png?dl=0
I can confirm this too:
e.g. Element.StartColor is a Forms.Color property. Following two lines should have same result:
However, 1) returns a wrong value. 2) is correct.
I verified result by using manually convert the value:
CGColor ToCGColor(Color color)
UIKit.UIColor uicolor = new UIKit.UIColor(
This bug is caused because the conversion to a CGColor() from a Color uses the kCGColorSpaceGenericRGB color space, while going through UIKit's UIColor uses the kCGColorSpaceExtendedSRGB.
Basically, new UIColor (r, g, b, a) and new CGColor(r,g,b) do not produce CGColors in the same colorspace.
From the documentation: https://developer.apple.com/documentation/uikit/uicolor
The UIColor is created on the Device-Dependent RGB color space (which changes across versions and more recently on iOS 10 and higher, does not even clamp the values from 0..1) while CGColor is by default created in the generic RGB color space which is more limited.
For reference: http://tirania.org/blog/archive/2017/Dec-07.html