@@ -15,34 +15,29 @@ namespace ImageMagick;
1515public static partial class IMagickImageExtentions
1616{
1717 /// <summary>
18- /// Converts this instance to a <see cref="WriteableBitmap"/> with a default DPI of 96x96.
18+ /// Converts this instance to a <see cref="WriteableBitmap"/> with a default dpi of 96x96.
1919 /// </summary>
2020 /// <param name="self">The image.</param>
2121 /// <typeparam name="TQuantumType">The quantum type.</typeparam>
2222 /// <returns>A <see cref="WriteableBitmap"/>.</returns>
23- public static unsafe WriteableBitmap ToWriteableBitmap < TQuantumType > ( this IMagickImage < TQuantumType > self )
23+ public static WriteableBitmap ToWriteableBitmap < TQuantumType > ( this IMagickImage < TQuantumType > self )
2424 where TQuantumType : struct , IConvertible
25- {
26- return self . ToWriteableBitmapInternal ( false ) ;
27- }
28-
25+ => self . ToWriteableBitmapInternal ( new Vector ( 96 , 96 ) ) ;
26+
2927 /// <summary>
3028 /// Converts this instance to a <see cref="WriteableBitmap"/>.
3129 /// </summary>
3230 /// <param name="self">The image.</param>
3331 /// <typeparam name="TQuantumType">The quantum type.</typeparam>
3432 /// <returns>A <see cref="WriteableBitmap"/>.</returns>
35- public static unsafe WriteableBitmap ToWriteableBitmapWithDensity < TQuantumType > ( this IMagickImage < TQuantumType > self )
33+ public static WriteableBitmap ToWriteableBitmapWithDensity < TQuantumType > ( this IMagickImage < TQuantumType > self )
3634 where TQuantumType : struct , IConvertible
37- {
38- return self . ToWriteableBitmapInternal ( true ) ;
39- }
35+ => self . ToWriteableBitmapInternal ( new Vector ( self . Density . X , self . Density . Y ) ) ;
4036
41- private static unsafe WriteableBitmap ToWriteableBitmapInternal < TQuantumType > ( this IMagickImage < TQuantumType > self , bool withDensity )
37+ private static unsafe WriteableBitmap ToWriteableBitmapInternal < TQuantumType > ( this IMagickImage < TQuantumType > self , Vector density )
4238 where TQuantumType : struct , IConvertible
4339 {
4440 var size = new PixelSize ( ( int ) self . Width , ( int ) self . Height ) ;
45- var density = withDensity ? new Vector ( self . Density . X , self . Density . Y ) : new Vector ( 96 , 96 ) ;
4641 var bitmap = new WriteableBitmap ( size , density , PixelFormats . Rgba8888 , AlphaFormat . Unpremul ) ;
4742
4843 using var framebuffer = bitmap . Lock ( ) ;
0 commit comments