Full introduction to DDB and DIB bitmap programming in Visual C ++
Source: Skynet
1. Basic Concepts
First, we will explain the concept of Bitmap and palette with common statements.
We know that all colors in nature can be composed of red, green, and blue (R, G, B. It can be divided into 0 ~ There are 255 levels, and different combinations of red, green, and blue are 256x256x256, so they can represent about 16 million colors. For human eyes, this is already "true color.
For each vertex (r,gand bits), the extended file name in the computer is generally .bmp. Since the quantified values of R, G, and B can be used to directly record all the pixels of a bitmap, what should we do with the color palette?
First, we can calculate the space required to use (R, G, B) combinations to store a 800 × 600 bitmap:
800 × 600 × 3 = 1440000 (bytes) = 1.37 M (bytes)
Amazing big! As a result, the palette is born, and its function is to alleviate the problem of excessive storage space of Bitmap files.
Assume that a bitmap is 16 colors, and the total number of pixels is 800 × 600. We only need to use 4 bits to store the level of each pixel of this bitmap in 16 colors, and then the color palette provides the corresponding (R, G, b) value. to store this 16-color bitmap, you only need:
800 × 600 × 4/8 = 240000 (bytes) = 0.22 M (bytes)
The overhead for storing the R, G, and B Tables (that is, the Palette, also known as the color search table LUT) is only 16 × 3 = 48 bytes.
The storage space is greatly reduced!
Common bitmap types include monochrome, 16-color, 256-color, 16-bit, and 24-bit real-color. You can store the first three colors (no greater than 256 colors) in a color palette, it is not cost-effective to store 16-bit and 24-bit true colors in a color palette. They are directly stored according to the R, G, and B components.
On this basis, we analyze the DDB bitmap (Device-dependent bitmap, Device-related bitmap) and DIB bitmap (Device-independent bitmap, Device-independent bitmap) concept and the difference between the two.
DDB depends on a specific device. It can only exist in memory (video memory or system memory). The color mode must be consistent with the specific output device and use the system color palette. Generally, only DDB bitmaps with relatively simple colors can be loaded. For color-rich bitmaps, DIB must be used for long-term storage.
DIB is independent of a specific device and can be used to permanently store images. DIB is generally stored in the disk as a *. BMP file, and sometimes saved in the *. DIB file. DIB bitmap stores color information in the color table of the bitmap file. The application creates a logical color palette for DIB. Therefore, before outputting a dib bitmap, the program should select its logical palette into the context of the relevant device and implement it into the system palette.
2. Routine description
Subsequent explanations in this article are based on such an example project. It is a dialog box-based MFC application, including two parent menus:
(1) DDB bitmap
The DDB bitmap parent menu contains two sub-menus:
A. ID: IDM_LOADDDBPIC caption: Load
Click Event: load the DDB bitmap in the resource and display it
B. ID: IDM_MARK_DDBPIC caption: Flag
Click Event: transparently Add the Skynet logo to the DIB bitmap.
(2) DIB bitmap
The DIB bitmap parent menu contains two sub-menus:
A. ID: IDM_OPENDIBPIC caption: Open
Click Event: pop-up dialog box, open the. BMP bitmap file, and display
B. ID: IDM_MARK_DIBPIC caption: Flag
Click Event: transparently Add the Skynet logo to the DIB bitmap.
The project also contains the following bitmap resources:
(1) IDB_LOADED_BITMAP: the bitmap resource to be loaded.
(2) IDB_YESKY_BITMAP: Skynet logo
The subsequent sections will focus on the explanation of the event message processing function in the four sub-menus. The following code shows the message ing of CBitMapExampleDlg in the entire dialog box:
BEGIN_MESSAGE_MAP(CBitMapExampleDlg, CDialog)
//{{AFX_MSG_MAP(CBitMapExampleDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_COMMAND(IDM_LOADDDBPIC, OnLoadddbpic)
ON_COMMAND(IDM_MARK_DDBPIC, OnMarkDdbpic)
ON_COMMAND(IDM_OPENDIBPIC, OnOpendibpic)
ON_COMMAND(IDM_MARK_DIBPIC,OnMarkDibpic) //}}AFX_MSG_MAP
END_MESSAGE_MAP()
3. DDB bitmap Programming
First look at the DDB loading button click event code:
Void CBitMapExampleDlg: OnLoadddbpic ()
{
1: CBitmap BMP draw;
2: BMP draw. LoadBitmap (IDB_LOADED_BITMAP); // load the DDB bitmap to be loaded.
3: bitmap bmp Info;
4: BMP draw. GetBitmap (& BMP info); // obtain the size of the DDB bitmap to be loaded.
5: CDC memDC; // defines a compatible DC
6: CClientDC (this );
7: memDC. CreateCompatibleDC (& dc); // create compatible DC
8: CBitmap * pbmpOld = memDC. SelectObject (& BMP draw); // Save the original DDB and select the new DDB into the DC
9: dc.BitBlt( 0, 0, bmpInfo.bmWidth, bmpInfo.bmHeight, &memDC, 0, 0, SRCCOPY );
10: memDC. SelectObject (pbmpOld); // select the original DDB
}
The above code will produce the effect shown in 1. The bitmap is placed at the starting position of the (0, 0) coordinate in the dialog box.
Figure 1 Load DDB bitmap Resources
Let's parse the above code line by line to figure 1.
Lines 1st and 2 define a CBitmap object and call its member function LoadBitmap to load the bitmap resource IDB_LOADED_BITMAP in the project. Lines 3rd and 4 define BITMAP struct instances and call the CBitmap member function GetBitmap to obtain BITMAP information. The BITMAP struct is defined in Header file in the form:
/* Bitmap Header Definition */
Typedef struct tagBITMAP
{
LONG bmType; // It must be 0
LONG bmWidth; // The bitmap width (in pixels)
LONG bmHeight; // The height of the bitmap (in pixels)
LONG bmWidthBytes; // The number of bytes required for each scan row, which should be an even number
WORD bmPlanes; // Number of color planes
WORD bmBitsPixel; // number of bits in the color plane
LPVOID bmBits; // point to the array storing the pixel array
} BITMAP, * PBITMAP, NEAR * NPBITMAP, FAR * LPBITMAP;
5th ~ Row 8 builds a CDC object, calls CDC: CreateCompatibleDC to create a compatible memory device context, and then calls CDC: SelectObject to select DDB into the memory device context.
Row 3 calls the function CDC: BitBlt to draw a bitmap. The prototype of CDC: BitBlt is:
CDC::BitBlt(int x, int y, int nWidth, int nHeight, CDC *pSrcDC, int xSrc, int ySrc, DWORD dwRop)
CDC: The BitBlt operation is to copy bitmap from the source DC to the Target DC. The first four parameters are the coordinates (x, y) and length and Width (Width, nHeight) of the target region. The fifth parameter is the source DC pointer, the following parameter is the starting coordinate of the source DC, and the last parameter is the type of the grating operation.
Row 3 calls CDC: SelectObject to select the original DDB into the context of the memory device and remove the new DDB.
Another function, CDC: StretchBlt, corresponds to CDC: BitBlt, which has the scaling function. Its prototype is:
BOOL CDC::StretchBlt(int x, int y, int nWidth, int nHeight, CDC *pSrcDC, int
xSrc, int ySrc, int nSrcWidth, int nSrcHeight, DWORD dwRop);
This function copies the bitmap from the source rectangle to the destination rectangle. If the Source and Destination rectangles have different sizes, the bitmap function scales to adapt to the size of the destination rectangle. Most of the parameters of the function are the same as those of BitBlt, but two more parameters are used to specify the width and height of the source rectangle.
If we change the row 9th in the CBitMapExampleDlg: OnLoadddbpic () function:
CRect clientRect;
GetClientRect (& clientRect); // obtain the window size of the dialog box.
Dc. StretchBlt (0, 0, clientRect. right, clientRect. bottom, & memDC, 0, 0,
BMP info. bmWidth, BMP info. bmHeight, SRCCOPY );
Click the Load button, as shown in dialog box 2. The bitmap is stretched to the entire dialog box.
Figure 2 stretch a bitmap
CDC: The dwdrop parameter in BitBlt and dc. StretchBlt functions is more useful. It defines the type of grating operation. See the message processing function code of an event in the "mark" submenu under "DDB bitmap" parent menu:
Void CBitMapExampleDlg: OnMarkDdbpic ()
{
CBitmap BMP draw;
BMP draw. LoadBitmap (IDB_YESKY_BITMAP); // load the DDB bitmap Resource
Bitmap bmp Info;
BMP draw. GetBitmap (& BMP info); // obtain the size of the Skynet logo bitmap.
CDC memDC; // defines a compatible DC
CClientDC dc (this );
MemDC. CreateCompatibleDC (& dc); // create a DC
CBitmap * pbmpOld = memDC. SelectObject (& BMP draw );
// Save the original DDB and input the polar network logo bitmap to the DC
Dc. BitBlt (0, 0, BMP info. bmWidth, BMP info. bmHeight, & memDC, 0, 0, SRCAND );
MemDC. SelectObject (pbmpOld); // select the original DDB
}
After you click this button, 3 results will be generated. The logo of Skynet is transparently added to the bitmap!
Figure 3 Add the Skynet logo to the DDB bitmap
The reason for this effect lies in the code line:
dc.BitBlt ( 0, 0, bmpInfo.bmWidth, bmpInfo.bmHeight, &memDC, 0, 0, SRCAND );
The SRCAND parameter is used (unlike SRCCOPY in the previous code, it only means to copy the source bitmap to the destination bitmap). It means to perform AND between the source AND destination. We don't know how the editors of Skynet add logos to the images in the article. Maybe they use the image AND logo batch processing software with the automatic AND function. Indeed, we can use the principles in the routine to write a batch processing software that automatically adds a logo to a bunch of images at a time.
In addition to SRCAND and SRCCOPY, dwdrop also has the following values:
BLACKNESS: the output area is black.
DSTINVERT: reverse the destination bitmap
MERGECOPY: combines Pattern with source bitmap with operations.
MERGEPAINT: uses or to combine the Reverse source bitmap with the target bitmap.
NOTSRCCOPY: reverse the source bitmap and copy it to the destination.
NOTSRCERASE: uses or to merge source and destination bitmaps, and then reverse
PATCOPY: copy the pattern to the destination bitmap.
PATINVERT: use an exclusive or operation to combine the pattern with the destination bitmap.
PATPAINT: use or to combine the source bitmap with the destination bitmap. Then, use or to combine the result with the destination bitmap.
SRCERASE: First reverse the destination bitmap, and then combine it with the source bitmap
SRCINVERT: uses an exclusive or operation to merge the Source and Destination bitmaps.
SRCPAINT: use or to combine the source bitmap and destination bitmap
WHITENESS: the output area is white.
The rational use of these values will help us to produce image processing software with specific requirements.
From the above example, we can see that when using the CBitmap class in VC, bitmap must be placed into the resources of the project and loaded using the member function LoadBitmap of the CBitmap class, then, the member function BitBlt of the CDC class performs DC copy and other operations to achieve the display purpose. CBitmap has the following limitations:
(1) bitmap needs to be placed into project resources, which will lead to a larger executable file of the project;
(2) Because bitmaps need to be put into engineering resources, and resources cannot contain bitmaps infinitely, applications cannot select other bitmaps automatically, and the bitmaps that can be used are very limited;
(3) CBitmap is only the encapsulation of the DDB bitmap operation API and cannot be independent from the platform.
DIB bitmap can solve the above problem. Its feature is to store image data independent of the platform in the. BMP bitmap file format. Next we will analyze it in detail.
4. DIB bitmap Programming
4.1 bitmap file format
First, analyze the format of the DIB bitmap file. Bitmap files are divided into four parts:
(1) BITMAPFILEHEADER
BITMAPFILEHEADER is a struct with 14 bytes. It is defined:
Typedef struct tagBITMAPFILEHEADER
{
WORD bfType; // file type, which must be 0x0000d, that is, string "BM"
DWORD bfSize; // file size, including 14 bytes of BITMAPFILEHEADER
WORD bfReserved1; // Reserved Words
WORD bfReserved2; // Reserved Words
DWORD bfOffBits; // The number of bytes from the file header to the actual bitmap data offset
} BITMAPFILEHEADER;
(2) BITMAPINFOHEADER
BITMAPINFOHEADER is also a struct with a length of 40 bytes and is defined:
Typedef struct tagBITMAPINFOHEADER
{
DWORD biSize; // the length of this structure, 40
LONG biWidth; // The image width, in pixels.
LONG biHeight; // The height of the image, in pixels.
WORD biPlanes; // It must be 1
WORD biBitCount;
// Indicates the number of digits used for color, 1 (monochrome), 4 (16 colors), 8 (256 colors), 24 (true color)
DWORD biCompression;
// Specify whether the bitmap is compressed. Valid values include BI_RGB, BI_RLE8, BI_RLE4, and BI_BITFIELDS. BI_RGB indicates that the bitmap is not compressed.
DWORD biSizeImage;
// The number of bytes occupied by the actual bitmap data, that is, biSizeImage = biwidth' × biHeight. biwidth' is the result of biWidth adjusted according to the integer of 4.
LONG biXPelsPerMeter; // horizontal resolution of the target device, in the unit of pixels per meter
LONG biYPelsPerMeter; // The vertical resolution of the target device. The unit is the number of pixels per meter.
DWORD biClrUsed; // The number of colors actually used by the bitmap. 0 indicates that the number of colors is 2 biBitCount.
DWORD biClrImportant; // number of important colors in the bitmap. 0 indicates that all colors are important.
} BITMAPINFOHEADER;
(3) Palette
The Palette is for bitmap that requires a Palette, that is, a monochrome, 16-color, and 256-color bitmap. This item is not available for bitmaps that are not stored in the palette. The color palette is an array with a total of biClrUsed elements (if this value is 0, there are 2 bibitcount elements ). Each element in the array is an RGBQUAD struct with a length of 4 bytes and is defined:
Typedef struct tagRGBQUAD
{
BYTE rgbBlue; // blue weight
BYTE rgbGreen; // green component
BYTE rgbRed; // red weight
BYTE rgbReserved; // reserved value
} RGBQUAD;
(4) Actual bitmap data ImageDate
For bitmap that uses the color palette, the actual image data ImageDate is the index value of the pixel color in the color palette. For a true color chart, the image data is the actual R, G, and B values:
A. monochrome bitmap: The color index value of a pixel can be expressed in 1 bit;
B .16 color bitmap: 4 bits can be used to represent the color index value of a pixel;
C. 256 color bitmap: one byte represents the color index value of one pixel;
D. True Color: Three bytes indicate the color R, G, and B of one pixel.
In addition, the number of bytes in each row of bitmap data must be an integral multiple of 4. If not, you need to complete it. It is strange that the data in a bitmap file is stored from bottom to top (rather than top to bottom) and from left to right.
4.2 Display of Bitmap
Visual C ++ MFC does not provide a special class for processing DIB bitmaps. Therefore, to facilitate the use of Bitmap files, we need to derive a CDib class. The source code of the class is as follows:
(1) CDib class declaration
// DIB. h: Class CDib declaration header file
# Ifndef _ DIB_H __
# Define _ DIB_H __
# Include
Class CDib
{
Public:
CDib ();
~ CDib ();
BOOL Load( const char * );
BOOL Save( const char * );
BOOL Draw( CDC *, int nX = 0, int nY = 0, int nWidth = -1, int nHeight = -1, int mode = SRCCOPY);
BOOL SetPalette( CDC * );
private:
CPalette m_Palette;
unsigned char *m_pDib, *m_pDibBits;
DWORD m_dwDibSize;
BITMAPINFOHEADER *m_pBIH;
RGBQUAD *m_pPalette;
int m_nPaletteEntries;
};
#endif
(2) Implementation of CDib class
// DIB. cpp: Class CDib implementation file
# Include "stdafx. h"
# Include "DIB. h"
CDib::CDib()
{
m_pDib = NULL;
}
CDib ::~ CDib ()
{
// Release the memory if the bitmap has been loaded
If (m_pDib! = NULL)
Delete [] m_pDib;
}
The following function is very important. Its function is to load bitmap, similar to the LoadBitmap function of the CBitmap class:
BOOL CDib::Load(const char *pszFilename)
{
CFile cf;
// Open a bitmap file
If (! Cf. Open (pszFilename, CFile: modeRead ))
Return (FALSE );
// Obtain the bitmap file size and subtract the length of BITMAPFILEHEADER.
DWORD dwDibSize;
DwDibSize = cf. GetLength ()-sizeof (BITMAPFILEHEADER );
// Allocate memory for DIB bitmap
Unsigned char * pDib;
PDib = new unsigned char [dwDibSize];
If (pDib = NULL)
Return (FALSE );
BITMAPFILEHEADER BFH;
// Read bitmap file data
Try
{
// Whether the file format is correct or not
If (cf. Read (& BFH, sizeof (BITMAPFILEHEADER ))! = Sizeof (BITMAPFILEHEADER) |
BFH. bfType! = 'Mb '| cf. Read (pDib, dwDibSize )! = DwDibSize)
{
Delete [] pDib;
Return (FALSE );
}
}
Catch (CFileException * e)
{
E-> Delete ();
Delete [] pDib;
Return (FALSE );
}
// Delete the previously loaded bitmap
If (m_pDib! = NULL)
Delete m_pDib;
// Assign the temporary Dib Data Pointer and Dib size variable to the class member variable
M_pDib = pDib;
M_dwDibSize = dwDibSize;
// Assign BITMAPINFOHEADER and palette pointer to the corresponding class member variable
M_pBIH = (BITMAPINFOHEADER *) m_pDib;
M_pPalette = (RGBQUAD *) & m_pDib [sizeof (BITMAPINFOHEADER)];
// Calculate the actual color Quantity in the color palette
M_nPaletteEntries = 1 <m_pBIH-> biBitCount;
If (m_pBIH-> biBitCount> 8)
M_nPaletteEntries = 0;
Else if (m_pBIH-> biClrUsed! = 0)
M_nPaletteEntries = m_pBIH-> biClrUsed;
// Assign an image data pointer to the corresponding class member variable
M_pDibBits = & m_pDib [sizeof (BITMAPINFOHEADER) + m_nPaletteEntries * sizeof (RGBQUAD)];
// Delete the previous palette
If (m_Palette.GetSafeHandle ()! = NULL)
M_Palette.DeleteObject ();
// If a color palette exists in the bitmap, create LOGPALETTE and CPalette.
If (m_nPaletteEntries! = 0)
{
LOGPALETTE * pLogPal = (LOGPALETTE *) new char [sizeof (LOGPALETTE) + m_nPaletteEntries * sizeof (PALETTEENTRY)];
if (pLogPal != NULL)
{
pLogPal->palVersion = 0x300;
pLogPal->palNumEntries = m_nPaletteEntries;
for (int i = 0; i < m_nPaletteEntries; i++)
{
pLogPal->palPalEntry[i].peRed = m_pPalette[i].rgbRed;
pLogPal->palPalEntry[i].peGreen = m_pPalette[i].rgbGreen;
pLogPal->palPalEntry[i].peBlue = m_pPalette[i].rgbBlue;
}
// Create CPalette and release the LOGPALETTE memory
M_Palette.CreatePalette (pLogPal );
Delete [] pLogPal;
}
}
return (TRUE);
}
// Function: Save the bitmap to the BMP file.
BOOL CDib: Save (const char * pszFilename)
{
If (m_pDib = NULL)
Return (FALSE );
CFile cf;
if (!cf.Open(pszFilename, CFile::modeCreate | CFile::modeWrite))
return (FALSE);
try
{
BITMAPFILEHEADER BFH;
memset(&BFH, 0, sizeof(BITMAPFILEHEADER));
BFH.bfType = ’MB’;
BFH.bfSize = sizeof(BITMAPFILEHEADER) + m_dwDibSize;
BFH.bfOffBits = sizeof(BITMAPFILEHEADER) +
sizeof(BITMAPINFOHEADER) + m_nPaletteEntries *sizeof(RGBQUAD);
cf.Write(&BFH, sizeof(BITMAPFILEHEADER));
cf.Write(m_pDib, m_dwDibSize);
}
catch (CFileException *e)
{
e->Delete();
return (FALSE);
}
return (TRUE);
}
The following function is also very important. It is used to draw a bitmap in the CDC to which the pDC points. The starting coordinate is (nX, nY), and the width and height are nWidth and nHeight, the last parameter is the grating mode:
BOOL CDib::Draw(CDC *pDC, int nX, int nY, int nWidth, int nHeight, int mode)
{
if (m_pDib == NULL)
return (FALSE);
// Obtain the bitmap width and height values
If (nWidth =-1)
NWidth = m_pBIH-> biWidth;
If (nHeight =-1)
NHeight = m_pBIH-> biHeight;
// Draw a bitmap
StretchDIBits (pDC-> m_hDC, nX, nY, nWidth, nHeight, 0, 0, m_pBIH-> biWidth, m_pBIH-> biHeight, m_pDibBits, (BITMAPINFO *) m_pBIH, BI_RGB, mode );
return (TRUE);
}
// Function: Set the color palette.
BOOL CDib: SetPalette (CDC * pDC)
{
If (m_pDib = NULL)
Return (FALSE );
// Check whether there is a color palette handle. For bitmap with a color greater than 256, It is NULL.
If (m_Palette.GetSafeHandle () = NULL)
Return (TRUE );
// Select the color palette, implement it, and restore the old color palette.
CPalette * pOldPalette;
POldPalette = pDC-> SelectPalette (& m_Palette, FALSE );
PDC-> RealizePalette ();
PDC-> SelectPalette (pOldPalette, FALSE );
return (TRUE);
}
From the code of the entire CDib class, we can see that the display of DIB bitmap must follow the steps below:
(1) read bitmap. In this class, pDib = new unsigned char [dwDibSize] is used to allocate memory for information in the bitmap. Another method is to call the API function CreateDIBSection, for example:
m_hBitmap = ::CreateDIBSection(pDC->GetSafeHdc(),
(LPBITMAPINFO) m_lpBMPHdr, DIB_RGB_COLORS,
(LPVOID*) &m_lpDIBits, NULL, 0);
M_hBitmap is defined:
HBITMAP m_hBitmap;
(2) Calculate the size of the color palette Based on the read bitmap information and create a color palette;
(3) Call CDib: SetPalette (CDC * pDC) to set the color palette. The following functions are required: CDC: SelectPalette and CDC: RealizePalette;
(4) Call the CDib: Draw (CDC * pDC, int nX, int nY, int nWidth, int nHeight, int mode) function to Draw a bitmap. In this function, the call to the StretchDIBits API function is actually used to display bitmap. The StretchDIBits function has the zoom function. Its last parameter is also the grating operation mode.
The following provides the function source code for opening and displaying DIB bitmap and adding the logo of Skynet to it. The "DIB bitmap" parent menu "open" sub-menu click event message processing function is (its function is to open the bitmap and display it ):
Void CBitMapExampleDlg: OnOpendibpic ()
{
// The file dialog box is displayed to allow users to select a bitmap file.
CFileDialog fileDialog (TRUE, "*. BMP", NULL, NULL, "bitmap file (*. BMP) | *. bmp; *. BMP | ");
If (IDOK = fileDialog. DoModal ())
{
// Load the bitmap and display it
CDib dib;
If (dib. Load (fileDialog. GetPathName ()))
{
CClientDC dc (this );
Dib. SetPalette (& dc );
Dib. Draw (& dc );
}
}
}
The "DIB bitmap" parent menu "tag" sub-menu click event message processing function is (its function is to add the Skynet logo to the bitmap ):
Void CBitMapExampleDlg: OnMarkDibpic ()
{
// The pop-up file dialog box allows the user to choose to mark the logo
CFileDialog fileDialog (TRUE, "*. BMP", NULL, NULL, "mark a bitmap file (*. BMP) | *. bmp; *. BMP | ");
If (IDOK = fileDialog. DoModal ())
{
// Load the marked logo bitmap and phase it with the target bitmap
CDib dib;
If (dib. Load (fileDialog. GetPathName ()))
{
CClientDC dc (this );
Dib. SetPalette (& dc );
Dib. Draw (& dc, 0, 0,-1,-1, SRCAND );
}
}
}
Figure 4 shows the effect of DIB bitmap after loading the Skynet logo, which is better than the DDB bitmap after adding the Skynet logo in figure 3. Figure 4 shows the mutual result of true color bitmaps, while the color of the image in Figure 3 is reduced.
Figure 4 Add the Skynet logo to the DIB bitmap
5. Conclusion
This article introduces the concept of Bitmap and palette, and explains the differences between DDB bitmap and DIB bitmap. On this basis, this article describes how to operate DDB bitmap and DIB bitmap. DDB Bitmap Processing is relatively simple. For DIB bitmaps, we need to define a new class CDib that does not exist in MFC, which shields bitmap information from reading and creating technical details of the palette, applications can be conveniently used.
All the programs in this article have been debugged on Visual C ++ 6.0 and Windows XP platforms.