[coregraphics] Expose CGColor.CreateByMatchingToColorSpace (#10223)

and add unit test

Fix https://github.com/xamarin/xamarin-macios/issues/10212
This commit is contained in:
Sebastien Pouliot 2020-12-07 16:40:29 -05:00 коммит произвёл GitHub
Родитель e7855bcca1
Коммит bcc953bf50
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 17 добавлений и 1 удалений

Просмотреть файл

@ -278,7 +278,8 @@ namespace CoreGraphics {
/* __nullable CGColorSpaceRef* */ IntPtr space, CGColorRenderingIntent intent,
/* CGColorRef __nullable */ IntPtr color, /* __nullable CFDictionaryRef */ IntPtr options);
static CGColor CreateByMatchingToColorSpace (CGColorSpace space, CGColorRenderingIntent intent,
[iOS (9,0)][Mac (10,11)]
static public CGColor CreateByMatchingToColorSpace (CGColorSpace space, CGColorRenderingIntent intent,
CGColor color, NSDictionary options)
{
var h = CGColorCreateCopyByMatchingToColorSpace (space == null ? IntPtr.Zero : space.Handle, intent,

Просмотреть файл

@ -107,6 +107,21 @@ namespace MonoTouchFixtures.CoreGraphics {
}
}
[Test]
public void CreateByMatchingToColorSpace ()
{
TestRuntime.AssertXcodeVersion (8, 0);
using (var c = CGColor.CreateByMatchingToColorSpace (null, CGColorRenderingIntent.Default, null, null)) {
Assert.IsNull (c, "0");
}
using (var cs = CGColorSpace.CreateGenericRgbLinear ())
using (var c1 = CGColor.CreateSrgb (1, 2, 3, 4))
using (var c2 = CGColor.CreateByMatchingToColorSpace (cs, CGColorRenderingIntent.Default, c1, null)) {
Assert.IsNotNull (c1, "1");
Assert.IsNotNull (c2, "2");
}
}
}
}