static public PacImageFileReader Read(String filePath)
        {
            PacImageFileReader g = new PacImageFileReader();

            g.id     = filePath;
            g.width  = 320;
            g.height = 200;
            File file = FileSystem.GetFile(filePath);

            g.memFile = file.ReadAllBytes();

            g.moveCmd = new short[15];
            for (int i = 0; i < 15; i++)
            {
                g.moveCmd[i] = g.memFile[i];
                if (g.moveCmd[i] >= 0x80)
                {
                    g.moveCmd[i] = (short)-(0x100 - g.moveCmd[i]);
                }
            }


            // calc color table offset
            //PixelColor[] data = new PixelColor[3];
            //ByteBuffer b = new ByteBuffer(1, 1, data);
            //g.Draw(ref b);

            // TODO: optimize loading sequence

            g.bytes = new PixelColor[g.width * g.height];
            ByteBuffer buffer = new ByteBuffer(g.width, g.height, g.bytes);

            g.Draw(ref buffer);

            if (g.hasColorTable)
            {
                g.table = new ColorTable();
                g.table.FromPac(g.memFile, g.colorTableOffset, g.moveCmd);
                BurnGfxData.Instance.AddPacColorTable(filePath, g.table);

                //    g.table.save(filePath);
            }

            g.Draw(ref buffer);

            return(g);
        }
示例#2
0
 public void Process(ResourceID ID)
 {
     //File file = FileSystem.GetFile(filePath);
     image = PacImageFileReader.Read(ID.File);
     size  = new Vector2(image.Width, image.Height);
 }