All code on this site is provided free of charge, under a permissive BSD license. If you find the code helpful, please consider a small donation to help me support my family. Even $1.00 helps. Thank you!
Full applications
Small sample applications
All source code for the following projects is hosted in a single GitHub repository. Feel free to clone the entire repository, or browse individual project pages below.
Bioinformatics
- Hidden Markov Models, the Viterbi Algorithm, and CpG Islands
- Evolution and Artificial Life Simulators
Games
- Basic game physics (velocity and acceleration)
- Building a tile-based map editor
- Mathematically generated fire
Graphics and Imaging
Color-Depth Conversions
- Seven grayscale conversion algorithms
- “Colorizing” images
- Image dithering: eleven algorithms and source code
Fractals
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
- 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
- Color-shifting
- A collection of nature-inspired image filters
- Emboss / engrave / relief filters
- Stained glass effect / polygon-based image randomization
- Diffuse (Spread) image filter
Hardware Support
Tutorials
- 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 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 with VB 4.0, back in the era of choosing to compile a program as 16-bit or 32-bit. VB5 brought much-needed improvements - including compiling to native code - and VB6 was largely a refinement of changes introduced in VB5. I continue to actively develop with VB6 on Windows 10.
When asked why I haven’t switched to a more modern language, the answer is simple - I do most of my professional work in other, more “sophisticated” languages. Java, C++, and Perl are especially prevalent in bioinformatics.
But 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.