public Texture2D CombineTexture(Texture2D background, Texture2D top)
{
int width = background.width;
int height = background.height;
Texture2D ret = new Texture2D(width, height);
for(int x = ; x < width; x++)
{
for(int y = ; y < height; y++)
{
ret.SetPixel(x, y, background.GetPixel(x, y));
}
} int topWidth = top.width;
int topHeight = top.height;
int x_start = width / - topWidth / ;
int y_start = height / - topHeight / ; for (int x = x_start; x < topWidth + x_start; x++)
{
for (int y = y_start; y < topHeight + y_start; y++)
{
Color bgColor = background.GetPixel(x, y);
Color topColor = top.GetPixel(x - x_start, y - y_start);
ret.SetPixel(x, y, Color.Lerp(bgColor, topColor, topColor.a/1f));
}
}
ret.Apply();
return ret;
}

tip: the background and top texture need can readable.

最新文章

  1. C#文件目录操作完全手册
  2. Android开发之JavaMail发送邮件(用户反馈)
  3. osg::NodeVisitor中计算一个节点对应的世界变换矩阵、法向量、顶点坐标
  4. Password Attacker
  5. 使用函数库(JAVA API)
  6. Nginx 笔记与总结(7)Location:正则匹配
  7. CSS从大图中抠取小图完整教程(background-position应用)
  8. login.java
  9. tomcat docBase 和 path
  10. 使用 Proxy + Promise 实现 依赖收集
  11. Jmeter之性能压测Stepping Thread Group 逐步增加并发数 阶梯式加压并发 (十五)
  12. 网络协议笔记-网络层-路由器的作用、IP地址
  13. ionic笔记
  14. ACM算法竞赛:抄课文
  15. [20190402]关于semtimedop函数调用2.txt
  16. 01.QT初学--两个窗口相互切换
  17. JDK1.8 LongAdder 空间换时间: 比AtomicLong还高效的无锁实现
  18. flask 第五章 WebSocket GeventWebsocket 单聊群聊 握手 解密 加密
  19. PAT A1142 Maximal Clique (25 分)——图
  20. windows2008r2系统破解登录密码方法

热门文章

  1. js事件的机制
  2. win2003 HookPort 服务启动失败的解决办法!
  3. 关于PCA的一些学习汇总
  4. PAT——1049. 数列的片段和
  5. 【hdu 3177 Crixalis&#39;s Equipment】 题解
  6. Oracle 使用RMAN进行备份
  7. iOS 推送功能打包后获取不到deviceToken
  8. Java实现目的选层电梯的调度
  9. solve the promble of VMware Workstation Ubuntu18.04 ethernet interface losting
  10. Bootstrap01