本文作者:StubbornHuang
版权声明:本文为站长原创文章,如果转载请注明原文链接!
原文标题:Unity – Color32[]转IntPtr
原文链接:https://www.stubbornhuang.com/938/
发布于:2020年10月15日 9:59:27
修改于:2020年10月31日 16:42:12
1 Color32[]转Inptr
代码示例:
private static IntPtr Color32ArrayToIntptr(Color32[] colors,int length)
{
if (colors == null || colors.Length == 0)
return IntPtr.Zero;
GCHandle handle = default(GCHandle);
IntPtr ptr = IntPtr.Zero;
try
{
handle = GCHandle.Alloc(colors, GCHandleType.Pinned);
ptr = handle.AddrOfPinnedObject();
}
finally
{
if (handle != default(GCHandle))
handle.Free();
}
return ptr;
}
当前分类随机文章推荐
- Unity - Color32[]转IntPtr 阅读3037次,点赞1次
- Unity - 字节数组byte[]保存为文件 阅读4618次,点赞2次
- Unity - Color32[]转为byte[]字节数组 阅读3411次,点赞1次
全站随机文章推荐
- 用MFC写一个简易的恶作剧QQ好友的聊天轰炸机 阅读2430次,点赞1次
- 资源分享 - Div, Grad, Curl, and All That - An Informal Text on Vector Calculus , Third Edition 英文高清PDF下载 阅读1445次,点赞0次
- 资源分享 - Hands-On C++ Game Animation Programming 英文PDF下载 阅读766次,点赞0次
- WordPress - 纯代码在文章内容末尾添加当前文章同一分类下的随机推荐文章 阅读2498次,点赞0次
- Google Adsense - 使用招商银行电汇收款 阅读1253次,点赞2次
- 资源分享 - Practical Algorithms for 3D Computer Graphics, Second Edition 英文高清PDF下载 阅读1540次,点赞1次
- Pytorch - torch.stack参数详解与使用 阅读747次,点赞0次
- Duilib - Edit编辑控件输入文字时编辑框背景颜色不是所设置的背景颜色的问题 阅读528次,点赞1次
- 资源分享 - Handbook of Discrete and Computational Geometry, Second Edition 英文高清PDF下载 阅读2082次,点赞0次
- Python - 配置Yolov5出现ImportError: cannot import name 'PILLOW_VERSION' from 'PIL'错误 阅读1308次,点赞0次
评论
169