The following are the primary classes used when working with bitmaps:
- BitmapManager - There is a global object defined by 3ds Max called TheManager. This is an instance of the class BitmapManager. This object manages and enables developers to work with bitmaps in 3ds Max. For example, this class provides methods for
creating and loading bitmaps. It also has methods for displaying some common dialogs that let users interactively specify
files and devices to work with, and set options for bitmaps.
- BitmapInfo -BitmapInfo is the class used to describe the properties of a bitmap. The developer can declare an instance of this class and use its
methods such as SetWidth(), SetHeight(), SetGamma(), and SetName() to describe the bitmap properties. The other classes related to bitmaps then use this information. Thus BitmapInfo is the heart of all image input/output. For example, all but a few methods in the BitmapManager use a BitmapInfo object as the main argument. For instance, if you wish to create a bitmap, you declare an instance of BitmapInfo and use its methods to establish the bitmap properties. Then when you call the BitmapManager method Create(), you pass the BitmapInfo object. The BitmapManager uses this information to determine how much memory to allocate based on the width, height and color depth.
This class also has methods to get and set the number of frames used in multi-frame bitmaps, and to define 'custom' properties
of the bitmap. Custom properties let you specify only a portion of the main bitmap, such as a smaller, sub-region of the original,
or fewer frames than the original (different begin and end settings or a different frame increment step size for multi-frame
bitmaps). These custom properties are read and used by bitmap copying operations for example.
- Bitmap - The Bitmap class represents the bitmap itself. All image access is done through this class. This class provides standard methods to
retrieve and store pixels from the image. The Bitmap class has methods to retrieve parameters of the bitmap such as its width, height, whether it is dithered, or has an alpha
channel. Additional methods allow developers to open bitmaps for output, write multi-frame images, and to copy pixel data
between bitmaps.
There are other bitmap related classes used only by developers who create 3ds Max plug-ins used to load and save new bitmap
file formats. The methods of these classes are called by the BitmapManager and Bitmap classes and not by developers themselves. The primary classes used for creating image loading and saving plug-ins are:
- BitmapIO - This is the main plug-in class used by developers creating image loader / saver plug-ins. For example, a developer creating
a plug-in to support the PCX file format would derive their plug-in class from BitmapIO. This class is used for both files and devices (devices are items such as digital disk recorders). Developers implement pure
virtual methods of this class to provide information about the image loader / saver they are creating. This is information
such as the plug-in author name, copyright data, image format description, filename extension(s) used, and other capabilities
of the image loader / saver. The developer also implements methods to load the image from disk, prepare it for output, write
image data to it, and close it. Image loader / saver plug-ins use the BitmapStorage class described below to load and save their actual pixel data.
- BitmapStorage - When an image is loaded or created, the buffer that will hold the image data is an instance of the BitmapStorage class. This class allows developers to access the image in a uniform manner even though the underlying storage might be 1,
8, 16, 32 or 48 bit. For example, a paletted 8-bit format is perfect for loading GIF files but not for loading 32-bit Targa
files. The inverse is also true. There is no point in creating a true color 64-bit storage to load a GIF file that only has
8-bit color information.
Again, note that the BitmapStorage class is a low level access mechanism used by image loader / saver (BitmapIO) plug-ins. Developers wanting to access an image use the methods in the Bitmap class instead.
The BitmapStorage mechanism was created so images could be kept in memory in a more efficient way. Instead of loading everything in 3ds Max's
internal 64-bit format, bitmaps are loaded and/or created using the most efficient storage for their type. The BitmapStorage class provides an uniform set of pixel access methods to hide these different formats from the developer using bitmaps. For
example, standard methods are available for getting and putting pixels at various color depths. In this way, even though an
image may be a 1-bit monochrome line art bitmap, pixels may be retrieved or stored at other color depths. For example the
BitmapStorage methods Get16Gray()/Put16Gray(), GetTruePixels()/PutTruePixels(), and GetIndexPixels()/PutIndexPixels()provide access to pixel data at various color depths.