我有一段 C 代码。我需要帮助将其翻译为 Delphi 代码。
1)
/*
* Color is packed into 16-bit word as follows:
*
* 15 8 7 0
* XXggbbbb XXrrrrgg
*
* Note that green bits 12 and 13 are the lower bits of green component
* and bits 0 and 1 are the higher ones.
*
*/
#define CLR_RED(spec) (((spec) >> 2) & 0x0F)
#define CLR_GREEN(spec) ((((spec) & 0x03) << 2) | ((spec & 0x3000) >> 12))
#define CLR_BLUE(spec) (((spec) >> 8) & 0x0F)
2)
#define CDG_GET_SCROLL_COMMAND(scroll) (((scroll) & 0x30) >> 4)
#define CDG_GET_SCROLL_HOFFSET(scroll) ((scroll) & 0x07)
#define CDG_GET_SCROLL_VOFFSET(scroll) ((scroll) & 0x0F)