如题
using UnityEngine;
public class BicubicInterpolationResizer
{
public static Texture2D Resize(Texture2D texture , int width , int high,bool isnew=false)
{
int sWidth = texture.width;
int sHigh = texture.height;
float dx, dy, bmdx, bndy;
float tx = (float) sWidth / (float) width;
float ty = (float) sHigh / (float) high;
var rawData = texture.GetPixels32(0);
Color[] newColor = new Color[width * high];
for (int i = 0; i < high; i++)
{
for (int j = 0; j < width; j++)
{
int x = (int) (tx * j);
int y = (int) (ty * i);
dx = tx * j - x;
dy = ty * i - y;
for (int k = -1; k <= 2; k++)
{
bmdx = BSpline(k