unity3d怎么用程序调用调色板
答案:2 悬赏:0
解决时间 2021-02-19 04:48
- 提问者网友:妖精ξ也會哭
- 2021-02-18 22:49
unity3d怎么用程序调用调色板
最佳答案
- 二级知识专家网友:说多了都是废话
- 2021-02-18 22:54
几种思路:
1. 你可以写 Native 插件,调用本地系统的调色板,比如用 PInvoke 调用 Windows 的调色板对话框Comdlg32.dll 中的 ChooseColor 函数。
2. 用 NGUI 系统自己画出调色板界面。
3. 调入一张色块图,取色块图上的像素颜色。示例如下:
System.Drawing.Image img = System.Drawing.Image.FromFile(Application.dataPath + "/1.jpg");
Bitmap bm = new Bitmap(img, 500, 500);
if (Input.mousePosition.x < 500 && Input.mousePosition.y < 500)
{
System.Drawing.Color pc = bm.GetPixel((int)Input.mousePosition.x,500 - (int)Input.mousePosition.y);
UnityEngine.Color nuc = new UnityEngine.Color(pc.R / 255.0f, pc.G / 255.0f, pc.B / 255.0f, 1.0f);
//Debug.Log(pc.R+ "//"+ pc.G+ "//"+ pc.B);
target.renderer.material.color = nuc;
}
1. 你可以写 Native 插件,调用本地系统的调色板,比如用 PInvoke 调用 Windows 的调色板对话框Comdlg32.dll 中的 ChooseColor 函数。
2. 用 NGUI 系统自己画出调色板界面。
3. 调入一张色块图,取色块图上的像素颜色。示例如下:
System.Drawing.Image img = System.Drawing.Image.FromFile(Application.dataPath + "/1.jpg");
Bitmap bm = new Bitmap(img, 500, 500);
if (Input.mousePosition.x < 500 && Input.mousePosition.y < 500)
{
System.Drawing.Color pc = bm.GetPixel((int)Input.mousePosition.x,500 - (int)Input.mousePosition.y);
UnityEngine.Color nuc = new UnityEngine.Color(pc.R / 255.0f, pc.G / 255.0f, pc.B / 255.0f, 1.0f);
//Debug.Log(pc.R+ "//"+ pc.G+ "//"+ pc.B);
target.renderer.material.color = nuc;
}
全部回答
- 1楼网友:一个很哇塞的汉子
- 2021-02-18 23:54
举个例子:intmax(int,int);intmain(){intz=max(1,2);}intmax(intx,inty){returnx>y?x:y;}
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯