示例#1
0
 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);
     }
 }
示例#2
0
        public static Stream GetPreviewImage(HdPakFrame frame)
        {
            using var image        = GetSpriteSheet(frame.SourceFilePath, frame.SheetDataOffset, frame.SheetCompressedLength);
            using var previewImage = (MagickImage)image.Clone(frame.Metadata.X, frame.Metadata.Y, frame.Metadata.Width, frame.Metadata.Height);

            previewImage.Rotate(90.0 * frame.Metadata.Rotation);
            previewImage.AdaptiveResize(150, 150);

            var result = new MemoryStream();

            previewImage.Write(result, MagickFormat.Png);
            return(result);
        }