[coregraphics] Expose CGColor.CreateByMatchingToColorSpace (#10223)
and add unit test Fix https://github.com/xamarin/xamarin-macios/issues/10212
This commit is contained in:
Родитель
e7855bcca1
Коммит
bcc953bf50
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче