예제 #1
0
        void TestLoadLionFromBinaryFile()
        {
            System.Diagnostics.Debugger.Break();
            //test load raw buffer
            using (var fs = new System.IO.FileStream("..\\lion_stream.bin", System.IO.FileMode.Open))
            {
                var reader     = new System.IO.BinaryReader(fs);
                var lionShape2 = new PixelFarm.Agg.SpriteShape();

                PixelFarm.Agg.VertexSource.PathWriter path;
                PixelFarm.Agg.ColorRGBA[]             colors;
                int[] pathIndexList;
                //1. path and command
                PixelFarm.Agg.VertexSource.dbugVertexSourceIO.ReadPathDataFromStream(
                    reader, out path
                    );
                //2. colors
                PixelFarm.Agg.VertexSource.dbugVertexSourceIO.ReadColorDataFromStream(
                    reader, out colors
                    );
                //3. path indice
                int npaths;
                PixelFarm.Agg.VertexSource.dbugVertexSourceIO.ReadPathIndexListFromStream(
                    reader, out npaths, out pathIndexList
                    );

                //------------------------------
                SpriteShape.UnsafeDirectSetData(lionShape2,
                                                npaths,
                                                path, colors, pathIndexList);
                //---------------------------------

                fs.Close();

                this.lionShape = lionShape2;
            }
        }