Parametric Bitmap

Environment: Windows NT4 SP5, Visual C++ 6 SP3


Let's think about grayscale palette like about gradient from black color to white. "Equal" colored palette can be represented as two gradients stacked side by side: gradient from black to "desired" color and gradient from "desired" color to white. Desired color usually placed in the middle (in grayscale palette this color is 50% gray), but it can be moved along gradient to varying brightness. If you replace grayscale palette by "equal" colored palette then you get an interesting effect (see image below). It might be useful.

ParametricBitmap1.jpg (20 Kb)

About parametric bitmap

Now I must explain what I mean then telling parametric bitmap. Parametric bitmap is a bitmap created from other bitmaps in which grayscale palette replaced by equal colored. You may want to use only some areas of produced image. Image may be composed from several layers by using various blending techniques (see "EBGfx library to get fast access to image data" by El Barto) and especially alpha-blending (every pixel besides red, green and blue components have additional component alpha (so-called alpha channel) which using in blending operations). Masks can be used too. Any layer can be also parametric. So, why I called it "parametric"? Parameters in this bitmap are start, middle and end colors in gradient; it may be changed.

Where can I use it?

It may be useful when you gonna use a lot of images of gradients and/or 3D objects pictured on this images in application design. You can realize parametric bitmaps in your programs "skins", bitmapped dialogs and everywhere where has usually used ordinary bitmaps, thereby you significantly improve exterior of your applications. Three colors in gradient(s) may be inputted by users in "Settings" dialog or they may depend on system color settings, so your application can make self-tuning for more integration in Windows by color (by retrieving current color of the target display element and handling WM_SYSCOLORCHANGE message later).

Some notes

When to create parametric bitmaps? You may create bitmaps then your program is loading but it probably increase total time of loading. It is faster to read created and saved earlier bitmaps from disk (or applications resources) instead of create it every time. Creation (or recreation) of the bitmaps on loading required when it running first time or if saved earlier bitmaps was deleted or damaged or when the system colors on which depend bitmaps changed since last run (in case of system color depending). Save created bitmaps (to save into resource use UpdateResource()) in the next cases: application is unloading after first run, user have changed colors and pressed "Apply" button in "Settings" dialog, system palette changed (in case of system color depending).


Instead the conclusion you may download and explore sample application. In this sample you can load background image which is a "parametric bitmap". By clicking in gradient area you can select its color in start, middle or end. By dragging slider you change brightness. Foreground image can be loaded too.

ParametricBitmap2.gif (6 Kb)


Download sample project - 18 Kb
Download sample images - 180 Kb

Top White Papers and Webcasts

  • According to a 2014 Javelin Strategy & Research Study, there is a new victim of fraud every two seconds – and that's just in the U.S. With identity theft and consumer fraud rising, and more frequent and sizable data breaches in the news, financial institutions need to work harder than ever to protect their customers and their business. Download this white paper to learn how you can use multi-channel communications to minimize the costs of fraud while also increasing customer loyalty.

  • On-demand Event Event Date: March 19, 2015 The 2015 Enterprise Mobile Application Survey asked 250 mobility professionals what their biggest mobile challenges are, how many employees they are equipping with mobile apps, and their methods for driving value with mobility. Join Dan Woods, Editor and CTO of CITO Research, and Alan Murray, SVP of Products at Apperian, as they break down the results of this survey and discuss how enterprises are using mobile application management and private app stores to …

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date