Open mattzirkle opened 5 years ago
Also, right now this is tied directly to returning a Bitmap
object. Something that would be more performant is to return a MemoryStream
. A MemoryStream
is already getting created in this case, so it might not be too much work to change all of the transfer methods to use this as well.
If you look at the function
TWAIN::NativeToBitmap
, you will find the following code:As you can tell by the comments, it looks like the intention here is to make sure the
Bitmap
has the correctPixelFormat
. However, from my testing, it looks like theBitmap
in the variablebitmapStream
that is created from thebyte[]
already has the correctPixelFormat
for what was selected (full color [PixelFormat.Format24bppRgb
], grayscale [PixelFormat.Format8bppIndexed
], or black and white [PixelFormat.Format1bppIndexed
]).Is there a reason that the
PixelFormat
would come back incorrect that the copy is necessary? Or is this a relic of something that was not handled in C++ but is handled in the .NET Framework (GDI+)?