CPF/CPF.Mac/Mac/CoreImage/CIContextOptions.cs
2023-11-21 23:05:03 +08:00

50 lines
1.0 KiB
C#

using CPF.Mac.CoreFoundation;
using CPF.Mac.CoreGraphics;
using CPF.Mac.Foundation;
namespace CPF.Mac.CoreImage
{
public class CIContextOptions
{
public CGColorSpace OutputColorSpace
{
get;
set;
}
public CGColorSpace WorkingColorSpace
{
get;
set;
}
public bool UseSoftwareRenderer
{
get;
set;
}
internal NSDictionary ToDictionary()
{
if (OutputColorSpace == null && WorkingColorSpace == null && !UseSoftwareRenderer)
{
return null;
}
NSMutableDictionary nSMutableDictionary = new NSMutableDictionary();
if (OutputColorSpace != null)
{
nSMutableDictionary.LowlevelSetObject(OutputColorSpace.Handle, CIContext.OutputColorSpace.Handle);
}
if (WorkingColorSpace != null)
{
nSMutableDictionary.LowlevelSetObject(WorkingColorSpace.Handle, CIContext.WorkingColorSpace.Handle);
}
if (UseSoftwareRenderer)
{
nSMutableDictionary.LowlevelSetObject(CFBoolean.True.Handle, CIContext.UseSoftwareRenderer.Handle);
}
return nSMutableDictionary;
}
}
}