Exemple #1
0
    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);
        }
Exemple #3
0
 /// <summary>
 /// DISPOSE
 /// </summary>
 public void Dispose()
 {
     try
     {
         //ReleaseMips();
         WICBitmapSource.Dispose();
         if (_pinnedArray.IsAllocated)
         {
             _pinnedArray.Free();
         }
     }
     catch { }
 }