BI_RGB
, BI_RLE8
, etc. are not "strings".
The BITMAPINFOHEADER structure indicates that biCompression
can take on one of the following values:
BI_RGB An uncompressed format.
BI_RLE8 A run-length encoded (RLE)...
BI_RLE4 An RLE format for bitmaps with 4 bpp ...
BI_BITFIELDS Specifies that the bitmap is not compressed ...
BI_JPEG Indicates that the image is a JPEG image.
BI_PNG Indicates that the image is a PNG image.
This means there's a header file, or library somewhere that defines these constants, and they end up being mapped to integers in the order listed.
If you are implementing your own library, then the choice is yours on how you want to implement the specification.
In other words,
BI_RGB 0
BI_RLE8 1
BI_RLE4 2
BI_BITFIELDS 3
BI_JPEG 4
BI_PNG 5
There are multiple ways in which this can be implemented. For example, one mechanism is via macros (#define
), and another is via enumerated types (enum
).
https://www.typescriptlang.org/docs/handbook/enums.html provides a good description of enumerated types.
http://paulbourke.net/dataformats/bmp/BITMAP.H is an example of someone implementing their own definitions based on the specification.