public Color[] SetData(Color[] px, byte[] zpx, Rectangle rect)
{
PixelCache = null; //can't exactly dispose this.. it's likely still in use!
ZCache = null;
PixelData = px;
ZBufferData = zpx;
Position = new Vector2(rect.X, rect.Y);
Width = rect.Width;
Height = rect.Height;
Flags = 7;
TransparentColorIndex = 255;
var colors = SPR2FrameEncoder.QuantizeFrame(this, out PalData);
var palt = new Color[256];
int i = 0;
foreach (var c in colors)
palt[i++] = new Color(c.R, c.G, c.B, (byte)255);
return palt;
}