예제 #1
0
        static void ReadFrameData(PrimitiveReader reader, SlpFrameInfo frame)
        {
            long pos1     = reader.Stream.Position;
            int  height   = frame.Height;
            int  rowCount = Math.Abs(height);

            LineMask[] masks = new LineMask[rowCount];
            for (int i = 0; i < rowCount; i++)
            {
                masks[i] = LineMask.ReadFrom(reader);
            }

            long pos2 = reader.Stream.Position;

            uint[] commandOffsets = new uint[rowCount];
            for (int i = 0; i < commandOffsets.Length; i++)
            {
                commandOffsets[i] = reader.ReadUInt32();
            }
            System.Diagnostics.Debugger.Break();

            SlpGraphic graphic = new SlpGraphic(frame.Width, height);

            Console.WriteLine("POS :" + reader.Stream.Position);
            for (int i = 0; i < masks.Length; i++)
            {
                Console.WriteLine("CHECK:" + reader.Stream.Position + "," + commandOffsets[i]);
                ProcessRow(reader, i, graphic, masks[i]);
            }
            Console.WriteLine("POS2:" + reader.Stream.Position);

            long ttt = 0;

            using (StreamWriter tempWriter = new StreamWriter(Path.Combine("tests", "log.txt"))) {
                foreach (string file in Directory.EnumerateFiles("pals"))
                {
                    Palette palette = Palette.FromFile(file);
                    using (Bitmap bmp = graphic.CreateBitmap(palette)) {
                        bmp.Save(Path.Combine("tests", ttt + ".bmp"));
                        //bmp.Save( Path.Combine( "tests", ttt + ".png" ), ImageFormat.Png );
                    }
                    ttt++;
                    tempWriter.WriteLine(ttt + " : " + file);
                }
            }
            throw new Exception();
        }
예제 #2
0
        public static SlpFile FromStream(Stream stream)
        {
            PrimitiveReader reader  = new PrimitiveReader(stream);
            string          version = reader.ReadASCIIString(3);
            string          unknown = reader.ReadASCIIString(1);

            int framesCount = reader.ReadInt32();
            // Either 'ArtDesk SLP 1.00 writer' or
            // 'RGE RLE shape file'
            string comment = reader.ReadASCIIString(24);

            SlpFrameInfo[] frames = new SlpFrameInfo[framesCount];
            for (int i = 0; i < frames.Length; i++)
            {
                frames[i] = SlpFrameInfo.ReadFrom(reader);
                SlpFrameInfo info = frames[i];
            }
            ReadFrameData(reader, frames[0]);
            throw new NotImplementedException();
            return(null);
        }