コード例 #1
0
        /// <summary>
        /// Creates an <see cref="Image{T}"/> with only the frame at the specified index
        /// with the same metadata as the original image.
        /// </summary>
        /// <param name="index">The zero-based index of the frame to clone.</param>
        /// <returns>The new <see cref="Image{TPixel}"/> with the specified frame.</returns>
        public Image <TPixel> CloneFrame(int index)
        {
            ImageFrame <TPixel> frame       = this[index];
            ImageFrame <TPixel> clonedFrame = frame.Clone();

            return(new Image <TPixel>(this.parent.GetConfiguration(), this.parent.MetaData.DeepClone(), new[] { clonedFrame }));
        }
コード例 #2
0
        /// <summary>
        /// Clones and inserts the <paramref name="source"/> into the <seealso cref="ImageFrameCollection{TPixel}"/> at the specified <paramref name="index"/>.
        /// </summary>
        /// <param name="index">The zero-based index to insert the frame at.</param>
        /// <param name="source">The <seealso cref="ImageFrame{TPixel}"/> to clone and insert into the <seealso cref="ImageFrameCollection{TPixel}"/>.</param>
        /// <exception cref="ArgumentException">Frame must have the same dimensions as the image.</exception>
        /// <returns>The cloned <see cref="ImageFrame{TPixel}"/>.</returns>
        public ImageFrame <TPixel> InsertFrame(int index, ImageFrame <TPixel> source)
        {
            this.ValidateFrame(source);
            ImageFrame <TPixel> clonedFrame = source.Clone(this.parent.GetConfiguration());

            this.frames.Insert(index, clonedFrame);
            return(clonedFrame);
        }
コード例 #3
0
        /// <summary>
        /// Clones the <paramref name="source"/> frame and appends the clone to the end of the collection.
        /// </summary>
        /// <param name="source">The raw pixel data to generate the <seealso cref="ImageFrame{TPixel}"/> from.</param>
        /// <returns>The cloned <see cref="ImageFrame{TPixel}"/>.</returns>
        public ImageFrame <TPixel> AddFrame(ImageFrame <TPixel> source)
        {
            this.ValidateFrame(source);
            ImageFrame <TPixel> clonedFrame = source.Clone(this.parent.GetConfiguration());

            this.frames.Add(clonedFrame);
            return(clonedFrame);
        }
コード例 #4
0
        /// <summary>
        /// Clones and inserts the <paramref name="source"/> into the <seealso cref="ImageFrameCollection{TPixel}"/> at the specified <paramref name="index"/>.
        /// </summary>
        /// <param name="index">The zero-based index to insert the frame at.</param>
        /// <param name="source">The <seealso cref="ImageFrame{TPixel}"/> to clone and insert into the <seealso cref="ImageFrameCollection{TPixel}"/>.</param>
        /// <exception cref="ArgumentException">Frame must have the same dimensions as the image.</exception>
        /// <returns>The cloned <see cref="ImageFrame{TPixel}"/>.</returns>
        public ImageFrame <TPixel> InsertFrame(int index, ImageFrame <TPixel> source)
        {
            this.ValidateFrame(source);
            ImageFrame <TPixel> clonedFrame = source.Clone();

            this.frames.Insert(index, clonedFrame);
            return(clonedFrame);
        }
コード例 #5
0
        /// <summary>
        /// Clones the <paramref name="source"/> frame and appends the clone to the end of the collection.
        /// </summary>
        /// <param name="source">The raw pixel data to generate the <seealso cref="ImageFrame{TPixel}"/> from.</param>
        /// <returns>The cloned <see cref="ImageFrame{TPixel}"/>.</returns>
        public ImageFrame <TPixel> AddFrame(ImageFrame <TPixel> source)
        {
            this.ValidateFrame(source);
            ImageFrame <TPixel> clonedFrame = source.Clone();

            this.frames.Add(clonedFrame);
            return(clonedFrame);
        }
コード例 #6
0
        /// <summary>
        /// Creates an <see cref="Image{T}"/> with only the frame at the specified index
        /// with the same metadata as the original image.
        /// </summary>
        /// <param name="index">The zero-based index of the frame to clone.</param>
        /// <returns>The new <see cref="Image{TPixel}"/> with the specified frame.</returns>
        public new Image <TPixel> CloneFrame(int index)
        {
            this.EnsureNotDisposed();

            ImageFrame <TPixel> frame       = this[index];
            ImageFrame <TPixel> clonedFrame = frame.Clone();

            return(new Image <TPixel>(this.parent.GetConfiguration(), this.parent.Metadata.DeepClone(), new[] { clonedFrame }));
        }