![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#11
| |||
| |||
|
|
The VB language doesn't support the use of _unsafe pointers_ so the fastest method of access is not available to VB programmers. When using the Marshal class you don't use pointers, just indexes from a given starting point. If you check out the article on LockBits you'll find a fairly comprehensive description of the various memory buffer layouts for each of the major graphic formats. Whatever method of access you use the physical layouts remain the same. The apparent size of an image on disc may not have any correlation to it's memory footprint. Images are decompressed to a rastar that holds the whole image and so they will take up X*Y*bit-depth/8 bytes regardless of the size on disc. A jpeg of a few hundred K may end up at 3-4-7 hundred megabytes after loading. A 750 meg TIFF might be ok as long as it was a simple format but TIFF is such a huge spec that the GDI+ readers can't handle every different form. It would also depend on things like total available memory and swap-file size. There are no set rules i'm afraid. |
#12
| |||
| |||
|
|
wow, can you point to any example code, I am intermediate at .net so that will help me put things together. I'll check out your site too. thanks for the tip, this should be fun. "Frank Hileman" <frankhil (AT) no (DOT) spamming.prodigesoftware.com |>The fastest method is to avoid any copy of pixels. Since the Bitmap |>constructor accepts a pointer to a pixel buffer, you only have to convert a |>managed array of uint or byte to an IntPtr using GCHandle.Alloc to obtain a |>pinned handle and Marshall.UnsafeAddrOfPinnedArrayElement to convert to an |>IntPtr. Modifying the array contents will modify the pixels/memory within |>the Bitmap directly. LockBits is not needed. | |>You don't need unsafe code or pointer arithmetic (pointers add no speed), |>and it is screaming fast, assuming your format is |>PixelFormat.Format32bppPArgb. |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |