Download the DIBSection Image Processing Sample application (161kb)
Download the Realtime DIBSection Animation Sample (112kb)
Download the DIB Section Class Only (4kb)
This sample requires the SSubTmr.DLL component because it includes an implementation of my
Progress Bar control. Make sure you have loaded and registered this before trying the project.
Updated! 17 February 1999
The previous version of this code crashed when run under NT4.0. This was because
the code was not always clearing up the SAFEARRAY pointer after it had finished
using it. Under Win9x, this did not cause a problem but NT is stricter. All the
samples and the code are now updated to fix this problem.
This sample demonstrates a new 24 bit image processor using the DIB Section GDI object. It also
provides a sample demonstrating realtime image fading and
manipulation for those pointless but kinda fun About screens.
What you can do with this sample:
- Blurring and softening
- Customised filters
- Minimum, Maximum and Average Rank filters for impressionistic effects
- Colourise images
- Darken and Light images
- Gray scale images
- Floyd Stucci Black and White conversion
- Decrease colour depth by dithering and matching to a specified palette.
- Add, subtract with offsets or take the darkest/lightest pixels
- Demonstrating how to use interpolation to create a smooth resized version
of an image.
Supporting Technical Article
Performing the other simple filters (softening, blurring, sharpening, embossing) is described in
my previous image processing sample. This code sample simply
takes exactly the same image processing class but modifies it to operate on the DIB Section
class rather than a Picture object.
Although all the samples should run on systems with a colour depth of 256 colours or less,
there will be two problems:
As usual, with graphics code, running it in the IDE will be like watching paint dry. To get
the techniques in these samples to perform, you must compile to Native Code (optimised for Fast
Code). You can also get a significant speed increase (60% or more) by checking all the
Advanced Optimisations settings.
- The image will be rendered by GDI doing an arbitrary colour depth reduction.
- GDI is often slow when colour reducing DIBs to display on the screen.
Back to top
Back to Source Code Overview