kingBook

导航

Unity 垂直翻转位图颜色数据

/// <summary>
/// 垂直翻转位图颜色数据
/// </summary>
private Color[] flipVerticalBitmapColors(Color[] colors,ushort bitmapWidth,ushort bitmapHeight){
	Color[] tempColors=new Color[colors.Length];
	int i=bitmapHeight;
	while(--i>=0){
		var sourceStartIndex=i*bitmapWidth;
		var destStartIndex=(bitmapHeight-i-1)*bitmapWidth;
		Array.Copy(colors,sourceStartIndex,tempColors,destStartIndex,bitmapWidth);
	}
	return tempColors;
}

posted on 2020-07-12 14:35  kingBook  阅读(251)  评论(0编辑  收藏  举报