public CancellableBitmapSource(IBitmapSource <TPixel> source, Func <RectInt32, IEnumerable <RectInt32> > sourceRectSplitter, Action <RectInt32> rectCompletedCallback, ICancellationToken cancelToken) { Validate.Begin().IsNotNull <IBitmapSource <TPixel> >(source, "source").IsNotNull <Func <RectInt32, IEnumerable <RectInt32> > >(sourceRectSplitter, "sourceRectSplitter").IsNotNull <ICancellationToken>(cancelToken, "cancelToken").Check(); this.source = source.CreateRef <TPixel>(); this.sourceSize = this.source.Size; this.sourceRectSplitter = sourceRectSplitter; this.rectCompletedCallback = rectCompletedCallback; this.cancelToken = cancelToken; TPixel local = default(TPixel); this.bytesPerPixel = local.BytesPerPixel; }
public ClippedBitmapSource(IBitmapSource <TPixel> source, RectInt32 sourceRect) { Validate.Begin().IsNotNull <IBitmapSource <TPixel> >(source, "source").Check().IsTrue(source.Bounds().Contains(sourceRect), "source.Bounds().Contains(sourceRect)").Check(); this.source = source.CreateRef <TPixel>(); this.sourceRect = sourceRect; }
public static IBitmapSource <TPixel> CreateRef <TPixel>(this IBitmapSource <TPixel> objectRef) where TPixel : struct, INaturalPixelInfo => ((IBitmapSource <TPixel>)objectRef.CreateRef(typeof(IBitmapSource <TPixel>)));
public static IBitmapSource CreateRef(this IBitmapSource objectRef) => ((IBitmapSource)objectRef.CreateRef(typeof(IBitmapSource)));