gpt4 book ai didi

swift - Xamarin 中的 CGMutablePath

转载 作者:可可西里 更新时间:2023-11-01 00:56:16 24 4
gpt4 key购买 nike

我正在尝试为我的 Xamarin.iOS 应用翻译这段代码:

https://github.com/yourtion/YXWaveView/blob/master/YXWaveView/YXWaveView.swift

第 179 行:

let path = CGMutablePath()

我在 Xamarin 中找不到 CGMutablePath

最佳答案

ObjC CGMutablePathRef 结构(或 Swift CGMutablePath 类)被 Xamarin.iOS 包装为 CGPath(CoreGraphics命名空间)。

var path = new CGPath();

xamarin-macios/src/CoreGraphics/CGPath.cs

public class CGPath : INativeObject, IDisposable {
internal IntPtr handle;

[DllImport (Constants.CoreGraphicsLibrary)]
extern static /* CGMutablePathRef */ IntPtr CGPathCreateMutable ();

public CGPath ()
{
handle = CGPathCreateMutable ();
}

[Mac(10,7)][iOS (5,0)]
public CGPath (CGPath reference, CGAffineTransform transform)
{
if (reference == null)
throw new ArgumentNullException ("reference");
handle = CGPathCreateMutableCopyByTransformingPath (reference.Handle, ref transform);
}

[DllImport (Constants.CoreGraphicsLibrary)]
extern static /* CGMutablePathRef */ IntPtr CGPathCreateMutableCopy (/* CGPathRef */ IntPtr path);

public CGPath (CGPath basePath)
{
if (basePath == null)
throw new ArgumentNullException ("basePath");
handle = CGPathCreateMutableCopy (basePath.handle);
}
~~~~~

关于swift - Xamarin 中的 CGMutablePath,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47416510/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com