зеркало из https://github.com/DeGsoft/maui-linux.git
[iOS] Fix when we render the font icon image as original (#5753)
fixes #5071
This commit is contained in:
Родитель
ccf8c123c4
Коммит
66062237e0
|
@ -191,6 +191,9 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
|
||||
public sealed class FontImageSourceHandler : IImageSourceHandler
|
||||
{
|
||||
//should this be the default color on the BP for iOS?
|
||||
readonly Color _defaultColor = Color.White;
|
||||
|
||||
public Task<UIImage> LoadImageAsync(
|
||||
ImageSource imagesource,
|
||||
CancellationToken cancelationToken = default(CancellationToken),
|
||||
|
@ -200,7 +203,7 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
var fontsource = imagesource as FontImageSource;
|
||||
if (fontsource != null)
|
||||
{
|
||||
var iconcolor = fontsource.Color != Color.Default ? fontsource.Color : Color.White;
|
||||
var iconcolor = fontsource.Color.IsDefault ? _defaultColor : fontsource.Color;
|
||||
var imagesize = new SizeF((float)fontsource.Size, (float)fontsource.Size);
|
||||
var font = UIFont.FromName(fontsource.FontFamily ?? string.Empty, (float)fontsource.Size) ??
|
||||
UIFont.SystemFontOfSize((float)fontsource.Size);
|
||||
|
@ -217,7 +220,7 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
image = UIGraphics.GetImageFromCurrentImageContext();
|
||||
UIGraphics.EndImageContext();
|
||||
|
||||
if (iconcolor != Color.Default)
|
||||
if (iconcolor != _defaultColor)
|
||||
image = image.ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal);
|
||||
}
|
||||
return Task.FromResult(image);
|
||||
|
|
Загрузка…
Ссылка в новой задаче