Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- WriteableBitmap b = new WriteableBitmap(Weight*frame_size,Height*frame_size);
- // WriteableBitmap uses BGRA format which is 4 bytes per pixel.
- byte[] imageArray = new byte[b.PixelHeight * b.PixelWidth * 4];
- for (int i = 0; i < imageArray.Length; i += 4)
- {
- imageArray[i] = 0; // Blue
- imageArray[i + 1] = 0; // Green
- imageArray[i + 2] = 255; // Red
- imageArray[i + 3] = 0;
- }
- //Open a stream to copy the image contents to the WriteableBitmap's pixel buffer
- using (Stream stream = b.PixelBuffer.AsStream())
- {
- await stream.WriteAsync(imageArray, 0, imageArray.Length);
- }
- SoftwareBitmap outputBitmap = SoftwareBitmap.CreateCopyFromBuffer(b.PixelBuffer,BitmapPixelFormat.Bgra8,b.PixelWidth,b.PixelHeight);
Add Comment
Please, Sign In to add comment