Auto scrolling or shifting a bitmap in .NET
Posted
by mikej
on Stack Overflow
See other posts from Stack Overflow
or by mikej
Published on 2009-08-26T16:34:18Z
Indexed on
2010/03/31
20:03 UTC
Read the original article
Hit count: 394
I have a .NET GDI+ bitmap object (or if it makes the problem easier a WPF bitmap object) and what I want to to is shift the whole lot by dx,dy (whole pixels) and I would ideally like to do it using .NET but API calls are ok. It has to be efficient bacause its going to be called 10,000 times say with moderately large bitmaps.
I have implemented a solution using DrawImage - but its slow and it halts the application for minutes while the GC cleans up the temp objects that have been used.
I have also started to work on a version using ScrollDC but so far have had no luck getting it to work on the DC of the bitmap (I can make it work buy creating an API bitmap with bitmap handle, then creating a compatible DC asnd calling ScrollDC but then I have to put it back into the bitmap object).
There has to be an "inplace" way of shifting a bitmap. mikej
© Stack Overflow or respective owner