This is one of my all-time favorite image effects – a simulated blacklight that looks GREAT on any image with people in it. I invented this algorithm myself, and the provided code will allow you to test the effect in real-time on any image below 2MB. (The sample image is Squall from FF8 – the greatest RPG ever made, btw…)
This is the first of its kind in VB: accurate, real-time image level adjustment. Image levels provide better control over luminance than strict brightness/contrast methods, but not quite as much control as a well-built Curves Dialog. Adjusting an image using input/output/midtone levels is useful for brightening or darkening an image without losing detail at either end of the luminance spectrum. I’ve included simple histogram drawing code (as the screenshot shows) so you can see the effect that adjusting levels has on an image’s histogram. The code is well-commented and fast – please post comments and/or requests for future VB graphics projects.
By request, here is the first of its kind in VB: a fast, accurate, real-time image curves dialog. (This should be familiar to any PhotoShop users out there :) Curves is similar in theory both “Image Levels” post and standard gamma correction, but it provides a much more powerful interface for adjusting the luminance of an image. This project provides results very similar to Photoshop’s, and it allows the creation of more spline knots (32 instead of 16). The code is well-commented and very fast – please post comments, requests for future Photoshop-related code, and many heaps of praise (as this was a complicated routine to sort out…)!
Who doesn’t love a classic tile-based game? VB6 seems to be especially popular for writing tile games, so I’ve put together a simple tile-based map editor for any aspiring game creators out there. The demo is pretty self-explanatory – click on the tile bar at the top (with either the left or right mouse button) to select a tile, then click on the large center window to draw that tile onto the map. Scrolling and zoom are fully implemented, as are saving and loading map files. I’ve also written the engine using both StretchBlt and PaintPicture, and you can use the combo box on the left to specify a painting method.
This program demonstrates how to create a smooth color gradient between any two colors on any size of form. While gradients are often used for visual effects, perhaps the most useful aspect of this project is the gradient algorithm itself. Many other algorithms (like image resampling) use variations of the gradient algorithm – so learn [...]
Resampling uses specialized interpolation algorithms when resizing an image to minimize any negative impacts to image quality. For example, when you resize a 50×50 image to 500×500, the image looks horrible – like a bunch of giant squares. Resampling reduces that “blockiness” by interpolating pixels, so the image looks rounded even after being resized. If [...]
Here’s the first (and still the best!) VB-based example that demonstrates how to correctly adjust an image’s contrast. I use DIB sections to maximize speed; it’s also worth mentioning that to perfectly determine contrast, you would have to first find the average brightness of the image – I use the shortcut method and assume that [...]
There are many bad ways to capture the screen in VB6 (i.e. to copy the image on your monitor to a form or picture box), so I wrote this code to demonstrate one of several right ways. Each of the 4 required API calls is explained in detail.
This last section of my graphics programming tutorials takes a different approach from the previous three sections. Instead of discussing specific graphics routines, I’m going to give you my “Top 10 List of Graphics Code Optimizations.” This checklist of optimization techniques will provide a simple, straightforward mechanism for speeding up your graphics application. We’ll start [...]
Advanced API Pixel Routines Next comes two advanced ways of getting and setting pixels in Visual Basic: the API routines of GetBitmapBits/SetBitmapBits and GetDIBits/StretchDIBits. If you haven’t already, I strongly recommend reading the previous two tutorials, “Pure VB Pixel Routines” and “Basic API Pixel Routines,” as they provide the foundation for the advanced graphics principles [...]