home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / bmp4.zip / WINBMP.H < prev   
C/C++ Source or Header  |  1995-10-18  |  9KB  |  187 lines

  1.  
  2. /* winbmp.h    Created:    1995-07-09 Revised:                */
  3.  
  4. /* Windows Bitmaps Definition Header                    */
  5.  
  6. /************************************************************************/
  7. /************************************************************************/
  8. /************************************************************************/
  9. /* DISCLAIMER OF WARRANTIES:                        */
  10. /* -------------------------                        */
  11. /* The following [enclosed] code is sample code    created    by IBM        */
  12. /* Corporation and Prominare Inc.  This    sample code is not part    of any    */
  13. /* standard IBM    product    and is provided    to you solely for the purpose    */
  14. /* of assisting    you in the development of your applications.  The code    */
  15. /* is provided "AS IS",    without    warranty of any    kind.  Neither IBM nor    */
  16. /* Prominare shall be liable for any damages arising out of your    */
  17. /* use of the sample code, even    if they    have been advised of the    */
  18. /* possibility of such damages.                        */
  19. /************************************************************************/
  20. /************************************************************************/
  21. /************************************************************************/
  22. /*               D I S C L A I M E R                */
  23. /* This    code is    provided on an as is basis with    no implied support.    */
  24. /* It should be    considered freeware that cannot    be rebundled as        */
  25. /* part    of a larger "*ware" offering without our consent.        */
  26. /************************************************************************/
  27. /************************************************************************/
  28. /************************************************************************/
  29.  
  30. /* Copyright ╕ International Business Machines Corp., 1995.        */
  31. /* Copyright ╕ 1995  Prominare Inc.  All Rights    Reserved.        */
  32.  
  33. /* This    WIDTHBYTES macro determines the    number of BYTES    per scan line    */
  34. #define     WIDTHBYTES(i)     ((i+31)/32*4)
  35.  
  36. #pragma    pack(1)
  37.  
  38. /************************************************************************/
  39. /*** Note ***************************************************************/
  40. /************************************************************************/
  41. /*                                    */
  42. /* The following structures are    defined    for Microsoft Windows 3.1    */
  43. /* bitmaps, icons and pointers (known as cursors in Windows).  The    */
  44. /* structures are derived from Microsoft Windows headers when        */
  45. /* available otherwise,    they are derived from the Microsoft Windows 3.1    */
  46. /* Programmers Reference Volume    4, Section 1.  The description of the    */
  47. /* different types is defined within this section.  It should be noted    */
  48. /* that    there is very little difference    in the actual bitmap data    */
  49. /* between Windows 3.1 and OS/2    2.x.  The major    differences lie    within    */
  50. /* the structure headers and some masks.                */
  51. /*                                    */
  52. /************************************************************************/
  53. /************************************************************************/
  54.  
  55.  
  56. /* --- Bitmap Definitions ---------------------------------------------    */
  57.  
  58. typedef    struct _winBITMAPINFOHEADER/* Bitmap Information Header        */
  59.    {                   /* Size:    40 Bytes            */
  60.    ULONG       biSize;           /* Structure    Size            */
  61.    LONG           biWidth;           /* Bitmap Width in Pixels        */
  62.    LONG           biHeight;       /* Bitmap Height in Pixels        */
  63.    USHORT      biPlanes;       /* Device Planes (Must be 1)        */
  64.    USHORT      biBitCount;       /* Bits per Pixel (1, 4, 8 or 24)    */
  65.    ULONG       biCompression;       /* Compression Type            */
  66.    ULONG       biSizeImage;       /* Image Size in Bytes        */
  67.    LONG           biXPelsPerMeter;       /* Horizontal Resolution        */
  68.    LONG           biYPelsPerMeter;       /* Vertical Resolution        */
  69.    ULONG       biClrUsed;       /* Colours Used in Bitmap        */
  70.    ULONG       biClrImportant;       /* Colours Important    for Display    */
  71.    } winBITMAPINFOHEADER;
  72.  
  73. typedef    winBITMAPINFOHEADER *PwinBITMAPINFOHEADER;
  74.  
  75. /* constants for the biCompression field */
  76. #define    BI_RGB        0L
  77. #define    BI_RLE8        1L
  78. #define    BI_RLE4        2L
  79.  
  80. typedef    struct _winRGBQUAD       /* RGB Colour Definition        */
  81.    {                   /* Size:    4 Bytes            */
  82.    BYTE           rgbBlue;           /* Blue Element            */
  83.    BYTE           rgbGreen;       /* Green Element            */
  84.    BYTE           rgbRed;           /* Reg Element            */
  85.    BYTE           rgbReserved;       /* Reserved                */
  86.    } winRGBQUAD;
  87.  
  88. typedef    winRGBQUAD *PwinRGBQUAD;
  89.  
  90. typedef    struct _winRGBTRIPLE       /* RGB Colour Definition        */
  91.    {                   /* Size:    3 Bytes            */
  92.    BYTE           rgbBlue;           /* Blue Element            */
  93.    BYTE           rgbGreen;       /* Green Element            */
  94.    BYTE           rgbRed;           /* Reg Element            */
  95.    } winRGBTRIPLE;
  96.  
  97. typedef    winRGBTRIPLE *PwinRGBTRIPLE;
  98.  
  99. typedef    struct _winBITMAPFILEHEADER/* Bitamp File Header        */
  100.    {                   /* Size:    54 Bytes            */
  101.    USHORT           bfType;       /* Specifies    Type of    File        */
  102.    ULONG           bfSize;       /* File Size    in Bytes        */
  103.    USHORT           bfReserved1;/* Reserved Must Be Zero        */
  104.    USHORT           bfReserved2;/* Reserved Must Be Zero        */
  105.    ULONG           bfOffBits;  /* Offset to    Data from Start    of File    */
  106.    winBITMAPINFOHEADER bmpi;       /* Bitmap Information        */
  107.    } winBITMAPFILEHEADER;
  108.  
  109. typedef    winBITMAPFILEHEADER *PwinBITMAPFILEHEADER;
  110.  
  111. typedef    struct _winBITMAPCOREHEADER/* Bitmap Information Header        */
  112.    {                   /* Size:    12 Bytes            */
  113.    ULONG       bcSize;           /* Structure    Size            */
  114.    SHORT       bcWidth;           /* Bitmap Width in Pixels        */
  115.    SHORT       bcHeight;       /* Bitmap Height in Pixels        */
  116.    USHORT      bcPlanes;       /* Device Planes (Must be 1)        */
  117.    USHORT      bcBitCount;       /* Bits per Pixel (1, 4, 8 or 24)    */
  118.    } winBITMAPCOREHEADER;
  119.  
  120. typedef    winBITMAPCOREHEADER *PwinBITMAPCOREHEADER;
  121.  
  122. typedef    struct _winBITMAPCOREINFO  /* Bitmap Information Header        */
  123.    {                   /* Size:    15 Bytes            */
  124.    ULONG    bcSize;           /* Structure    Size            */
  125.    SHORT    bcWidth;       /* Bitmap Width in Pixels        */
  126.    SHORT    bcHeight;       /* Bitmap Height in Pixels        */
  127.    USHORT    bcPlanes;       /* Device Planes (Must be 1)        */
  128.    USHORT    bcBitCount;       /* Bits per Pixel (1, 4, 8 or 24)    */
  129.    winRGBTRIPLE    bmciColours[1];       /* Bitmap Core Info Colour Table    */
  130.    } winBITMAPCOREINO;
  131.  
  132. typedef    winBITMAPCOREINO *PwinBITMAPCOREINO;
  133.  
  134. /* --- Icon Definitions    -----------------------------------------------    */
  135.  
  136. typedef    struct _winICONDIRENTRY       /* Icon Directory Entry        */
  137.    {                   /* Size:    16 Bytes            */
  138.    BYTE           bWidth;           /* Icon Width in Pels (16, 32 or 64)    */
  139.    BYTE           bHeight;           /* Icon Height in Pels (16, 32 or 64)*/
  140.    BYTE           bColorCount;       /* Colours in Icon (2, 8 or 16)    */
  141.    BYTE           bReserved;       /* Reserved,    Must Be    Zero        */
  142.    USHORT      wPlanes;           /* Number of    Colour Planes (1)    */
  143.    USHORT      wBitCount;       /* Bits per Pixel (1, 4, 8 or 24)    */
  144.    ULONG       dwBytesInRes;       /* Resource Size in Bytes        */
  145.    ULONG       dwImageOffset;       /* Image Offset in Bytes (File Start)*/
  146.    } winICONDIRENTRY;
  147.  
  148. typedef    winICONDIRENTRY    *PwinICONDIRENTRY;
  149.  
  150. typedef    struct _winICONDIR       /* Icon Directory            */
  151.    {                   /* Size:    22 Bytes            */
  152.    USHORT       idReserved;       /* Reserved,    Must Be    Zero        */
  153.    USHORT       idType;       /* Resource Type, Must Be 1        */
  154.    USHORT       idCount;       /* Number of    Entries    in Directory    */
  155.    winICONDIRENTRY idEntries[1];   /* Directory    Entries    Start        */
  156.    } winICONDIR;
  157.  
  158. typedef    winICONDIR *PwinICONDIR;
  159.  
  160. /* --- Pointer Definitions --------------------------------------------    */
  161.  
  162. typedef    struct _winCURSORDIRENTRY
  163.    {                   /* Size:    16 Bytes            */
  164.    BYTE           bWidth;           /* Icon Width in Pels (16, 32 or 64)    */
  165.    BYTE           bHeight;           /* Icon Height in Pels (16, 32 or 64)*/
  166.    BYTE           bColorCount;       /* Colours in Icon (2, 8 or 16)    */
  167.    BYTE           bReserved;       /* Reserved,    Must Be    Zero        */
  168.    USHORT      wXHotspot;       /* x    Hotspot    in Pixels        */
  169.    USHORT      wYHotspot;       /* y    Hotspot    in Pixels        */
  170.    ULONG       dwBytesInRes;       /* Resource Size in Bytes        */
  171.    ULONG       dwImageOffset;       /* Image Offset in Bytes (File Start)*/
  172.    } winCURSORDIRENTRY;
  173.  
  174. typedef    winCURSORDIRENTRY *PwinCURSORDIRENTRY;
  175.  
  176. typedef    struct _winCURSORDIR       /* Cursor Directory            */
  177.    {                   /* Size:    22 Bytes            */
  178.    USHORT         cdReserved;   /* Reserved,    Must Be    Zero        */
  179.    USHORT         cdType;       /* Resource Type, Must Be 2        */
  180.    USHORT         cdCount;       /* Number of    Entries    in Directory    */
  181.    winCURSORDIRENTRY cdEntries[1]; /* Directory    Entries    Start        */
  182.    } winCURSORDIR;
  183.  
  184. typedef    winCURSORDIR *PwinCURSORDIR;
  185.  
  186. #pragma    pack( )
  187.