/// <summary> /// Initializes a new instance of the <see cref="ImageFrame"/> class /// by making a copy from another image. /// </summary> /// <param name="other">The other image, where the clone should be made from.</param> /// <exception cref="System.ArgumentNullException"><paramref name="other"/> is null /// (Nothing in Visual Basic).</exception> public ImageFrame(ImageFrame other) : base(other) { Contract.Requires<ArgumentNullException>(other != null, "Other image cannot be null."); Contract.Requires<ArgumentException>(other.IsFilled, "Other image has not been loaded."); Contract.Ensures(IsFilled); }
private static ExtendedImage PerformAction(ExtendedImage source, bool clone, Action<ImageBase, ImageBase> action) { VerifyHasLoaded(source); ExtendedImage transformedImage = clone ? new ExtendedImage(source) : new ExtendedImage(); action(source, transformedImage); foreach (ImageFrame frame in source.Frames) { ImageFrame temp = new ImageFrame(); action(frame, temp); if (!clone) { transformedImage.Frames.Add(temp); } } return transformedImage; }