BMP.txt 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147
  1. ޝ¨á ­¨¥ ä®à¬ â  BMP ¤«ï Window 3.0 (DIB)
  2. =========================================
  3. Žá­®¢­ë¬ ®â«¨ç¨¥¬ ä ©«®¢ ­®¢®£® ä®à¬ â  (DIB) - Device
  4. Independent Bitmap ( ¯¯ à â­®-­¥§ ¢¨á¨¬ë© ¡¨â®¢ë© ®¡à §) ï¥âáï
  5. â®, çâ® ¢ ­¨å ¨á¯®«ì§ã¥âáï ª®¤¨à®¢ª  梥⮢ á ®¤­®© ¡¨â®¢®© ¯«®á-
  6. ª®áâìî.
  7. ” ©«ë ¡¨â®¢ëå ®¡à §®¢ ­®¢®£® ä®à¬ â  ­ ç¨­ îâáï á® áâàãªâãàë
  8. BITMAPFILEHEADER:
  9. typedef struct tagBITMAPFILEHEADER {
  10. word bfType; //⨯ ä ©«  (¤«ï ¡¨â®¢®£® ®¡à §  - BM)
  11. dword bfSize; //à §¬¥à ä ©«  ¢ dword
  12. word bfReserved1; //­¥ ¨á¯®«ì§ã¥âáï
  13. word bfReserved2; //­¥ ¨á¯®«ì§ã¥âáï
  14. dword bfOffbits; //ᬥ饭¨¥ ¤ ­­ëå ¡¨â®¢®£® ®¡à §  ®â
  15. //§ £®«®¢ª  ¢ ¡ ©â å
  16. }
  17. �¥¯®á।á⢥­­® §  ­¥© à á¯®« £ ¥âáï áâàãªâãà  BITMAPINFO, á®-
  18. ¤¥à¦ é ï ¢áî ¨­ä®à¬ æ¨î ® ¡¨â®¢®¬ ®¡à §¥. Ž­  ¤¥«¨âáï ­  ¤¢¥ ç á-
  19. â¨: áâàãªâãàã BITMAPINFOHEADER, ®¯¨á뢠î饩 à §¬¥àë ¨ 梥⮢®©
  20. ä®à¬ â ¡¨â®¢®£® ®¡à § , ¨ ¬ áᨢ áâàãªâãà RGBQUAD, ®¯à¥¤¥«ïî饩
  21. 梥⮢ãî ¯ «¨âàã:
  22. typedef struct tagBITMAPINFO {
  23. BITMAPINFOHEADER bmiHeader;
  24. RGBQUAD bmiColors[1];
  25. }
  26. typedef struct tagBITMAPINFOHEADER {
  27. dword biSize; //ç¨á«® ¡ ©â, § ­¨¬ ¥¬ëå áâàãªâãன
  28. //BITMAPINFOHEADER
  29. dword biWidth; //è¨à¨­  ¡¨â®¢®£® ®¡à §  ¢ ¯¨ªá¥« å
  30. dword biHeight; //¢ëá®â  ¡¨â®¢®£® ®¡à §  ¢ ¯¨ªá¥« å
  31. word biPlanes; //ç¨á«® ¡¨â®¢ëå ¯«®áª®á⥩ ãáâனá⢠
  32. word biBitCount; //ç¨á«® ¡¨â®¢ ­  ¯¨ªá¥«ì
  33. dword biCompression; //⨯ ᦠâ¨ï
  34. dword biSizeImage; //à §¬¥à ª à⨭ª¨ ¢ ¡ ©â å
  35. dword biXPelsPerMeter;//£®à¨§®­â «ì­®¥ à §à¥è¥­¨¥ ãáâனá⢠,
  36. //¯¨ªá¥«/¬
  37. dword biYPelPerMeter; //¢¥à⨪ «ì­®¥ à §à¥è¥­¨¥ ãáâனá⢠,
  38. //¯¨ªá¥«/¬
  39. dword biClrUsed; //ç¨á«® ¨á¯®«ì§ã¥¬ëå æ¢¥â®¢
  40. dword biClrImportant; //ç¨á«® "¢ ¦­ëå" 梥⮢
  41. } BITMAPINFOHEADER;
  42. �®«¥¥ ¯®¤à®¡­®:
  43. biSize - ®¡ëç­® ¨á¯®«ì§ã¥âáï ¤«ï ®¡«¥£ç¥­¨ï ¤®áâ㯠 ª â ¡«¨æ¥
  44. 梥⮢.
  45. biPlanes - ®¯à¥¤¥«ï¥â ç¨á«® ¡¨â®¢ëå ¯«®áª®á⥩; ®¤­ ª®, ¯®-
  46. ᪮«ìªã 梥⠪®¤¨àã¥âáï ¯®á«¥¤®¢ â¥«ì­ë¬¨ ¡¨â ¬¨, íâ® ç¨á«® ¢á¥£-
  47. ¤  à ¢­® 1.
  48. biBitCount - í⨬ ¯®«¥¬ ®¯à¥¤¥«ï¥âáï ç¨á«® 梥⮢, ¨á¯®«ì§ã¥-
  49. ¬ëå ¡¨â®¢ë¬ ®¡à §®¬. ‚ § ¢¨á¨¬®á⨠®â ᯮᮡ  ª®¤¨à®¢ ­¨ï, ¬®¦¥â
  50. ¯à¨­¨¬ âì §­ ç¥­¨ï:
  51. 1 - ¡¨â®¢ë© ®¡à § ¬®­®å஬­ë©, ¨ â ¡«¨æ  梥⮢ ¤®«¦­  ᮤ¥à-
  52. ¦ âì ¤¢  í«¥¬¥­â . Š ¦¤ë© ¡¨â ¢ ¬ áᨢ¥ ¤ ­­ëå ª®¤¨àã¥â ®¤¨­ ¯¨ª-
  53. ᥫ. …᫨ §­ ç¥­¨¥ ¡¨â  - 0, â® ¯¨ªá¥« áâ ­®¢¨âáï ¯¥à¢ë¬ 梥⮬
  54. â ¡«¨æë; ¥á«¨ - 1, ¯¨ªá¥« áâ ­®¢¨âáï ¢â®àë¬ æ¢¥â®¬ â ¡«¨æë.
  55. 4 - ¡¨â®¢ë© ®¡à § ¨¬¥¥â ¬ ªá¨¬ã¬ 16 梥⮢, ¨ ¬ áᨢ bmiColors
  56. (â ¡«¨æ  梥⮢) ¨¬¥¥â ¤® 16 í«¥¬¥­â®¢. –¢¥â ª ¦¤®£® ¯¨ªá¥«  ®¯-
  57. ।¥«ï¥âáï ¯® â ¡«¨æ¥ 梥⮢ ¯à¨ ¯®¬®é¨ ç¥âëà¥å¡¨â­®£® ¨­¤¥ªá .
  58. � ¯à¨¬¥à, ¥á«¨ ¯¥à¢ë© ¡ ©â ¤ ­­ëå ¨¬¥¥â §­ ç¥­¨¥ 3Ah, â® ¯à¨
  59. ®â®¡à ¦¥­¨¨ ¡¨â®¢®£® ®¡à §  梥⠯¥à¢®£® ¯¨ªá¥«  ®¯à¥¤¥«ï¥â ç¥â-
  60. ¢¥àâë© í«¥¬¥­â â ¡«¨æë 梥⮢,   梥⠢â®à®£® - ®¤¨­­ ¤æ âë©.
  61. 8 - ¡¨â®¢ë© ®¡à § ¨¬¥¥â ¬ ªá¨¬ã¬ 256 梥⮢, ¨ â ¡«¨æ  梥⮢
  62. ¨¬¥¥â ¤® 256 í«¥¬¥­â®¢. Š ¦¤ë© ¡ ©â ¬ áᨢ  ¤ ­­ëå ®¯à¥¤¥«ï¥â
  63. 梥⠮¤­®£® ¯¨ªá¥« .
  64. 24 - ¡¨â®¢ë© ®¡à § ¨¬¥¥â ¬ ªá¨¬ã¬ 2 ¢ 24-© á⥯¥­¨ 梥⮢.
  65. ’ ¡«¨æ  梥⮢ ¯ãáâ ,   梥⠯¨ªá¥«®¢ ®¯à¥¤¥«ï¥âáï ¯ ª¥â ¬¨ ¨§
  66. âà¥å ¡ ©â®¢, ®¯¨á뢠î騬¨ æ¢¥â®¢ë¥ ¨­â¥­á¨¢­®á⨠ªà á­®£®, §¥«¥-
  67. ­®£® ¨ £®«ã¡®£® 梥⮢.
  68. biCompression - ⨯ ᦠâ¨ï. Œ®¦¥â ¯à¨­¨¬ âì §­ ç¥­¨ï:
  69. BI_RGB - ᦠ⨥ ®âáãâáâ¢ã¥â;
  70. BI_RLE8 - ᦠ⨥ ¤«ï ä®à¬ â  8 ¡¨â ­  ¯¨ªá¥«;
  71. BI_RLE4 - ᦠ⨥ ¤«ï ä®à¬ â  4 ¡¨â  ­  ¯¨ªá¥«.
  72. biXPelsPerMeter ¨ biYPelsPerMeter - ¬®£ã⠨ᯮ«ì§®¢ âìáï ¤«ï
  73. ¢ë¡®à  ¨§ ᯨ᪠ à¥áãàᮢ ¯¨ªâ®£à ¬¬ë, ­ ¨¡®«¥¥ ¯®¤å®¤ï饩 ¤«ï
  74. ¤ ­­®£® ãáâனá⢠.
  75. biClrUsed - ç¨á«® 梥⮢, ¨á¯®«ì§ã¥¬ëå ¤ ­­ë¨ ¡¨â®¢ë¬ ®¡à §®¬.
  76. …᫨ 0, â® ¨á¯®«ì§ãîâáï ¢á¥ æ¢¥â  ¯ «¨âàë (㪠§ ­­ë¥ ¢ ¬ áᨢ¥
  77. bmiColors).
  78. biClrImportant - ¨á¯®«ì§ã¥âáï ¤«ï ã¯à ¢«¥­¨ï  «£®à¨â¬®¬ ®â®¡-
  79. à ¦¥­¨ï 梥⮢. ’ ª, ¥á«¨ ç¥âëॠࠧ«¨ç­ëå ¯à¨«®¦¥­¨ï ®â®¡à ¦ îâ
  80. ­  íªà ­¥ ¯® ®¤­®¬ã ¡¨â®¢®¬ã ®¡à §ã á 75 梥⠬¨ ª ¦¤ë©, â®  ¤ ¯-
  81. â¥à, ¢ë¢®¤ï騩 256 梥⮢ ®¤­®¢à¥¬¥­­®, ­¥ ᬮ¦¥â ¯®«­®áâìî  ã-
  82. ⥭â¨ç­® ®â®¡à §¨âì ­  íªà ­¥ ¢á¥ 4 ª à⨭ª¨. ‚ í⮬ á«ãç ¥ ¨á-
  83. ¯®«ì§ã¥âáï ¬¥å ­¨§¬ § ¬¥­ë 梥⮢ - ¨é¥âáï ¡¨â®¢ë© ®¡à § á ­ ¨-
  84. ¬¥­ì訬 ¯à¨®à¨â¥â®¬ ¨ ¥£® "«¨è­¨¥" æ¢¥â  § ¬¥­ïîâáï ­ ¨¡®«¥¥ ¯®¤-
  85. 室ï騬¨.
  86. typedef struct tagRGBQUAD {
  87. byte rgbRed; //¨­â¥­á¨¢­®áâì ªà á­®£®
  88. byte rgbGreen; //¨­â¥­á¨¢­®áâì §¥«¥­®£®
  89. byte rgbBlue; //¨­â¥­á¨¢­®áâì £®«ã¡®£®
  90. byte rgbRserved; //­¥ ¨á¯®«ì§ã¥âáï
  91. } RGBQUAD;
  92. �®á«¥ ⮣®, ª ª ¢á¥ ¯ à ¬¥âàë ¡¨â®¢®£® ®¡à §  ®¯à¥¤¥«¥­ë, ¢
  93. ä ©«¥ ¨¤ãâ á ¬¨ ᪠­-áâப¨ ¡¨â®¢®© ¯«®áª®áâ¨, ¯à¨ç¥¬ ¯¥à¢®©
  94. ᪠­-áâப®© ¢ ä®à¬ â¥ DIB áç¨â ¥âáï ­¨¦­ïï ᪠­-áâப  (â.¥. ­ -
  95. ç «® ª®®à¤¨­ â ­ å®¤¨âáï ¢ «¥¢®¬ ­¨¦­¥¬ 㣫㠨§®¡à ¦¥­¨ï).
  96. ‘ª ­-áâப¨ ¢ë஢­¥­ë ¯® 32-¡¨â­®© £à ­¨æ¥ - dword !!!
  97. Graphics File Formats
  98. This topic describes the graphics-file formats used by the Microsoft Windows
  99. operating system. Graphics files include bitmap files, icon-resource files,
  100. and cursor-resource files.
  101. Bitmap-File Formats
  102. Windows bitmap files are stored in a device-independent bitmap (DIB) format
  103. that allows Windows to display the bitmap on any type of display device. The
  104. term "device independent" means that the bitmap specifies pixel color in a
  105. form independent of the method used by a display to represent color. The
  106. default filename extension of a Windows DIB file is .BMP.
  107. Bitmap-File Structures
  108. Each bitmap file contains a bitmap-file header, a bitmap-information header,
  109. a color table, and an array of bytes that defines the bitmap bits. The file
  110. has the following form:
  111. BITMAPFILEHEADER bmfh;
  112. BITMAPINFOHEADER bmih;
  113. RGBQUAD aColors[];
  114. BYTE aBitmapBits[];
  115. The bitmap-file header contains information about the type, size, and layout
  116. of a device-independent bitmap file. The header is defined as a
  117. BITMAPFILEHEADER structure.
  118. The bitmap-information header, defined as a BITMAPINFOHEADER structure,
  119. specifies the dimensions, compression type, and color format for the bitmap.
  120. The color table, defined as an array of RGBQUAD structures, contains as many
  121. elements as there are colors in the bitmap. The color table is not present
  122. for bitmaps with 24 color bits because each pixel is represented by 24-bit
  123. red-green-blue (RGB) values in the actual bitmap data area. The colors in the
  124. table should appear in order of importance. This helps a display driver
  125. render a bitmap on a device that cannot display as many colors as there are
  126. in the bitmap. If the DIB is in Windows version 3.0 or later format, the
  127. driver can use the biClrImportant member of the BITMAPINFOHEADER structure to
  128. determine which colors are important.
  129. The BITMAPINFO structure can be used to represent a combined
  130. bitmap-information header and color table. The bitmap bits, immediately
  131. following the color table, consist of an array of BYTE values representing
  132. consecutive rows, or "scan lines," of the bitmap. Each scan line consists of
  133. consecutive bytes representing the pixels in the scan line, in left-to-right
  134. order. The number of bytes representing a scan line depends on the color
  135. format and the width, in pixels, of the bitmap. If necessary, a scan line
  136. must be zero-padded to end on a 32-bit boundary. However, segment boundaries
  137. can appear anywhere in the bitmap. The scan lines in the bitmap are stored
  138. from bottom up. This means that the first byte in the array represents the
  139. pixels in the lower-left corner of the bitmap and the last byte represents
  140. the pixels in the upper-right corner.
  141. The biBitCount member of the BITMAPINFOHEADER structure determines the number
  142. of bits that define each pixel and the maximum number of colors in the
  143. bitmap. These members can have any of the following values:
  144. Value Meaning
  145. 1 Bitmap is monochrome and the color table contains two entries. Each
  146. bit in the bitmap array represents a pixel. If the bit is clear, the pixel is
  147. displayed with the color of the first entry in the color table. If the bit is
  148. set, the pixel has the color of the second entry in the table.
  149. 4 Bitmap has a maximum of 16 colors. Each pixel in the bitmap is
  150. represented by a 4-bit index into the color table. For example, if the first
  151. byte in the bitmap is 0x1F, the byte represents two pixels. The first pixel
  152. contains the color in the second table entry, and the second pixel contains
  153. the color in the sixteenth table entry.
  154. 8 Bitmap has a maximum of 256 colors. Each pixel in the bitmap is
  155. represented by a 1-byte index into the color table. For example, if the first
  156. byte in the bitmap is 0x1F, the first pixel has the color of the
  157. thirty-second table entry.
  158. 24 Bitmap has a maximum of 2^24 colors. The bmiColors (or bmciColors)
  159. member is NULL, and each 3-byte sequence in the bitmap array represents the
  160. relative intensities of red, green, and blue, respectively, for a pixel.
  161. The biClrUsed member of the BITMAPINFOHEADER structure specifies the number
  162. of color indexes in the color table actually used by the bitmap. If the
  163. biClrUsed member is set to zero, the bitmap uses the maximum number of colors
  164. corresponding to the value of the biBitCount member. An alternative form of
  165. bitmap file uses the BITMAPCOREINFO, BITMAPCOREHEADER, and RGBTRIPLE
  166. structures.
  167. Bitmap Compression
  168. Windows versions 3.0 and later support run-length encoded (RLE) formats for
  169. compressing bitmaps that use 4 bits per pixel and 8 bits per pixel.
  170. Compression reduces the disk and memory storage required for a bitmap.
  171. Compression of 8-Bits-per-Pixel Bitmaps
  172. When the biCompression member of the BITMAPINFOHEADER structure is set to
  173. BI_RLE8, the DIB is compressed using a run-length encoded format for a
  174. 256-color bitmap. This format uses two modes: encoded mode and absolute mode.
  175. Both modes can occur anywhere throughout a single bitmap.
  176. Encoded Mode
  177. A unit of information in encoded mode consists of two bytes. The first byte
  178. specifies the number of consecutive pixels to be drawn using the color index
  179. contained in the second byte. The first byte of the pair can be set to zero
  180. to indicate an escape that denotes the end of a line, the end of the bitmap,
  181. or a delta. The interpretation of the escape depends on the value of the
  182. second byte of the pair, which must be in the range 0x00 through 0x02.
  183. Following are the meanings of the escape values that can be used in the
  184. second byte:
  185. Second byte Meaning
  186. 0 End of line.
  187. 1 End of bitmap.
  188. 2 Delta. The two bytes following the escape contain unsigned values
  189. indicating the horizontal and vertical offsets of the next pixel from the
  190. current position.
  191. Absolute Mode
  192. Absolute mode is signaled by the first byte in the pair being set to zero and
  193. the second byte to a value between 0x03 and 0xFF. The second byte represents
  194. the number of bytes that follow, each of which contains the color index of a
  195. single pixel. Each run must be aligned on a word boundary. Following is an
  196. example of an 8-bit RLE bitmap (the two-digit hexadecimal values in the
  197. second column represent a color index for a single pixel):
  198. Compressed data Expanded data
  199. 03 04 04 04 04
  200. 05 06 06 06 06 06 06
  201. 00 03 45 56 67 00 45 56 67
  202. 02 78 78 78
  203. 00 02 05 01 Move 5 right and 1 down
  204. 02 78 78 78
  205. 00 00 End of line
  206. 09 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E
  207. 00 01 End of RLE bitmap
  208. Compression of 4-Bits-per-Pixel Bitmaps
  209. When the biCompression member of the BITMAPINFOHEADER structure is set to
  210. BI_RLE4, the DIB is compressed using a run-length encoded format for a
  211. 16-color bitmap. This format uses two modes: encoded mode and absolute mode.
  212. Encoded Mode
  213. A unit of information in encoded mode consists of two bytes. The first byte
  214. of the pair contains the number of pixels to be drawn using the color indexes
  215. in the second byte.
  216. The second byte contains two color indexes, one in its high-order nibble
  217. (that is, its low-order 4 bits) and one in its low-order nibble.
  218. The first pixel is drawn using the color specified by the high-order nibble,
  219. the second is drawn using the color in the low-order nibble, the third is
  220. drawn with the color in the high-order nibble, and so on, until all the
  221. pixels specified by the first byte have been drawn.
  222. The first byte of the pair can be set to zero to indicate an escape that
  223. denotes the end of a line, the end of the bitmap, or a delta. The
  224. interpretation of the escape depends on the value of the second byte of the
  225. pair. In encoded mode, the second byte has a value in the range 0x00 through
  226. 0x02. The meaning of these values is the same as for a DIB with 8 bits per
  227. pixel.
  228. Absolute Mode
  229. In absolute mode, the first byte contains zero, the second byte contains the
  230. number of color indexes that follow, and subsequent bytes contain color
  231. indexes in their high- and low-order nibbles, one color index for each pixel.
  232. Each run must be aligned on a word boundary.
  233. Following is an example of a 4-bit RLE bitmap (the one-digit hexadecimal
  234. values in the second column represent a color index for a single pixel):
  235. Compressed data Expanded data
  236. 03 04 0 4 0
  237. 05 06 0 6 0 6 0
  238. 00 06 45 56 67 00 4 5 5 6 6 7
  239. 04 78 7 8 7 8
  240. 00 02 05 01 Move 5 right and 1 down
  241. 04 78 7 8 7 8
  242. 00 00 End of line
  243. 09 1E 1 E 1 E 1 E 1 E 1
  244. 00 01 End of RLE bitmap
  245. Bitmap Example
  246. The following example is a text dump of a 16-color bitmap (4 bits per pixel):
  247. Win3DIBFile
  248. BitmapFileHeader
  249. Type 19778
  250. Size 3118
  251. Reserved1 0
  252. Reserved2 0
  253. OffsetBits 118
  254. BitmapInfoHeader
  255. Size 40
  256. Width 80
  257. Height 75
  258. Planes 1
  259. BitCount 4
  260. Compression 0
  261. SizeImage 3000
  262. XPelsPerMeter 0
  263. YPelsPerMeter 0
  264. ColorsUsed 16
  265. ColorsImportant 16
  266. Win3ColorTable
  267. Blue Green Red Unused
  268. [00000000] 84 252 84 0
  269. [00000001] 252 252 84 0
  270. [00000002] 84 84 252 0
  271. [00000003] 252 84 252 0
  272. [00000004] 84 252 252 0
  273. [00000005] 252 252 252 0
  274. [00000006] 0 0 0 0
  275. [00000007] 168 0 0 0
  276. [00000008] 0 168 0 0
  277. [00000009] 168 168 0 0
  278. [0000000A] 0 0 168 0
  279. [0000000B] 168 0 168 0
  280. [0000000C] 0 168 168 0
  281. [0000000D] 168 168 168 0
  282. [0000000E] 84 84 84 0
  283. [0000000F] 252 84 84 0
  284. Image
  285. .
  286. . Bitmap data
  287. .
  288. Icon-Resource File Format
  289. An icon-resource file contains image data for icons used by Windows
  290. applications. The file consists of an icon directory identifying the number
  291. and types of icon images in the file, plus one or more icon images. The
  292. default filename extension for an icon-resource file is .ICO.
  293. Icon Directory
  294. Each icon-resource file starts with an icon directory. The icon directory,
  295. defined as an ICONDIR structure, specifies the number of icons in the
  296. resource and the dimensions and color format of each icon image. The ICONDIR
  297. structure has the following form:
  298. typedef struct ICONDIR {
  299. WORD idReserved;
  300. WORD idType;
  301. WORD idCount;
  302. ICONDIRENTRY idEntries[1];
  303. } ICONHEADER;
  304. Following are the members in the ICONDIR structure:
  305. idReserved Reserved; must be zero.
  306. idType Specifies the resource type. This member is set to 1.
  307. idCount Specifies the number of entries in the directory.
  308. idEntries Specifies an array of ICONDIRENTRY structures containing
  309. information about individual icons. The idCount member specifies the number
  310. of structures in the array.
  311. The ICONDIRENTRY structure specifies the dimensions and color format for an
  312. icon. The structure has the following form:
  313. struct IconDirectoryEntry {
  314. BYTE bWidth;
  315. BYTE bHeight;
  316. BYTE bColorCount;
  317. BYTE bReserved;
  318. WORD wPlanes;
  319. WORD wBitCount;
  320. DWORD dwBytesInRes;
  321. DWORD dwImageOffset;
  322. };
  323. Following are the members in the ICONDIRENTRY structure:
  324. bWidth Specifies the width of the icon, in pixels. Acceptable values
  325. are 16, 32, and 64.
  326. bHeight Specifies the height of the icon, in pixels. Acceptable
  327. values are 16, 32, and 64.
  328. bColorCount Specifies the number of colors in the icon. Acceptable values
  329. are 2, 8, and 16.
  330. bReserved Reserved; must be zero.
  331. wPlanes Specifies the number of color planes in the icon bitmap.
  332. wBitCount Specifies the number of bits in the icon bitmap.
  333. dwBytesInRes Specifies the size of the resource, in bytes.
  334. dwImageOffset Specifies the offset, in bytes, from the beginning of the
  335. file to the icon image.
  336. Icon Image
  337. Each icon-resource file contains one icon image for each image identified in
  338. the icon directory. An icon image consists of an icon-image header, a color
  339. table, an XOR mask, and an AND mask. The icon image has the following form:
  340. BITMAPINFOHEADER icHeader;
  341. RGBQUAD icColors[];
  342. BYTE icXOR[];
  343. BYTE icAND[];
  344. The icon-image header, defined as a BITMAPINFOHEADER structure, specifies the
  345. dimensions and color format of the icon bitmap. Only the biSize through
  346. biBitCount members and the biSizeImage member are used. All other members
  347. (such as biCompression and biClrImportant) must be set to zero.
  348. The color table, defined as an array of RGBQUAD structures, specifies the
  349. colors used in the XOR mask. As with the color table in a bitmap file, the
  350. biBitCount member in the icon-image header determines the number of elements
  351. in the array. For more information about the color table, see Section 1.1,
  352. "Bitmap-File Formats."
  353. The XOR mask, immediately following the color table, is an array of BYTE
  354. values representing consecutive rows of a bitmap. The bitmap defines the
  355. basic shape and color of the icon image. As with the bitmap bits in a bitmap
  356. file, the bitmap data in an icon-resource file is organized in scan lines,
  357. with each byte representing one or more pixels, as defined by the color
  358. format. For more information about these bitmap bits, see Section 1.1,
  359. "Bitmap-File Formats."
  360. The AND mask, immediately following the XOR mask, is an array of BYTE values,
  361. representing a monochrome bitmap with the same width and height as the XOR
  362. mask. The array is organized in scan lines, with each byte representing 8
  363. pixels.
  364. When Windows draws an icon, it uses the AND and XOR masks to combine the icon
  365. image with the pixels already on the display surface. Windows first applies
  366. the AND mask by using a bitwise AND operation; this preserves or removes
  367. existing pixel color. Windows then applies the XOR mask by using a bitwise
  368. XOR operation. This sets the final color for each pixel.
  369. The following illustration shows the XOR and AND masks that create a
  370. monochrome icon (measuring 8 pixels by 8 pixels) in the form of an uppercase
  371. K:
  372. Windows Icon Selection
  373. Windows detects the resolution of the current display and matches it against
  374. the width and height specified for each version of the icon image. If Windows
  375. determines that there is an exact match between an icon image and the current
  376. device, it uses the matching image. Otherwise, it selects the closest match
  377. and stretches the image to the proper size.
  378. If an icon-resource file contains more than one image for a particular
  379. resolution, Windows uses the icon image that most closely matches the color
  380. capabilities of the current display. If no image matches the device
  381. capabilities exactly, Windows selects the image that has the greatest number
  382. of colors without exceeding the number of display colors. If all images
  383. exceed the color capabilities of the current display, Windows uses the icon
  384. image with the least number of colors.
  385. Cursor-Resource File Format
  386. A cursor-resource file contains image data for cursors used by Windows
  387. applications. The file consists of a cursor directory identifying the number
  388. and types of cursor images in the file, plus one or more cursor images. The
  389. default filename extension for a cursor-resource file is .CUR.
  390. Cursor Directory
  391. Each cursor-resource file starts with a cursor directory. The cursor
  392. directory, defined as a CURSORDIR structure, specifies the number of cursors
  393. in the file and the dimensions and color format of each cursor image. The
  394. CURSORDIR structure has the following form:
  395. typedef struct _CURSORDIR {
  396. WORD cdReserved;
  397. WORD cdType;
  398. WORD cdCount;
  399. CURSORDIRENTRY cdEntries[];
  400. } CURSORDIR;
  401. Following are the members in the CURSORDIR structure:
  402. cdReserved Reserved; must be zero.
  403. cdType Specifies the resource type. This member must be set to 2.
  404. cdCount Specifies the number of cursors in the file.
  405. cdEntries Specifies an array of CURSORDIRENTRY structures containing
  406. information about individual cursors. The cdCount member specifies the number
  407. of structures in the array.
  408. A CURSORDIRENTRY structure specifies the dimensions and color format of a
  409. cursor image. The structure has the following form:
  410. typedef struct _CURSORDIRENTRY {
  411. BYTE bWidth;
  412. BYTE bHeight;
  413. BYTE bColorCount;
  414. BYTE bReserved;
  415. WORD wXHotspot;
  416. WORD wYHotspot;
  417. DWORD lBytesInRes;
  418. DWORD dwImageOffset;
  419. } CURSORDIRENTRY;
  420. Following are the members in the CURSORDIRENTRY structure:
  421. bWidth Specifies the width of the cursor, in pixels.
  422. bHeight Specifies the height of the cursor, in pixels.
  423. bColorCount Reserved; must be zero.
  424. bReserved Reserved; must be zero.
  425. wXHotspot Specifies the x-coordinate, in pixels, of the hot spot.
  426. wYHotspot Specifies the y-coordinate, in pixels, of the hot spot.
  427. lBytesInRes Specifies the size of the resource, in bytes.
  428. dwImageOffset Specifies the offset, in bytes, from the start of the file to
  429. the cursor image.
  430. Cursor Image
  431. Each cursor-resource file contains one cursor image for each image identified
  432. in the cursor directory. A cursor image consists of a cursor-image header, a
  433. color table, an XOR mask, and an AND mask. The cursor image has the following
  434. form:
  435. BITMAPINFOHEADER crHeader;
  436. RGBQUAD crColors[];
  437. BYTE crXOR[];
  438. BYTE crAND[];
  439. The cursor hot spot is a single pixel in the cursor bitmap that Windows uses
  440. to track the cursor. The crXHotspot and crYHotspot members specify the x- and
  441. y-coordinates of the cursor hot spot. These coordinates are 16-bit integers.
  442. The cursor-image header, defined as a BITMAPINFOHEADER structure, specifies
  443. the dimensions and color format of the cursor bitmap. Only the biSize through
  444. biBitCount members and the biSizeImage member are used. The biHeight member
  445. specifies the combined height of the XOR and AND masks for the cursor. This
  446. value is twice the height of the XOR mask. The biPlanes and biBitCount
  447. members must be 1. All other members (such as biCompression and
  448. biClrImportant) must be set to zero.
  449. The color table, defined as an array of RGBQUAD structures, specifies the
  450. colors used in the XOR mask. For a cursor image, the table contains exactly
  451. two structures, since the biBitCount member in the cursor-image header is
  452. always 1.
  453. The XOR mask, immediately following the color table, is an array of BYTE
  454. values representing consecutive rows of a bitmap. The bitmap defines the
  455. basic shape and color of the cursor image. As with the bitmap bits in a
  456. bitmap file, the bitmap data in a cursor-resource file is organized in scan
  457. lines, with each byte representing one or more pixels, as defined by the
  458. color format. For more information about these bitmap bits, see Section 1.1,
  459. "Bitmap-File Formats."
  460. The AND mask, immediately following the XOR mask, is an array of BYTE values
  461. representing a monochrome bitmap with the same width and height as the XOR
  462. mask. The array is organized in scan lines, with each byte representing 8
  463. pixels.
  464. When Windows draws a cursor, it uses the AND and XOR masks to combine the
  465. cursor image with the pixels already on the display surface. Windows first
  466. applies the AND mask by using a bitwise AND operation; this preserves or
  467. removes existing pixel color. Window then applies the XOR mask by using a
  468. bitwise XOR operation. This sets the final color for each pixel.
  469. The following illustration shows the XOR and the AND masks that create a
  470. cursor (measuring 8 pixels by 8 pixels) in the form of an arrow:
  471. Following are the bit-mask values necessary to produce black, white,
  472. inverted, and transparent results:
  473. Pixel result AND maskXOR mask
  474. Black 0 0
  475. White 0 1
  476. Transparent 1 0
  477. Inverted1 1
  478. Windows Cursor Selection
  479. If a cursor-resource file contains more than one cursor image, Windows
  480. determines the best match for a particular display by examining the width and
  481. height of the cursor images.
  482. ==============================================================================
  483. BITMAPFILEHEADER (3.0)
  484. typedef struct tagBITMAPFILEHEADER { /* bmfh */
  485. UINT bfType;
  486. DWORD bfSize;
  487. UINT bfReserved1;
  488. UINT bfReserved2;
  489. DWORD bfOffBits;
  490. } BITMAPFILEHEADER;
  491. The BITMAPFILEHEADER structure contains information about the type, size, and
  492. layout of a device-independent bitmap (DIB) file.
  493. Member Description
  494. bfType Specifies the type of file. This member must be BM.
  495. bfSize Specifies the size of the file, in bytes.
  496. bfReserved1 Reserved; must be set to zero.
  497. bfReserved2 Reserved; must be set to zero.
  498. bfOffBits Specifies the byte offset from the BITMAPFILEHEADER structure
  499. to the actual bitmap data in the file.
  500. Comments
  501. A BITMAPINFO or BITMAPCOREINFO structure immediately follows the
  502. BITMAPFILEHEADER structure in the DIB file.
  503. See Also
  504. BITMAPCOREINFO, BITMAPINFO
  505. ==============================================================================
  506. BITMAPINFO (3.0)
  507. typedef struct tagBITMAPINFO { /* bmi */
  508. BITMAPINFOHEADER bmiHeader;
  509. RGBQUAD bmiColors[1];
  510. } BITMAPINFO;
  511. The BITMAPINFO structure fully defines the dimensions and color information
  512. for a Windows 3.0 or later device-independent bitmap (DIB).
  513. Member Description
  514. bmiHeader Specifies a BITMAPINFOHEADER structure that contains
  515. information about the dimensions and color format of a DIB.
  516. bmiColors Specifies an array of RGBQUAD structures that define the
  517. colors in the bitmap.
  518. Comments
  519. A Windows 3.0 or later DIB consists of two distinct parts: a BITMAPINFO
  520. structure, which describes the dimensions and colors of the bitmap, and an
  521. array of bytes defining the pixels of the bitmap. The bits in the array are
  522. packed together, but each scan line must be zero-padded to end on a LONG
  523. boundary. Segment boundaries, however, can appear anywhere in the bitmap. The
  524. origin of the bitmap is the lower-left corner.
  525. The biBitCount member of the BITMAPINFOHEADER structure determines the number
  526. of bits which define each pixel and the maximum number of colors in the
  527. bitmap. This member may be set to any of the following values:
  528. Value Meaning
  529. 1 The bitmap is monochrome, and the bmciColors member must contain two
  530. entries. Each bit in the bitmap array represents a pixel. If the bit is
  531. clear, the pixel is displayed with the color of the first entry in the
  532. bmciColors table. If the bit is set, the pixel has the color of the second
  533. entry in the table.
  534. 4 The bitmap has a maximum of 16 colors, and the bmciColors member
  535. contains 16 entries. Each pixel in the bitmap is represented by a four-bit
  536. index into the color table.
  537. For example, if the first byte in the bitmap is 0x1F, the byte represents two
  538. pixels. The first pixel contains the color in the second table entry, and the
  539. second pixel contains the color in the sixteenth table entry.
  540. 8 The bitmap has a maximum of 256 colors, and the bmciColors member
  541. contains 256 entries. In this case, each byte in the array represents a
  542. single pixel.
  543. 24 The bitmap has a maximum of 2^24 colors. The bmciColors member is
  544. NULL, and each 3-byte sequence in the bitmap array represents the relative
  545. intensities of red, green, and blue, respectively, of a pixel.
  546. The biClrUsed member of the BITMAPINFOHEADER structure specifies the number
  547. of color indexes in the color table actually used by the bitmap. If the
  548. biClrUsed member is set to zero, the bitmap uses the maximum number of colors
  549. corresponding to the value of the biBitCount member.
  550. The colors in the bmiColors table should appear in order of importance.
  551. Alternatively, for functions that use DIBs, the bmiColors member can be an
  552. array of 16-bit unsigned integers that specify an index into the currently
  553. realized logical palette instead of explicit RGB values. In this case, an
  554. application using the bitmap must call DIB functions with the wUsage
  555. parameter set to DIB_PAL_COLORS.
  556. Note: The bmiColors member should not contain palette indexes if the bitmap
  557. is to be stored in a file or transferred to another application. Unless the
  558. application uses the bitmap exclusively and under its complete control, the
  559. bitmap color table should contain explicit RGB values.
  560. See Also
  561. BITMAPINFOHEADER, RGBQUAD
  562. ==============================================================================
  563. BITMAPINFOHEADER (3.0)
  564. typedef struct tagBITMAPINFOHEADER { /* bmih */
  565. DWORD biSize;
  566. LONG biWidth;
  567. LONG biHeight;
  568. WORD biPlanes;
  569. WORD biBitCount;
  570. DWORD biCompression;
  571. DWORD biSizeImage;
  572. LONG biXPelsPerMeter;
  573. LONG biYPelsPerMeter;
  574. DWORD biClrUsed;
  575. DWORD biClrImportant;
  576. } BITMAPINFOHEADER;
  577. The BITMAPINFOHEADER structure contains information about the dimensions and
  578. color format of a Windows 3.0 or later device-independent bitmap (DIB).
  579. Member Description
  580. biSize Specifies the number of bytes required by the
  581. BITMAPINFOHEADER structure.
  582. biWidth Specifies the width of the bitmap, in pixels.
  583. biHeightSpecifies the height of the bitmap, in pixels.
  584. biPlanesSpecifies the number of planes for the target device. This
  585. member must be set to 1.
  586. biBitCount Specifies the number of bits per pixel. This value must be 1,
  587. 4, 8, or 24.
  588. biCompression Specifies the type of compression for a compressed bitmap. It
  589. can be one of the following values:
  590. Value Meaning
  591. BI_RGB Specifies that the bitmap is not compressed.
  592. BI_RLE8 Specifies a run-length encoded format for bitmaps with 8 bits
  593. per pixel. The compression format is a 2-byte format consisting of a count
  594. byte followed by a byte containing a color index. For more information, see
  595. the following Comments section.
  596. BI_RLE4 Specifies a run-length encoded format for bitmaps with 4 bits
  597. per pixel. The compression format is a 2-byte format consisting of a count
  598. byte followed by two word-length color indexes. For more information, see
  599. the following Comments section.
  600. biSizeImage Specifies the size, in bytes, of the image. It is valid to
  601. set this member to zero if the bitmap is in the BI_RGB format.
  602. biXPelsPerMeter Specifies the horizontal resolution, in pixels per meter, of
  603. the target device for the bitmap. An application can use this value to select
  604. a bitmap from a resource group that best matches the characteristics of the
  605. current device.
  606. biYPelsPerMeter Specifies the vertical resolution, in pixels per meter, of
  607. the target device for the bitmap.
  608. biClrUsed Specifies the number of color indexes in the color table
  609. actually used by the bitmap. If this value is zero, the bitmap uses the
  610. maximum number of colors corresponding to the value of the biBitCount member.
  611. For more information on the maximum sizes of the color table, see the
  612. description of the BITMAPINFO structure earlier in this topic.
  613. If the biClrUsed member is nonzero, it specifies the actual number of colors
  614. that the graphics engine or device driver will access if the biBitCount
  615. member is less than 24. If biBitCount is set to 24, biClrUsed specifies the
  616. size of the reference color table used to optimize performance of Windows
  617. color palettes. If the bitmap is a packed bitmap (that is, a bitmap in which
  618. the bitmap array immediately follows the BITMAPINFO header and which is
  619. referenced by a single pointer), the biClrUsed member must be set to zero or
  620. to the actual size of the color table.
  621. biClrImportant Specifies the number of color indexes that are considered
  622. important for displaying the bitmap. If this value is zero, all colors are
  623. important.
  624. Comments
  625. The BITMAPINFO structure combines the BITMAPINFOHEADER structure and a color
  626. table to provide a complete definition of the dimensions and colors of a
  627. Windows 3.0 or later DIB. For more information about specifying a Windows 3.0
  628. DIB, see the description of the BITMAPINFO structure.
  629. An application should use the information stored in the biSize member to
  630. locate the color table in a BITMAPINFO structure as follows:
  631. pColor = ((LPSTR) pBitmapInfo + (WORD) (pBitmapInfo->bmiHeader.biSize))
  632. Windows supports formats for compressing bitmaps that define their colors
  633. with 8 bits per pixel and with 4 bits per pixel. Compression reduces the disk
  634. and memory storage required for the bitmap. The following paragraphs describe
  635. these formats.
  636. BI_RLE8
  637. When the biCompression member is set to BI_RLE8, the bitmap is compressed
  638. using a run-length encoding format for an 8-bit bitmap. This format may be
  639. compressed in either of two modes: encoded and absolute. Both modes can occur
  640. anywhere throughout a single bitmap.
  641. Encoded mode consists of two bytes: the first byte specifies the number of
  642. consecutive pixels to be drawn using the color index contained in the second
  643. byte. In addition, the first byte of the pair can be set to zero to indicate
  644. an escape that denotes an end of line, end of bitmap, or a delta. The
  645. interpretation of the escape depends on the value of the second byte of the
  646. pair. The following list shows the meaning of the second byte:
  647. Value Meaning
  648. 0 End of line.
  649. 1 End of bitmap.
  650. 2 Delta. The two bytes following the escape contain unsigned values
  651. indicating the horizontal and vertical offset of the next pixel from the
  652. current position.
  653. Absolute mode is signaled by the first byte set to zero and the second byte
  654. set to a value between 0x03 and 0xFF. In absolute mode, the second byte
  655. represents the number of bytes that follow, each of which contains the color
  656. index of a single pixel. When the second byte is set to 2 or less, the escape
  657. has the same meaning as in encoded mode. In absolute mode, each run must be
  658. aligned on a word boundary. The following example shows the hexadecimal
  659. values of an 8-bit compressed bitmap:
  660. 03 04 05 06 00 03 45 56 67 00 02 78 00 02 05 01
  661. 02 78 00 00 09 1E 00 01
  662. This bitmap would expand as follows (two-digit values represent a color index
  663. for a single pixel):
  664. 04 04 04
  665. 06 06 06 06 06
  666. 45 56 67
  667. 78 78
  668. move current position 5 right and 1 down
  669. 78 78
  670. end of line
  671. 1E 1E 1E 1E 1E 1E 1E 1E 1E
  672. end of RLE bitmap
  673. BI_RLE4
  674. When the biCompression member is set to BI_RLE4, the bitmap is compressed
  675. using a run-length encoding (RLE) format for a 4-bit bitmap, which also uses
  676. encoded and absolute modes. In encoded mode, the first byte of the pair
  677. contains the number of pixels to be drawn using the color indexes in the
  678. second byte. The second byte contains two color indexes, one in its
  679. high-order nibble (that is, its low-order four bits) and one in its low-order
  680. nibble. The first of the pixels is drawn using the color specified by the
  681. high-order nibble, the second is drawn using the color in the low-order
  682. nibble, the third is drawn with the color in the high-order nibble, and so
  683. on, until all the pixels specified by the first byte have been drawn. In
  684. absolute mode, the first byte contains zero, the second byte contains the
  685. number of color indexes that follow, and subsequent bytes contain color
  686. indexes in their high- and low-order nibbles, one color index for each pixel.
  687. In absolute mode, each run must be aligned on a word boundary. The
  688. end-of-line, end-of-bitmap, and delta escapes also apply to BI_RLE4.
  689. The following example shows the hexadecimal values of a 4-bit compressed
  690. bitmap:
  691. 03 04 05 06 00 06 45 56 67 00 04 78 00 02 05 01
  692. 04 78 00 00 09 1E 00 01
  693. This bitmap would expand as follows (single-digit values represent a color
  694. index for a single pixel):
  695. 0 4 0
  696. 0 6 0 6 0
  697. 4 5 5 6 6 7
  698. 7 8 7 8
  699. move current position 5 right and 1 down
  700. 7 8 7 8
  701. end of line
  702. 1 E 1 E 1 E 1 E 1
  703. end of RLE bitmap
  704. See Also
  705. BITMAPINFO
  706. ==============================================================================
  707. RGBQUAD (3.0)
  708. typedef struct tagRGBQUAD { /* rgbq */
  709. BYTE rgbBlue;
  710. BYTE rgbGreen;
  711. BYTE rgbRed;
  712. BYTE rgbReserved;
  713. } RGBQUAD;
  714. The RGBQUAD structure describes a color consisting of relative intensities of
  715. red, green, and blue. The bmiColors member of the BITMAPINFO structure
  716. consists of an array of RGBQUAD structures.
  717. Member Description
  718. rgbBlue Specifies the intensity of blue in the color.
  719. rgbGreenSpecifies the intensity of green in the color.
  720. rgbRed Specifies the intensity of red in the color.
  721. rgbReserved Not used; must be set to zero.
  722. See Also
  723. BITMAPINFO
  724. ==============================================================================
  725. RGB (2.x)
  726. COLORREF RGB(cRed, cGreen, cBlue)
  727. BYTE cRed; /* red component of color */
  728. BYTE cGreen; /* green component of color */
  729. BYTE cBlue; /* blue component of color */
  730. The RGB macro selects an RGB color based on the parameters supplied and the
  731. color capabilities of the output device.
  732. Parameter Description
  733. cRed Specifies the intensity of the red color field.
  734. cGreen Specifies the intensity of the green color field.
  735. cBlue Specifies the intensity of the blue color field.
  736. Returns
  737. The return value specifies the resultant RGB color.
  738. Comments
  739. The intensity for each argument can range from 0 through 255. If all three
  740. intensities are specified as zero, the result is black. If all three
  741. intensities are specified as 255, the result is white.
  742. Comments
  743. The RGB macro is defined in WINDOWS.H as follows:
  744. #define RGB(r,g,b) ((COLORREF)(((BYTE)(r)|((WORD)(g)<<8))| \
  745. (((DWORD)(BYTE)(b))<<16)))
  746. See Also
  747. GetBValue, GetGValue, GetRValue, PALETTEINDEX, PALETTERGB
  748. ==============================================================================
  749. BITMAPCOREINFO (3.0)
  750. typedef struct tagBITMAPCOREINFO { /* bmci */
  751. BITMAPCOREHEADER bmciHeader;
  752. RGBTRIPLE bmciColors[1];
  753. } BITMAPCOREINFO;
  754. The BITMAPCOREINFO structure fully defines the dimensions and color
  755. information for a device-independent bitmap (DIB). Windows applications
  756. should use the BITMAPINFO structure instead of BITMAPCOREINFO whenever
  757. possible.
  758. Member Description
  759. bmciHeader Specifies a BITMAPCOREHEADER structure that contains
  760. information about the dimensions and color format of a DIB.
  761. bmciColors Specifies an array of RGBTRIPLE structures that define the
  762. colors in the bitmap.
  763. Comments
  764. The BITMAPCOREINFO structure describes the dimensions and colors of a bitmap.
  765. It is followed immediately in memory by an array of bytes which define the
  766. pixels of the bitmap. The bits in the array are packed together, but each
  767. scan line must be zero-padded to end on a LONG boundary. Segment boundaries,
  768. however, can appear anywhere in the bitmap. The origin of the bitmap is the
  769. lower-left corner.
  770. The bcBitCount member of the BITMAPCOREHEADER structure determines the number
  771. of bits that define each pixel and the maximum number of colors in the
  772. bitmap. This member may be set to any of the following values:
  773. Value Meaning
  774. 1 The bitmap is monochrome, and the bmciColors member must contain two
  775. entries. Each bit in the bitmap array represents a pixel. If the bit is
  776. clear, the pixel is displayed with the color of the first entry in the
  777. bmciColors table. If the bit is set, the pixel has the color of the second
  778. entry in the table.
  779. 4 The bitmap has a maximum of 16 colors, and the bmciColors member
  780. contains 16 entries. Each pixel in the bitmap is represented by a four-bit
  781. index into the color table.
  782. For example, if the first byte in the bitmap is 0x1F, the byte represents two
  783. pixels. The first pixel contains the color in the second table entry, and the
  784. second pixel contains the color in the sixteenth table entry.
  785. 8 The bitmap has a maximum of 256 colors, and the bmciColors member
  786. contains 256 entries. In this case, each byte in the array represents a
  787. single pixel.
  788. 24 The bitmap has a maximum of 2^24 colors. The bmciColors member is
  789. NULL, and each 3-byte sequence in the bitmap array represents the relative
  790. intensities of red, green, and blue, respectively, of a pixel.
  791. The colors in the bmciColors table should appear in order of importance.
  792. Alternatively, for functions that use DIBs, the bmciColors member can be an
  793. array of 16-bit unsigned integers that specify an index into the currently
  794. realized logical palette instead of explicit RGB values. In this case, an
  795. application using the bitmap must call DIB functions with the wUsage
  796. parameter set to DIB_PAL_COLORS.
  797. Note: The bmciColors member should not contain palette indexes if the
  798. bitmap is to be stored in a file or transferred to another application.
  799. Unless the application uses the bitmap exclusively and under its complete
  800. control, the bitmap color table should contain explicit RGB values.
  801. See Also
  802. BITMAPINFO, BITMAPCOREHEADER, RGBTRIPLE
  803. ==============================================================================
  804. BITMAPCOREHEADER (3.0)
  805. typedef struct tagBITMAPCOREHEADER { /* bmch */
  806. DWORD bcSize;
  807. short bcWidth;
  808. short bcHeight;
  809. WORD bcPlanes;
  810. WORD bcBitCount;
  811. } BITMAPCOREHEADER;
  812. The BITMAPCOREHEADER structure contains information about the dimensions and
  813. color format of a device-independent bitmap (DIB). Windows applications
  814. should use the BITMAPINFOHEADER structure instead of BITMAPCOREHEADER
  815. whenever possible.
  816. Member Description
  817. bcSize Specifies the number of bytes required by the
  818. BITMAPCOREHEADER structure.
  819. bcWidth Specifies the width of the bitmap, in pixels.
  820. bcHeightSpecifies the height of the bitmap, in pixels.
  821. bcPlanesSpecifies the number of planes for the target device. This
  822. member must be set to 1.
  823. bcBitCount Specifies the number of bits per pixel. This value must be 1,
  824. 4, 8, or 24.
  825. Comments
  826. The BITMAPCOREINFO structure combines the BITMAPCOREHEADER structure and a
  827. color table to provide a complete definition of the dimensions and colors of
  828. a DIB. See the description of the BITMAPCOREINFO structure for more
  829. information about specifying a DIB.
  830. An application should use the information stored in the bcSize member to
  831. locate the color table in a BITMAPCOREINFO structure with a method such as
  832. the following:
  833. lpColor = ((LPSTR) pBitmapCoreInfo + (UINT) (pBitmapCoreInfo->bcSize))
  834. See Also
  835. BITMAPCOREINFO, BITMAPINFOHEADER, BITMAPINFOHEADER
  836. =============================================================================
  837. RGBTRIPLE (3.0)
  838. typedef struct tagRGBTRIPLE { /* rgbt */
  839. BYTE rgbtBlue;
  840. BYTE rgbtGreen;
  841. BYTE rgbtRed;
  842. } RGBTRIPLE;
  843. The RGBTRIPLE structure describes a color consisting of relative intensities
  844. of red, green, and blue. The bmciColors member of the BITMAPCOREINFO
  845. structure consists of an array of RGBTRIPLE structures. Windows applications
  846. should use the BITMAPINFO structure instead of BITMAPCOREINFO whenever
  847. possible. The BITMAPINFO structure uses an RGBQUAD structure instead of the
  848. RGBTRIPLE structure.
  849. Member Description
  850. rgbtBlueSpecifies the intensity of blue in the color.
  851. rgbtGreen Specifies the intensity of green in the color.
  852. rgbtRed Specifies the intensity of red in the color.
  853. See Also
  854. BITMAPCOREINFO, BITMAPINFO, RGBQUAD
  855. ==============================================================================
  856.