/// <summary> /// Constructs an HG-3 attribute with the specified Id and <see cref="HG3ATS"/>. /// </summary> /// <param name="id">The identifier for the attribute.</param> /// <param name="ats">The HG3ATS struct containing attribute information.</param> /// <param name="hg3Frame">The HG-3 frame containing this attribute.</param> internal Hg3Attribute(int id, HG3ATS ats, HgxFrame hg3Frame) { Hg3Frame = hg3Frame; Id = id; X = ats.X; Y = ats.Y; Width = ats.Width; Height = ats.Height; Color = Color.FromArgb(ats.Color); }
internal static void ExtractImage(Stream stream, HgxFrame frame, string pngFile, HgxOptions options) { switch (frame.HgxType) { case HgxFormat.Hg2: ExtractHg2ImageFromFrame(stream, frame, pngFile, options); break; case HgxFormat.Hg3: ExtractHg3ImageFromFrame(stream, frame, pngFile, options); break; default: throw new InvalidOperationException($"{nameof(HgxFrame.HgxType)} is not valid!"); } }
private static void ExtractHg3ImageFromFrame(Stream stream, HgxFrame frame, string pngFile, HgxOptions options) { BinaryReader reader = new BinaryReader(stream); stream.Position = frame.FrameOffset; HGXHDR hdr = new HGXHDR { Type = frame.HgxImage.Type }; Hg3FrameInfo frameInfo = ReadHg3FrameInfo(reader, hdr, true); ExtractHg3Image(reader, frameInfo, options, pngFile); }