|
EDais :: Tutorials :: Using DIBs in VB Part 1 Written by Mike D Sutton - 15.01.2005 - What is a DIB?: DIB stands for “Device Independent Bitmap” and as its name suggests allows for storage and manipulation of image data independent from the limitations of the device it’s used with. A DIB on its own is more of a concept than something we use directly in GDI development, representing the storage of bitmap data and a header that describes the data format. There are a number of derived Bitmap types which stem from this; namely the Packed DIB, the .BMP (and/or .DIB) file format and DIBSection objects. A Packed DIB is a chunk of memory that stores the Bitmap information and can be passed around as a single memory object, which makes it perfect for use with low level graphical-based libraries and the clipboard. The .BMP file format is nothing more than a Packed DIB with an additional file header structure prefixing the data, which makes conversion between disk and memory DIBs an easy task. The DIBSection effectively encapsulates a DIB behind the scenes and exposes it as a GDI Bitmap handle, which allows us to use it in conjunction with the GDI infrastructure similar to its cousin the DDB. The majority of this article will focus on the latter for the three DIB types which is generally the most used, however the other two will also be covered. This article assumes a reasonable prior knowledge of GDI development in VB, the DC and DDB articles on the EDais site are a good primer for the code covered in this article which I’d strongly recommend reading through first. Note; Unlike other articles on the site, this is considered only a first half or an introductory article on the subject, a second article is in production as time permits which will further explore these concepts and go through the construction of classes to encapsulate the functionality. Chapter index:
You can download this tutorial to disk for easier viewing offline as an Adobe Acrobat PDF: |