Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1.  
  2. for (int y = 0; y < height; y++)
  3. for (int x = 0; x < width; x++)
  4. {
  5. alpha = pixels[y * stride + x * 4 + 3];
  6. red = pixels[y * stride + x * 4 + 2];
  7. green = pixels[y * stride + x * 4 + 1];
  8. blue = pixels[y * stride + x * 4 + 0];
  9. bitmap.SetPixel(x, y, System.Drawing.Color.FromArgb(alpha, red, green, blue));
  10. }
  11.  
  12. using (MemoryStream memory = new MemoryStream())
  13. {
  14. bitmap.Save(memory, ImageFormat.Png);
  15. memory.Position = 0;
  16. BitmapImage bitmapImage = new BitmapImage();
  17. bitmapImage.BeginInit();
  18. bitmapImage.StreamSource = memory;
  19. bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
  20. bitmapImage.EndInit();
  21. ObrazGlowny = bitmapImage;
  22. obrazek.Source = bitmapImage;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement