/// <summary> /// Adds a <see cref="PngFrame"/> to the internal list. /// </summary> /// <param name="frame">A <see cref="PngFrame"/> instance to insert.</param> /// <param name="index">Specific index at which <paramref name="frame"/> should be inserted, default is -1 which will lead to inserting at the end of the list.</param> /// <exception cref="ArgumentOutOfRangeException" /> public void AddPngFrame(PngFrame frame, int index = -1) { if (index == -1) { this._Frames.Add(frame); } else { this._Frames.Insert(index, frame); } }
public override bool TryParseSprite(Stream s, out ISpriteFrame[] frames, out TypeDictionary metadata) { PngFrame isf = new PngFrame(); Png p = new Png(s); isf.Data = p.Data; isf.Size = new Size(p.Width, p.Height); isf.FrameSize = new Size(p.Width, p.Height); frames = new ISpriteFrame[1]; frames[0] = isf; metadata = new TypeDictionary { new PngSheetMetadata(p.EmbeddedData), new EmbeddedSpritePalette(p.Palette.Select(x => (uint)x.ToArgb()).ToArray()) }; //metadata = null; return(true); }
/// <summary> /// Removes a specified <see cref="PngFrame"/> instance. /// </summary> /// <param name="frame">The element to be removed.</param> /// <returns>True if succeeded, otherwise false.</returns> public bool RemovePngFrame(PngFrame frame) { return(this._Frames.Remove(frame)); }