/// <summary> /// Creates or reuses a <see cref="Image"/> instance. /// </summary> /// <param name="imageContent">An image encoded in PNG, JPEG or DDS</param> /// <returns>A <see cref="Image"/> instance.</returns> public Image UseImage(Memory.MemoryImage imageContent) { Memory.MemoryImage._Verify(imageContent, nameof(imageContent)); // If we find an image with the same content, let's reuse it. foreach (var img in this.LogicalImages) { if (img.Content.Equals(imageContent)) { return(img); } } var image = this.CreateImage(); image.Content = imageContent; return(image); }
public bool IsTheSameAs(MemoryImage img) { return(this.Source == img?.Source && this.Image != img?.Image); }