Skip to content

Instantly share code, notes, and snippets.

@veigr
Created February 4, 2015 06:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save veigr/fad744b9c7ddf5738722 to your computer and use it in GitHub Desktop.
Save veigr/fad744b9c7ddf5738722 to your computer and use it in GitHub Desktop.
[WinRT][SharpDX]変換結果の描写
// 変換結果の描写
var stride = transform.Size.Width * 4; //横1行のバイト数
var size = stride * transform.Size.Height;
var bytes = new byte[size];
transform.CopyPixels(bytes, stride);
// SharpDX.WIC.BitmapSourceをWritableBitmapに変換
var bitmap = new WriteableBitmap(transform.Size.Width, transform.Size.Height);
using (var s = bitmap.PixelBuffer.AsStream())
{
await s.WriteAsync(bytes, 0, size);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment