Bug 60150 - Regression: Color with 0 alpha is incorrectly converted from XMAL to Forms.Color
Summary: Regression: Color with 0 alpha is incorrectly converted from XMAL to Forms.Color
Status: RESOLVED NORESPONSE
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.4.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-10-12 09:43 UTC by flywhc
Modified: 2017-11-06 21:36 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: Yes
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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.

Related Links:
Status:
RESOLVED NORESPONSE

Description flywhc 2017-10-12 09:43:44 UTC
I had a Forms project working well with Xamarin.Forms 2.3.4.231.
After upgrading it to 2.4.0.282, my customized control Gradient Renderer couldn't display color correctly.

I identified the problem after debugging:
Xaml code:
    
<ctrl:GradientStackLayout x:Name="Grad1" Grid.Column="0" StartPoint="0,0" EndPoint="1,0" StartColor="#ff147acc" EndColor="#147acc" />

Code behind:
 (constructor)
 InitializeComponent();
 Logger.Get().Info("Grad from {0} to {1}", Grad1.StartColor.ToString(), Grad1.EndColor.ToString());
    
Log:
`2017/10/12 16:45:37 NewsListPage.xaml.cs:28 INF Grad from [Color: A=1, R=0.0784313753247261, G=0.47843137383461, B=0.800000011920929, Hue=0.574275374412537, Saturation=0.821428596973419, Luminosity=0.439215689897537] to [Color: A=0, R=0, G=0, B=0, Hue=0, Saturation=0, Luminosity=0]`

You can see the RGB color "#00147acc" in Xaml is converted to Forms.Color {0,0,0,0}.

This is OK for solid color (it is nearly 100% transparent) but caused iOS CAGradientLayer class display a black gradient rather than colorful semi-transparent gradient mask.
Comment 1 Paul DiPietro [MSFT] 2017-10-13 05:01:23 UTC
Can you please give us a minimal reproduction using your custom control with as little code needed to reproduce the behavior?
Comment 2 Paul DiPietro [MSFT] 2017-11-06 21:35:53 UTC
As we have not heard back in over a month we will be closing this issue. Please reopen with a reproduction project to aid investigation if the issue is still occurring as of the latest stable build of Forms. Thanks!