public byte[] DecorateSourceWithMetaInformation( byte[] source, ImageMetaInformation information) { var metaData = ConvertMetaInformationToByteArray(information); return metaData .Concat(source) .ToArray(); }
public byte[] DecorateSourceWithMetaInformation( byte[] source, ImageMetaInformation information) { var metaData = ConvertMetaInformationToByteArray(information); return(metaData .Concat(source) .ToArray()); }
static BitmapSource GenerateBitmapSource( ImageMetaInformation metaInformation, byte[] imageData) { var bytesPerPixel = (metaInformation.PixelFormat.BitsPerPixel + 7) / 8; var stride = bytesPerPixel * metaInformation.Width; return(BitmapSource.Create( metaInformation.Width, metaInformation.Height, metaInformation.DpiX, metaInformation.DpiY, metaInformation.PixelFormat, null, imageData, stride)); }
public byte[] ConvertBitmapSourceToByteArray(BitmapSource bitmap) { if (bitmap == null) { return(null); } var metaInformation = new ImageMetaInformation { DpiX = bitmap.DpiX, DpiY = bitmap.DpiY, Width = bitmap.PixelWidth, Height = bitmap.PixelHeight, PixelFormat = bitmap.Format }; var imageData = ConvertImageDataToByteArray(bitmap); return(DecorateSourceWithMetaInformation( imageData, metaInformation)); }
public byte[] ConvertBitmapSourceToByteArray(BitmapSource bitmap) { if (bitmap == null) { return null; } var metaInformation = new ImageMetaInformation { DpiX = bitmap.DpiX, DpiY = bitmap.DpiY, Width = bitmap.PixelWidth, Height = bitmap.PixelHeight, PixelFormat = bitmap.Format }; var imageData = ConvertImageDataToByteArray(bitmap); return DecorateSourceWithMetaInformation( imageData, metaInformation); }
IEnumerable <byte> ConvertMetaInformationToByteArray( ImageMetaInformation metaInformation) { return(generalNativeApi .StructureToByteArray(metaInformation)); }
IEnumerable<byte> ConvertMetaInformationToByteArray( ImageMetaInformation metaInformation) { return generalNativeApi .StructureToByteArray(metaInformation); }
static BitmapSource GenerateBitmapSource( ImageMetaInformation metaInformation, byte[] imageData) { var bytesPerPixel = (metaInformation.PixelFormat.BitsPerPixel + 7)/8; var stride = bytesPerPixel*metaInformation.Width; return BitmapSource.Create( metaInformation.Width, metaInformation.Height, metaInformation.DpiX, metaInformation.DpiY, metaInformation.PixelFormat, null, imageData, stride); }