Example #1
0
            public PixelData(InputStream ins, PixelHeader pixh)
            {
                int imageSize = (int)(pixh.width * pixh.height) * 4;

                pixels = SwizzleFilter(ins.ReadBytes(imageSize), pixh.width, pixh.height);
                //pixels = ins.ReadBytes(imageSize);

                width  = pixh.width;
                height = pixh.height;
                bpp    = pixh.bpp;
            }
Example #2
0
        public static MapTX2 FromStream(byte[] stream)
        {
            //Create new TX2
            MapTX2 tx2 = new MapTX2();

            tx2.image = new List <PixelData>();

            //Open InputStream
            using (InputStream ins = new InputStream(stream))
            {
                //Create pixel objects
                PixelHeader header;

                //Loop until end of file
                while (ins.Tell() != ins.Size())
                {
                    header = new PixelHeader(ins);

                    tx2.image.Add(new PixelData(ins, header));
                }
            }

            return(tx2);
        }