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

📄 bmp.htm

📁 刚刚看到本站有Visual C++数字图象处理(人民邮电出版社)的电子书
💻 HTM
📖 第 1 页 / 共 4 页
字号:
    structure has the following form:<br>

    <br>

    <br>

    <br>

    typedef struct icondir {<br>

    word idreserved;<br>

    word idtype;<br>

    word idcount;<br>

    icondirentry identries[1];<br>

    } iconheader;<br>

    <br>

    following are the members in the icondir structure:<br>

    <br>

    idreserved reserved; must be zero. <br>

    idtype specifies the resource type. this member is set to 1. <br>

    idcount specifies the number of entries in the directory. <br>

    identries specifies an array of icondirentry structures containing<br>

    information about individual icons. the idcount member specifies the number<br>

    of structures in the array.<br>

    <br>

    the icondirentry structure specifies the dimensions and color format for an<br>

    icon. the structure has the following form:<br>

    <br>

    <br>

    <br>

    struct icondirectoryentry {<br>

    byte bwidth;<br>

    byte bheight;<br>

    byte bcolorcount;<br>

    byte breserved;<br>

    word wplanes;<br>

    word wbitcount;<br>

    dword dwbytesinres;<br>

    dword dwimageoffset;<br>

    };<br>

    <br>

    following are the members in the icondirentry structure: <br>

    <br>

    bwidth specifies the width of the icon, in pixels. acceptable values<br>

    are 16, 32, and 64.<br>

    <br>

    bheight specifies the height of the icon, in pixels. acceptable<br>

    values are 16, 32, and 64.<br>

    <br>

    bcolorcount specifies the number of colors in the icon. acceptable values<br>

    are 2, 8, and 16.<br>

    <br>

    breserved reserved; must be zero. <br>

    wplanes specifies the number of color planes in the icon bitmap. <br>

    wbitcount specifies the number of bits in the icon bitmap. <br>

    dwbytesinres specifies the size of the resource, in bytes. <br>

    dwimageoffset specifies the offset, in bytes, from the beginning of the<br>

    file to the icon image.<br>

    <br>

    icon image<br>

    <br>

    each icon-resource file contains one icon image for each image identified in<br>

    the icon directory. an icon image consists of an icon-image header, a color<br>

    table, an xor mask, and an and mask. the icon image has the following form:<br>

    <br>

    <br>

    <br>

    bitmapinfoheader icheader;<br>

    rgbquad iccolors[];<br>

    byte icxor[];<br>

    byte icand[];<br>

    <br>

    the icon-image header, defined as a bitmapinfoheader structure, specifies the<br>

    dimensions and color format of the icon bitmap. only the bisize through<br>

    bibitcount members and the bisizeimage member are used. all other members<br>

    (such as bicompression and biclrimportant) must be set to zero.<br>

    <br>

    the color table, defined as an array of rgbquad structures, specifies the<br>

    colors used in the xor mask. as with the color table in a bitmap file, the<br>

    bibitcount member in the icon-image header determines the number of elements<br>

    in the array. for more information about the color table, see section 1.1,<br>

    &quot;bitmap-file formats.&quot;<br>

    <br>

    the xor mask, immediately following the color table, is an array of byte<br>

    values representing consecutive rows of a bitmap. the bitmap defines the<br>

    basic shape and color of the icon image. as with the bitmap bits in a bitmap<br>

    file, the bitmap data in an icon-resource file is organized in scan lines,<br>

    with each byte representing one or more pixels, as defined by the color<br>

    format. for more information about these bitmap bits, see section 1.1,<br>

    &quot;bitmap-file formats.&quot;<br>

    <br>

    the and mask, immediately following the xor mask, is an array of byte values,<br>

    representing a monochrome bitmap with the same width and height as the xor<br>

    mask. the array is organized in scan lines, with each byte representing 8<br>

    pixels.<br>

    <br>

    when windows draws an icon, it uses the and and xor masks to combine the icon<br>

    image with the pixels already on the display surface. windows first applies<br>

    the and mask by using a bitwise and operation; this preserves or removes<br>

    existing pixel color. windows then applies the xor mask by using a bitwise<br>

    xor operation. this sets the final color for each pixel.<br>

    <br>

    the following illustration shows the xor and and masks that create a<br>

    monochrome icon (measuring 8 pixels by 8 pixels) in the form of an uppercase<br>

    k:<br>

    <br>

    windows icon selection<br>

    <br>

    windows detects the resolution of the current display and matches it against<br>

    the width and height specified for each version of the icon image. if windows<br>

    determines that there is an exact match between an icon image and the current<br>

    device, it uses the matching image. otherwise, it selects the closest match<br>

    and stretches the image to the proper size.<br>

    <br>

    if an icon-resource file contains more than one image for a particular<br>

    resolution, windows uses the icon image that most closely matches the color<br>

    capabilities of the current display. if no image matches the device<br>

    capabilities exactly, windows selects the image that has the greatest number<br>

    of colors without exceeding the number of display colors. if all images<br>

    exceed the color capabilities of the current display, windows uses the icon<br>

    image with the least number of colors.<br>

    <br>

    <br>

    <br>

    cursor-resource file format<br>

    <br>

    a cursor-resource file contains image data for cursors used by windows<br>

    applications. the file consists of a cursor directory identifying the number<br>

    and types of cursor images in the file, plus one or more cursor images. the<br>

    default filename extension for a cursor-resource file is .cur.<br>

    <br>

    cursor directory<br>

    <br>

    each cursor-resource file starts with a cursor directory. the cursor<br>

    directory, defined as a cursordir structure, specifies the number of cursors<br>

    in the file and the dimensions and color format of each cursor image. the<br>

    cursordir structure has the following form:<br>

    <br>

    <br>

    typedef struct _cursordir {<br>

    word cdreserved;<br>

    word cdtype;<br>

    word cdcount;<br>

    cursordirentry cdentries[];<br>

    } cursordir;<br>

    <br>

    following are the members in the cursordir structure: <br>

    <br>

    cdreserved reserved; must be zero. <br>

    cdtype specifies the resource type. this member must be set to 2. <br>

    cdcount specifies the number of cursors in the file. <br>

    cdentries specifies an array of cursordirentry structures containing<br>

    information about individual cursors. the cdcount member specifies the number<br>

    of structures in the array.<br>

    <br>

    a cursordirentry structure specifies the dimensions and color format of a<br>

    cursor image. the structure has the following form:<br>

    <br>

    <br>

    <br>

    typedef struct _cursordirentry {<br>

    byte bwidth;<br>

    byte bheight;<br>

    byte bcolorcount;<br>

    byte breserved;<br>

    word wxhotspot;<br>

    word wyhotspot;<br>

    dword lbytesinres;<br>

    dword dwimageoffset;<br>

    } cursordirentry;<br>

    <br>

    following are the members in the cursordirentry structure: <br>

    <br>

    bwidth specifies the width of the cursor, in pixels. <br>

    bheight specifies the height of the cursor, in pixels. <br>

    bcolorcount reserved; must be zero. <br>

    breserved reserved; must be zero.<br>

    wxhotspot specifies the x-coordinate, in pixels, of the hot spot. <br>

    wyhotspot specifies the y-coordinate, in pixels, of the hot spot. <br>

    lbytesinres specifies the size of the resource, in bytes. <br>

    dwimageoffset specifies the offset, in bytes, from the start of the file to<br>

    the cursor image.<br>

    <br>

    cursor image<br>

    <br>

    each cursor-resource file contains one cursor image for each image identified<br>

    in the cursor directory. a cursor image consists of a cursor-image header, a<br>

    color table, an xor mask, and an and mask. the cursor image has the following<br>

    form:<br>

    <br>

    <br>

    <br>

    bitmapinfoheader crheader;<br>

    rgbquad crcolors[];<br>

    byte crxor[];<br>

    byte crand[];<br>

    <br>

    the cursor hot spot is a single pixel in the cursor bitmap that windows uses<br>

    to track the cursor. the crxhotspot and cryhotspot members specify the x- and<br>

    y-coordinates of the cursor hot spot. these coordinates are 16-bit integers.<br>

    <br>

    the cursor-image header, defined as a bitmapinfoheader structure, specifies<br>

    the dimensions and color format of the cursor bitmap. only the bisize through<br>

    bibitcount members and the bisizeimage member are used. the biheight member<br>

    specifies the combined height of the xor and and masks for the cursor. this<br>

    value is twice the height of the xor mask. the biplanes and bibitcount<br>

    members must be 1. all other members (such as bicompression and<br>

    biclrimportant) must be set to zero.<br>

    <br>

    the color table, defined as an array of rgbquad structures, specifies the<br>

    colors used in the xor mask. for a cursor image, the table contains exactly<br>

    two structures, since the bibitcount member in the cursor-image header is<br>

    always 1.<br>

    <br>

    the xor mask, immediately following the color table, is an array of byte<br>

    values representing consecutive rows of a bitmap. the bitmap defines the<br>

    basic shape and color of the cursor image. as with the bitmap bits in a<br>

    bitmap file, the bitmap data in a cursor-resource file is organized in scan<br>

    lines, with each byte representing one or more pixels, as defined by the<br>

    color format. for more information about these bitmap bits, see section 1.1,<br>

    &quot;bitmap-file formats.&quot;<br>

    <br>

    the and mask, immediately following the xor mask, is an array of byte values<br>

    representing a monochrome bitmap with the same width and height as the xor<br>

    mask. the array is organized in scan lines, with each byte representing 8<br>

    pixels.<br>

    <br>

    when windows draws a cursor, it uses the and and xor masks to combine the<br>

    cursor image with the pixels already on the display surface. windows first<br>

    applies the and mask by using a bitwise and operation; this preserves or<br>

    removes existing pixel color. window then applies the xor mask by using a<br>

    bitwise xor operation. this sets the final color for each pixel.<br>

    <br>

    the following illustration shows the xor and the and masks that create a<br>

    cursor (measuring 8 pixels by 8 pixels) in the form of an arrow:<br>

    <br>

    following are the bit-mask values necessary to produce black, white,<br>

    inverted, and transparent results:<br>

    <br>

    pixel result and maskxor mask<br>

    <br>

    black 0 0 <br>

    white 0 1 <br>

    transparent 1 0 <br>

    inverted1 1 <br>

    <br>

    windows cursor selection<br>

    <br>

    if a cursor-resource file contains more than one cursor image, windows<br>

    determines the best match for a particular display by examining the width and<br>

    height of the cursor images.<br>

    <br>

    <br>

    ==============================================================================<br>

    <br>

    <br>

    bitmapfileheader (3.0)<br>

    <br>

    <br>

    <br>

    typedef struct tagbitmapfileheader { /* bmfh */<br>

    uint bftype;<br>

    dword bfsize;<br>

    uint bfreserved1;<br>

    uint bfreserved2;<br>

    dword bfoffbits;<br>

    } bitmapfileheader;<br>

    <br>

    the bitmapfileheader structure contains information about the type, size, and<br>

⌨️ 快捷键说明

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