using UnityEngine; using System.Collections; namespace uGIF { public class Image { public int width; public int height; public Color32[] pixels; public Image (Texture2D f) { pixels = f.GetPixels32 (); width = f.width; height = f.height; } public Image (Image image) { pixels = image.pixels.Clone () as Color32[]; width = image.width; height = image.height; } public Image (int width, int height) { this.width = width; this.height = height; pixels = new Color32[width * height]; } public void DrawImage (Image image, int i, int i2) { throw new System.NotImplementedException (); } public Color32 GetPixel (int tw, int th) { var index = (th * width) + tw; return pixels [index]; } public void Flip () { for (var y = 0; y < height/2; y++) { for (var x = 0; x < width; x++) { var top = y * width + x; var bottom = (height - y - 1) * width + x; var temp = pixels [top]; pixels [top] = pixels [bottom]; pixels [bottom] = temp; } } } public void Resize (int scale) { if (scale <= 1) return; var newWidth = width / scale; var newHeight = height / scale; var newColors = new Color32[newWidth * newHeight]; for (var y=0; y