Looking for my PhotoDemon photo editor? It has a dedicated site here: photodemon.org
All code samples and projects on this site are released under a simplified BSD License, which allows for use in both personal and commercial projects as long as you provide attribution and disclaimer of warranty. (That said, if you use my code in your own project, I’m always grateful for notification and/or bug reports. Emails are easy to write!)
To help visitors navigate the large number of projects on this site, I’ve created the following directory. I try to update this page as soon as a new project is uploaded, but if you cannot locate something specific, try the search box to the left.
All code on this site is provided free of charge, under a permissive open-source license. Pass along the good will with a small donation to fund server costs and to help me support my family. Even $1.00 helps. Thank you!
October 2015 Update: hosting so many source code downloads has become quite a strain on my server, so I’m currently in the process of moving all my code samples to GitHub. Given the number of source-code downloads on the site, this is a time-consuming process, but the end result will be a much better experience for everyone, including you! Until the new repo is ready, I’ve left the old download links intact, so the site should continue to function normally – but be forewarned that the old .zip file downloads will be switched to GitHub in the coming days.
- Hidden Markov Models, the Viterbi Algorithm, and CpG Islands
- Evolution and Artificial Life Simulators
- Basic game physics (velocity and acceleration)
- Building a tile-based map editor
- Mathematically generated fire v2 (v1 available here)
Graphics and Imaging
- Seven grayscale conversion algorithms
- “Colorizing” images
- Image dithering: eleven algorithms and source code
Histogram-Related Image Processing
- Image Histograms Part 1 (histogram generation)
- Image Histograms Part 2 (stretching and equalizing)
- How to build a “Curves” dialog
- How to build a “Levels” dialog (input / output / midtone)
- Real-time image contrast
Basic Image Processing
- Bilinear image resampling
- Filling contiguous image regions (via ExtFloodFill)
- Screen capturing via the Windows API
- Smooth color gradients (linear, real-time)
Advanced Image Processing (Including Filters and FX)
- Image edge detection
- Correcting lens distortion
- Converting color temperature (K) to RGB
- Building a custom image filter engine
- Variable alpha-transparency in real-time
- Sepia / “Antique” color conversions
- Blacklight effect
- A collection of nature-inspired image filters
- Emboss / engrave / relief filters
- Stained glass effect / polygon-based image randomization
- Diffuse (Spread) image filter
- VB Graphics Programming: An Introduction
- VB Graphics Programming: Part 1 – Pure VB (PSet and Point)
- VB Graphics Programming: Part 2 – Beginning API (GetPixel and SetPixel)
- VB Graphics Programming: Part 3 – Advanced API (GetBitmapBits/SetBitmapBits and GetDIBits/StretchDIBits)
- VB Graphics Programming: Part 4 – Advanced Optimizations
Why I use Classic VB for my code samples
In case you haven’t noticed, I am a big fan of retro programming (e.g. using outdated programming languages to write modern pieces of software). While there are many good ways to practice retro programming, my favorite tool is Visual Basic 6.0.
…Yes, VB6. You can stop laughing now.
I was first introduced to Visual Basic in the form of VB 4.0, way back in the era of choosing to compile a program as 16-bit or 32-bit. VB5 brought some much-needed improvements – including compiling to native code – and VB6 was largely a refinement of larger changes introduced in VB5. I continue to use VB6 on Windows 7, despite Microsoft dropping support mainstream support in 2005 and extended support in 2008.
When asked why I haven’t switched to a more modern language, the answer is simple – I do plenty of professional programming in other, more “sophisticated” languages (Java, C++, Perl). When I code as a hobby, I like to keep it as far removed from my paying work as possible. I suppose work on classic cars is a good analogy; there’s something nostalgic about VB6, and I like that.
As an added bonus, VB code is practically pseudocode, making it easy to port VB functions to other languages. Even if you aren’t familiar with specific VB semantics, it’s hard to confuse the purpose of code like:
luminance = (222 * red + 707 * green + 71 * blue) \ 1000
In recent years, I’ve tried to add pseudocode descriptions to my most popular projects. If you ever find a project with VB code you can’t make sense of, let me know so I can post a language-agnostic pseudocode version on its project page.