Exemple #1
0
        private static IReadOnlyList <ImageSliceInfo> CreateImageSlices(string metadata, int scaling)
        {
            var result = new List <ImageSliceInfo>();

            var    reader = new StringReader(metadata);
            string line;

            while ((line = reader.ReadLine()) != null)
            {
                if (string.IsNullOrWhiteSpace(line))
                {
                    continue;
                }

                var tokens = line.Split(' ');

                if (tokens[1] != "0")
                {
                    //have no clue what this is. Maybe different channel for shadow?
                    continue;
                }
                var slice = new ImageSliceInfo
                {
                    Name     = tokens[0],
                    X        = int.Parse(tokens[6]),
                    Y        = int.Parse(tokens[7]),
                    Width    = int.Parse(tokens[8]),
                    Height   = int.Parse(tokens[9]),
                    Rotation = int.Parse(tokens[10]),
                    Scaling  = scaling
                };
                result.Add(slice);
            }
            return(result);
        }
Exemple #2
0
 public HdPakFrame(string sourceFilePath, int sheetDataOffset, int sheetCompressedLength, ImageSliceInfo metadata)
 {
     SourceFilePath        = sourceFilePath;
     SheetDataOffset       = sheetDataOffset;
     SheetCompressedLength = sheetCompressedLength;
     Metadata = metadata;
 }
 public void AddImage(string sourceFile, int dataOffset, int compressedLength, ImageSliceInfo imageSlice)
 {
     if (!HdPakFrames.TryGetValue(imageSlice.Name, out var image))
     {
         image = new HdPakFrame(sourceFile, dataOffset, compressedLength, imageSlice);
         HdPakFrames.Add(imageSlice.Name, image);
     }
 }