⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bitmap format (_bmp).htm

📁 通过bmp图片格式进行数据加密
💻 HTM
📖 第 1 页 / 共 3 页
字号:
 in the array. For more information about the color table, see Section 1.1,
 "Bitmap-File Formats."

 The XOR mask, immediately following the color table, is an array of BYTE
 values representing consecutive rows of a bitmap. The bitmap defines the
 basic shape and color of the icon image. As with the bitmap bits in a bitmap
 file, the bitmap data in an icon-resource file is organized in scan lines,
 with each byte representing one or more pixels, as defined by the color
 format. For more information about these bitmap bits, see Section 1.1,
 "Bitmap-File Formats."

 The AND mask, immediately following the XOR mask, is an array of BYTE values,
 representing a monochrome bitmap with the same width and height as the XOR
 mask. The array is organized in scan lines, with each byte representing 8
 pixels.

 When Windows draws an icon, it uses the AND and XOR masks to combine the icon
 image with the pixels already on the display surface. Windows first applies
 the AND mask by using a bitwise AND operation; this preserves or removes
 existing pixel color.  Windows then applies the XOR mask by using a bitwise
 XOR operation. This sets the final color for each pixel.

 The following illustration shows the XOR and AND masks that create a
 monochrome icon (measuring 8 pixels by 8 pixels) in the form of an uppercase
 K:

 Windows Icon Selection

 Windows detects the resolution of the current display and matches it against
 the width and height specified for each version of the icon image. If Windows
 determines that there is an exact match between an icon image and the current
 device, it uses the matching image. Otherwise, it selects the closest match
 and stretches the image to the proper size.

 If an icon-resource file contains more than one image for a particular
 resolution, Windows uses the icon image that most closely matches the color
 capabilities of the current display. If no image matches the device
 capabilities exactly, Windows selects the image that has the greatest number
 of colors without exceeding the number of display colors. If all images
 exceed the color capabilities of the current display, Windows uses the icon
 image with the least number of colors.

 Cursor-Resource File Format

 A cursor-resource file contains image data for cursors used by Windows
 applications. The file consists of a cursor directory identifying the number
 and types of cursor images in the file, plus one or more cursor images. The
 default filename extension for a cursor-resource file is .CUR.

 Cursor Directory

 Each cursor-resource file starts with a cursor directory. The cursor
 directory, defined as a CURSORDIR structure, specifies the number of cursors
 in the file and the dimensions and color format of each cursor image. The
 CURSORDIR structure has the following form:

 typedef struct _CURSORDIR {
     WORD           cdReserved;
     WORD           cdType;
     WORD           cdCount;
     CURSORDIRENTRY cdEntries[];
 } CURSORDIR;

 Following are the members in the CURSORDIR structure:

 cdReserved      Reserved; must be zero.
 cdType          Specifies the resource type. This member must be set to 2.
 cdCount         Specifies the number of cursors in the file.
 cdEntries       Specifies an array of CURSORDIRENTRY structures containing
 information about individual cursors. The cdCount member specifies the number
 of structures in the array.

 A CURSORDIRENTRY structure specifies the dimensions and color format of a
 cursor image. The structure has the following form:

 typedef struct _CURSORDIRENTRY {
     BYTE  bWidth;
     BYTE  bHeight;
     BYTE  bColorCount;
     BYTE  bReserved;
     WORD  wXHotspot;
     WORD  wYHotspot;
     DWORD lBytesInRes;
     DWORD dwImageOffset;
 } CURSORDIRENTRY;

 Following are the members in the CURSORDIRENTRY structure:

 bWidth          Specifies the width of the cursor, in pixels.
 bHeight         Specifies the height of the cursor, in pixels.
 bColorCount     Reserved; must be zero.
 bReserved       Reserved; must be zero.
 wXHotspot       Specifies the x-coordinate, in pixels, of the hot spot.
 wYHotspot       Specifies the y-coordinate, in pixels, of the hot spot.
 lBytesInRes     Specifies the size of the resource, in bytes.
 dwImageOffset   Specifies the offset, in bytes, from the start of the file to
 the cursor image.

 Cursor Image

 Each cursor-resource file contains one cursor image for each image identified
 in the cursor directory. A cursor image consists of a cursor-image header, a
 color table, an XOR mask, and an AND mask. The cursor image has the following
 form:

 BITMAPINFOHEADER    crHeader;
 RGBQUAD             crColors[];
 BYTE                crXOR[];
 BYTE                crAND[];

 The cursor hot spot is a single pixel in the cursor bitmap that Windows uses
 to track the cursor. The crXHotspot and crYHotspot members specify the x- and
 y-coordinates of the cursor hot spot. These coordinates are 16-bit integers.

 The cursor-image header, defined as a BITMAPINFOHEADER structure, specifies
 the dimensions and color format of the cursor bitmap. Only the biSize through
 biBitCount members and the biSizeImage member are used. The biHeight member
 specifies the combined height of the XOR and AND masks for the cursor. This
 value is twice the height of the XOR mask. The biPlanes and biBitCount
 members must be 1. All other members (such as biCompression and
 biClrImportant) must be set to zero.

 The color table, defined as an array of RGBQUAD structures, specifies the
 colors used in the XOR mask. For a cursor image, the table contains exactly
 two structures, since the biBitCount member in the cursor-image header is
 always 1.

 The XOR mask, immediately following the color table, is an array of BYTE
 values representing consecutive rows of a bitmap. The bitmap defines the
 basic shape and color of the cursor image. As with the bitmap bits in a
 bitmap file, the bitmap data in a cursor-resource file is organized in scan
 lines, with each byte representing one or more pixels, as defined by the
 color format. For more information about these bitmap bits, see Section 1.1,
 "Bitmap-File Formats."

 The AND mask, immediately following the XOR mask, is an array of BYTE values
 representing a monochrome bitmap with the same width and height as the XOR
 mask. The array is organized in scan lines, with each byte representing 8
 pixels.

 When Windows draws a cursor, it uses the AND and XOR masks to combine the
 cursor image with the pixels already on the display surface. Windows first
 applies the AND mask by using a bitwise AND operation; this preserves or
 removes existing pixel color.  Window then applies the XOR mask by using a
 bitwise XOR operation. This sets the final color for each pixel.

 The following illustration shows the XOR and the AND masks that create a
 cursor (measuring 8 pixels by 8 pixels) in the form of an arrow:

 Following are the bit-mask values necessary to produce black, white,
 inverted, and transparent results:

 Pixel result    AND maskXOR mask

 Black           0               0
 White           0               1
 Transparent     1               0
 Inverted1               1

 Windows Cursor Selection

 If a cursor-resource file contains more than one cursor image, Windows
 determines the best match for a particular display by examining the width and
 height of the cursor images.

 ==============================================================================

 BITMAPFILEHEADER (3.0)

 typedef struct tagBITMAPFILEHEADER {    /* bmfh */
     UINT    bfType;
     DWORD   bfSize;
     UINT    bfReserved1;
     UINT    bfReserved2;
     DWORD   bfOffBits;
 } BITMAPFILEHEADER;

 The BITMAPFILEHEADER structure contains information about the type, size, and
 layout of a device-independent bitmap (DIB) file.

 Member          Description

 bfType          Specifies the type of file. This member must be BM.
 bfSize          Specifies the size of the file, in bytes.
 bfReserved1     Reserved; must be set to zero.
 bfReserved2     Reserved; must be set to zero.
 bfOffBits       Specifies the byte offset from the BITMAPFILEHEADER structure
 to the actual bitmap data in the file.

 Comments

 A BITMAPINFO or BITMAPCOREINFO structure immediately follows the
 BITMAPFILEHEADER structure in the DIB file.

 See Also

 BITMAPCOREINFO, BITMAPINFO

 ==============================================================================
 BITMAPINFO (3.0)

 typedef struct tagBITMAPINFO {  /* bmi */
     BITMAPINFOHEADER    bmiHeader;
     RGBQUAD             bmiColors[1];
 } BITMAPINFO;

 The BITMAPINFO structure fully defines the dimensions and color information
 for a Windows 3.0 or later device-independent bitmap (DIB).

 Member          Description

 bmiHeader       Specifies a BITMAPINFOHEADER structure that contains
 information about the dimensions and color format of a DIB.

 bmiColors       Specifies an array of RGBQUAD structures that define the
 colors in the bitmap.

 Comments

 A Windows 3.0 or later DIB consists of two distinct parts: a BITMAPINFO
 structure, which describes the dimensions and colors of the bitmap, and an
 array of bytes defining the pixels of the bitmap. The bits in the array are
 packed together, but each scan line must be zero-padded to end on a LONG
 boundary. Segment boundaries, however, can appear anywhere in the bitmap. The
 origin of the bitmap is the lower-left corner.

 The biBitCount member of the BITMAPINFOHEADER structure determines the number
 of bits which define each pixel and the maximum number of colors in the
 bitmap. This member may be set to any of the following values:

 Value   Meaning

 1       The bitmap is monochrome, and the bmciColors member must contain two
 entries. Each bit in the bitmap array represents a pixel. If the bit is
 clear, the pixel is displayed with the color of the first entry in the
 bmciColors table. If the bit is set, the pixel has the color of the second
 entry in the table.

 4       The bitmap has a maximum of 16 colors, and the bmciColors member
 contains 16 entries. Each pixel in the bitmap is represented by a four-bit
 index into the color table.

 For example, if the first byte in the bitmap is 0x1F, the byte represents two
 pixels. The first pixel contains the color in the second table entry, and the
 second pixel contains the color in the sixteenth table entry.

 8       The bitmap has a maximum of 256 colors, and the bmciColors member
 contains 256 entries. In this case, each byte in the array represents a
 single pixel.

 24      The bitmap has a maximum of 2^24 colors. The bmciColors member is
 NULL, and each 3-byte sequence in the bitmap array represents the relative
 intensities of red, green, and blue, respectively, of a pixel.

 The biClrUsed member of the BITMAPINFOHEADER structure specifies the number
 of color indexes in the color table actually used by the bitmap. If the
 biClrUsed member is set to zero, the bitmap uses the maximum number of colors
 corresponding to the value of the biBitCount member.

 The colors in the bmiColors table should appear in order of importance.
 Alternatively, for functions that use DIBs, the bmiColors member can be an
 array of 16-bit unsigned integers that specify an index into the currently
 realized logical palette instead of explicit RGB values. In this case, an
 application using the bitmap must call DIB functions with the wUsage
 parameter set to DIB_PAL_COLORS.

 Note:   The bmiColors member should not contain palette indexes if the bitmap
 is to be stored in a file or transferred to another application. Unless the
 application uses the bitmap exclusively and under its complete control, the
 bitmap color table should contain explicit RGB values.

 See Also

 BITMAPINFOHEADER, RGBQUAD

 ==============================================================================
 BITMAPINFOHEADER (3.0)

 typedef struct tagBITMAPINFOHEADER {    /* bmih */
     DWORD   biSize;
     LONG    biWidth;
     LONG    biHeight;
     WORD    biPlanes;
     WORD    biBitCount;
     DWORD   biCompression;
     DWORD   biSizeImage;
     LONG    biXPelsPerMeter;
     LONG    biYPelsPerMeter;
     DWORD   biClrUsed;
     DWORD   biClrImportant;
 } BITMAPINFOHEADER;

 The BITMAPINFOHEADER structure contains information about the dimensions and
 color format of a Windows 3.0 or later device-independent bitmap (DIB).

 Member          Description

 biSize          Specifies the number of bytes required by the
 BITMAPINFOHEADER structure.

 biWidth         Specifies the width of the bitmap, in pixels.
 biHeightSpecifies the height of the bitmap, in pixels.

 biPlanesSpecifies the number of planes for the target device. This
 member must be set to 1.

 biBitCount      Specifies the number of bits per pixel. This value must be 1,
 4, 8, or 24.

 biCompression   Specifies the type of compression for a compressed bitmap. It
 can be one of the following values:

 Value           Meaning

 BI_RGB          Specifies that the bitmap is not compressed.

 BI_RLE8         Specifies a run-length encoded format for bitmaps with 8 bits
 per pixel. The compression format is a 2-byte format consisting of a count
 byte followed by a byte containing a color index.  For more information, see
 the following Comments section.

 BI_RLE4         Specifies a run-length encoded format for bitmaps with 4 bits
 per pixel. The compression format is a 2-byte format consisting of a count
 byte followed by two word-length color indexes.  For more information, see
 the following Comments section.

 biSizeImage     Specifies the size, in bytes, of the image. It is valid to
 set this member to zero if the bitmap is in the BI_RGB format.

 biXPelsPerMeter Specifies the horizontal resolution, in pixels per meter, of
 the target device for the bitmap. An application can use this value to select
 a bitmap from a resource group that best matches the characteristics of the
 current device.

 biYPelsPerMeter Specifies the vertical resolution, in pixels per meter, of
 the target device for the bitmap.

 biClrUsed       Specifies the number of color indexes in the color table
 actually used by the bitmap. If this value is zero, the bitmap uses the

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -