-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[iOS] Fix issue using Brush transparent color in Frame #13401
Conversation
@jsuarezruiz |
Team, could we include this requested fix in the upcoming Release? |
{ | ||
if (gradientStop.Color == Color.Transparent) | ||
{ | ||
var color = gradientStops[index == 0 ? index + 1 : index - 1].Color; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you help me understand the logic here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the GradientStop color is transparent, use the next one Color with Alpha 0. In other case, the effect is not correct because use a Clear default color and can see a black color in the gradient from one to other color.
This article explain it well: https://betterprogramming.pub/the-proper-way-of-creating-a-transparent-gradient-layer-in-ios-b082daa866b1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are there any tests you can write for this?
@@ -536,7 +536,7 @@ void UpdateBackground() | |||
if (backgroundColor.IsDefault) | |||
NativeView.BackgroundColor = ColorExtensions.BackgroundColor; | |||
else | |||
NativeView.BackgroundColor = backgroundColor.ToUIColor(); | |||
NativeView.BackgroundColor = Element.BackgroundColor.ToUIColor(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason of this change? wasn't backgroundColor already the color of Element.BackgroundColor ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just reuse the backgroundColor
variable, but, is the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right but this is another access to the BP can't we just leave as is ?
Now i am updating Xamarin.Forms to 5.0.0.83 Don't worked.
|
@RenatGaliew Please file a new bug report if a fix doesn't work, as I am not sure these closed tickets are monitored. |
Description of Change
Fix issue using Brush transparent color in Frame on iOS.
The issue is a kind of grey smudge. The reason for the issue is that our gradient is not going from transparent to white. Not at all! It is, in fact, going from black with zero alpha to white full alpha!. That’s because while our alpha channel is going from 1.0 to 0.0 to achieve the transparency effect, our R, G, and B values are going from 1.0 to 0.0 as well, since the main color of the UIColor.Clear is black.
Issues Resolved
API Changes
None
Platforms Affected
Behavioral/Visual Changes
None
Before/After Screenshots
Testing Procedure
Launch Core Gallery and navigate to the issue 13378.
PR Checklist