A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© 滔哥 黑马帝   /  2014-7-15 13:58  /  1005 人查看  /  0 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

先上图








之前的截图在Y轴上出现问题,已经修复了。工程也修改了

代码中的问题。
原来的方法,Y轴会出现问题


  1. Color[] pix = screenTex.GetPixels(Mathf.CeilToInt(startX), Mathf.CeilToInt(startY), (int)shotLength, (int)shotHeight);
  2. cutImageTex = new Texture2D ((int)shotLength, (int)shotHeight,TextureFormat.RGB24,false);
  3. cutImageTex.SetPixels (pix);
  4. cutImageTex.Apply ();

复制代码


修改后的方法:

  1. cutImageTex = new Texture2D ((int)shotLength, (int)shotHeight,TextureFormat.RGB24,false);int startx = Mathf.CeilToInt (startX);
  2. int starty = Screen.height - Mathf.CeilToInt (startY);int width = (int)shotLength;
  3. int height = (int)shotHeight;for(int i=0; i<width; i++)
  4. { int hhh = 0;
  5. for(int j=height; j>=0; j--) {
  6. hhh++; Color color = screenTex.GetPixel(startx+i,starty-hhh);
  7. cutImageTex.SetPixel(i,j,color); }
  8. }cutImageTex.Apply ();
复制代码

源代码-回复可见:
游客,如果您要查看本帖隐藏内容请回复



0 个回复

您需要登录后才可以回帖 登录 | 加入黑马