public override void CopyPixels(Int32Rect sourceRect, Array pixels, int stride, int offset) { if (offset != 0) { throw new NotSupportedException(); } WICBitmapSource.CopyPixels( new SharpDX.Mathematics.Interop.RawRectangle(sourceRect.X, sourceRect.Y, sourceRect.Width, sourceRect.Height), (byte[])pixels, stride); }
public static WICBitmapSource CreateWicBitmap(Stream str) { WICBitmapSource bs = new WICBitmapSource(); ImagingFactory fac = ThreadResource.GetWicFactory(); bs.Decoder = new BitmapDecoder(fac, str, DecodeOptions.CacheOnLoad); bs.FrameDecoder = bs.Decoder.GetFrame(0); bs.Converter = new FormatConverter(fac); bs.Converter.Initialize(bs.FrameDecoder, SharpDX.WIC.PixelFormat.Format32bppPRGBA); return(bs); }
/// <summary> /// DISPOSE /// </summary> public void Dispose() { try { //ReleaseMips(); WICBitmapSource.Dispose(); if (_pinnedArray.IsAllocated) { _pinnedArray.Free(); } } catch { } }