This is a WD17 project, which can run either in 32-bit mode or in 64-bit mode.
(This is the update of a WD9 project written in 2006.)
It shows the use of 3 different techniques to replace all the pixels of a certain color by another.
1 - With the dPixelColor / dPoint functions of WLanguage.
2 - With the low level API in the ReplaceColor procedure.
3 - With the ZI_ReplaceRGBColor function of the GDImage graphics library.
The 64-bit version is configured by default.
If you want to test in 32-bit mode, you must replace the constant GDImage = "GDImage64" with GDImage = "GDImage".
Depending on whether you use the GetObjectA API in 32-bit or 64-bit mode, it is imperative to adjust the alignment of the BITMAP structure because the alignment is performed on 4-byte in 32-bit, and on 8 -byte in 64-bit.
To work around this problem I use 2 different structures, BITMAP in 32, and BITMAP64 in 64 (additional dummy member of 4-byte to change to a size of 32 bytes instead of the 28 used in 32-bit).
This is reflected in the ReplaceColor procedure, by the code that appears below to manage the 2 configurations.
IF In64bitMode() THEN
bmW = bm64.bmWidth; bmH = bm64.bmHeight
bmBPix = bm64.bmBitsPixel
bmW = bm.bmWidth; bmH = bm.bmHeight
bmBPix = bm.bmBitsPixel
The time used by each of the 3 versions is precisely measured thanks to the use of the "QueryPerformanceFrequency" and "QueryPerformanceCounter" APIs.
To really test the speed of the 3 proposed solutions, have fun clicking each button several times to see the responsiveness of the display.
And if you can, do a test in version 17 and in version 25, to compare the results