Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (int y = 0; y < height; y++)
- for (int x = 0; x < width; x++)
- {
- alpha = pixels[y * stride + x * 4 + 3];
- red = pixels[y * stride + x * 4 + 2];
- green = pixels[y * stride + x * 4 + 1];
- blue = pixels[y * stride + x * 4 + 0];
- bitmap.SetPixel(x, y, System.Drawing.Color.FromArgb(alpha, red, green, blue));
- }
- using (MemoryStream memory = new MemoryStream())
- {
- bitmap.Save(memory, ImageFormat.Png);
- memory.Position = 0;
- BitmapImage bitmapImage = new BitmapImage();
- bitmapImage.BeginInit();
- bitmapImage.StreamSource = memory;
- bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
- bitmapImage.EndInit();
- ObrazGlowny = bitmapImage;
- obrazek.Source = bitmapImage;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement