예제 #1
0
        private ImageFrame <TPixel> CopyNonCompatibleFrame(ImageFrame source)
        {
            var result = new ImageFrame <TPixel>(
                this.parent.GetConfiguration(),
                source.Size(),
                source.Metadata.DeepClone());

            source.CopyPixelsTo(result.PixelBuffer.GetSpan());
            return(result);
        }
예제 #2
0
        private static Size ValidateFramesAndGetSize(IEnumerable <ImageFrame <TPixel> > frames)
        {
            Guard.NotNull(frames, nameof(frames));

            ImageFrame <TPixel> rootFrame = frames.FirstOrDefault();

            if (rootFrame == null)
            {
                throw new ArgumentException("Must not be empty.", nameof(frames));
            }

            Size rootSize = rootFrame.Size();

            if (frames.Any(f => f.Size() != rootSize))
            {
                throw new ArgumentException("The provided frames must be of the same size.", nameof(frames));
            }

            return(rootSize);
        }