Four Colour Gradient (One Colour on each Corner)

Category:
Screen/Graphics
Type:
Modules
Difficulty:
Advanced

Author: Rohito

Version Compatibility: Visual Basic 6, Visual Basic 5

More information:
This module can draw a gradient with four colours, one on each corner. It is not really hard to draw such a gradient, only it is slow. As the loops get larger, the processing takes more time. Even if you use DIB sections, you still have to perform large loops, slowing down the performance. But, by this method, it is possible to eliminate the larger loops, hence increasing the performance manifold. On my PII 233 MHz, drawing a gradient of 640 * 480 took 0.771 seconds in the IDE and 0.44 seconds on compiling.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: