| 1234567891011121314151617 |
- using System.Globalization;
- using Avalonia.Data.Converters;
- using Avalonia.Media.Imaging;
- namespace InABox.Avalonia.Converters;
- public class ByteArrayToImageSourceConverter : AbstractConverter<byte[], Bitmap?>
- {
- protected override Bitmap? Convert(byte[]? value, object? parameter = null)
- {
- Bitmap? result = null;
- if (value is byte[] bytes)
- using (var stream = new MemoryStream(bytes))
- result = new Bitmap(stream);
- return result;
- }
- }
|