private bool IsDrCrs(Stream s) { var start = s.Position; var h = new CrsHeader() { Magic1 = s.ReadASCII(4), Version = s.ReadInt32(), Nanims = s.ReadInt32() }; if (h.Magic1 != "CRSR") { s.Position = start; return(false); } if (h.Version != 0x200) { s.Position = start; return(false); } header = h; return(true); }
public DrCrsFrame(Stream s, CrsHeader sph, CrsFrameInfo info) { Type = SpriteFrameType.Indexed; const int width = 32; const int numPixels = width * width; Data = new byte[numPixels]; var pixindex = new Func <int, int, int>((x, y) => y * width + x); for (var y = 0; y < width; ++y) { for (var x = 0; x < width; ++x) { var newIndex = pixindex(x, y); Data[newIndex] = s.ReadUInt8(); } } Offset = new float2(0, 0); FrameSize = new Size(width, width); Size = FrameSize; }