Home   Index   About
Ultimate Pack


Custom Search
Bitmap Storage

Bitmaps should be saved in a file that uses the established Windows format and assigned a name with the three-character .BMP extension. The established Windows format consists of a BITMAPFILEHEADER structure followed by a BITMAPINFOHEADER structure. An array of RGBQUAD structures (also called a color table) follows the BITMAPINFOHEADER structure. The color table is followed by a second array of indexes into the color table (the actual bitmap data).

The Windows format is shown in the following illustration.

pics/WIN3200000051.gif

The members of the BITMAPFILEHEADER structure identify the file; specify the size of the file, in bytes; and specify the offset from the first byte in the header to the first byte of bitmap data. The members of the BITMAPINFOHEADER structure specify the bitmap's width and height, in pixels; the color format (count of color planes and color bits per pixel) of the display device on which the bitmap was created; whether the bitmap data was compressed before storage and the type of compression used; the number of bytes of bitmap data; the resolution of the display device on which the bitmap was created; and the number of colors represented in the data. The RGBQUAD structures specify the RGB intensity values for each of the colors in the device's palette. The color-index array maps indices values from the RGBQUAD array to pixels in a rectangular region on the display.

The following hexadecimal output shows the contents of the file REDBRICK.BMP.

0000 42 4d 76 02 00 00 00 00 00 00 76 00 00 00 28 00

0010 00 00 20 00 00 00 20 00 00 00 01 00 04 00 00 00

0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

0030 00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 80

0040 00 00 00 80 80 00 80 00 00 00 80 00 80 00 80 80

0050 00 00 80 80 80 00 c0 c0 c0 00 00 00 ff 00 00 ff

0060 00 00 00 ff ff 00 ff 00 00 00 ff 00 ff 00 ff ff

0070 00 00 ff ff ff 00 00 00 00 00 00 00 00 00 00 00

0080 00 00 00 00 00 00 00 00 00 00 00 00 00 00 09 00

0090 00 00 00 00 00 00 11 11 01 19 11 01 10 10 09 09

00a0 01 09 11 11 01 90 11 01 19 09 09 91 11 10 09 11

00b0 09 11 19 10 90 11 19 01 19 19 10 10 11 10 09 01

00c0 91 10 91 09 10 10 90 99 11 11 11 11 19 00 09 01

00d0 91 01 01 19 00 99 11 10 11 91 99 11 09 90 09 91

00e0 01 11 11 11 91 10 09 19 01 00 11 90 91 10 09 01

00f0 11 99 10 01 11 11 91 11 11 19 10 11 99 10 09 10

0100 01 11 11 11 19 10 11 09 09 10 19 10 10 10 09 01

0110 11 19 00 01 10 19 10 11 11 01 99 01 11 90 09 19

0120 11 91 11 91 01 11 19 10 99 00 01 19 09 10 09 19

0130 10 91 11 01 11 11 91 01 91 19 11 00 99 90 09 01

0140 01 99 19 01 91 10 19 91 91 09 11 99 11 10 09 91

0150 11 10 11 91 99 10 90 11 01 11 11 19 11 90 09 11

0160 00 19 10 11 01 11 99 99 99 99 99 99 99 99 09 99

0170 99 99 99 99 99 99 00 00 00 00 00 00 00 00 00 00

  1. 00 00 00 00 00 00 90 00 00 00 00 00 00 00 00 00

  1. 00 00 00 00 00 00 99 11 11 11 19 10 19 19 11 09

  1. a0 10 90 91 90 91 00 91 19 19 09 01 10 09 01 11 11

  1. b0 91 11 11 11 10 00 91 11 01 19 10 11 10 01 01 11

  1. c0 90 11 11 11 91 00 99 09 19 10 11 90 09 90 91 01

  1. d0 19 09 91 11 01 00 90 10 19 11 00 11 11 00 10 11

  1. e0 01 10 11 19 11 00 90 19 10 91 01 90 19 99 00 11

  1. f0 91 01 11 01 91 00 99 09 09 01 10 11 91 01 10 91

0200 99 11 10 90 91 00 91 11 00 10 11 01 10 19 19 09

0210 10 00 99 01 01 00 91 01 19 91 19 91 11 09 10 11

0220 00 91 00 10 90 00 99 01 11 10 09 10 10 19 09 01

0230 91 90 11 09 11 00 90 99 11 11 11 90 19 01 19 01

0240 91 01 01 19 09 00 91 10 11 91 99 09 09 90 11 91

0250 01 19 11 11 91 00 91 19 01 00 11 00 91 10 11 01

0260 11 11 10 01 11 00 99 99 99 99 99 99 99 99 99 99

0270 99 99 99 99 99 90

The following table shows the data bytes associated with the structures in a bitmap file.

Structure
Corresponding bytes
BITMAPFILEHEADER
0x00 pics/WIN3200090000.gif 0x0D
BITMAPINFOHEADER
0x0E pics/WIN3200090000.gif 0x31
RGBQUAD array
0x32 pics/WIN3200090000.gif 0x75
Color-index array
0x76 pics/WIN3200090000.gif 0x275


Last news from Greatis Software

Nostalgia .Net     Nostalgia .Net     .Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes.  More »

Recommended software for developers

Ultimate Pack for Delphi and C++ Builder     Ultimate Pack     Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price.  More »

Form Designer .Net     Form Designer .Net     Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro!  More »

Print Suite .Net     Print Suite .Net     Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available  More »

Gradient Controls .Net     Gradient Controls .Net     Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available  More »

iGrid     Greatis iGrid     iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors.  More »


All the contacts and projects

Dmitry Vasiliev (just.dmitry)

Related Links

Software for Visual Studio .NET developers
Software for Delphi and C++ Builder developers
Software for Visual Basic 6 developers
Delphi Tips&Tricks
MegaDetailed.NET

More Online Helps

Win32 Programmer's Reference
Win32 Multimedia Programmer's Reference
OLE Programmer's Reference
Microsoft Windows Pen API Programmer's Reference
Microsoft Windows Sockets 2 Reference
Microsoft Windows Telephony API (TAPI) Programmer's Reference
Unix Manual Pages

Free Tech Secrets ;) Copyright © 2008-2012 Free Tech Secrets ;) greatis just4fun network just4fun