Some important MACROs and type definitions. See a_predef.h for other useful constants and defines. | |
---|---|
MACRO | Description |
NULL_STRING | Useful for representing a NULL pointer to an iostream member. Defined as "(null)". |
SAFESTRING(pcc) | If {pcc} is NULL, then NULL_STRING is returned, otherwise {pcc} is returned. |
__min(A,B) | The lesser of the two is returned. |
__max(A,B) | The greater of the two is returned. |
BYTE | An 8-bit typedef - unsigned char |
WORD | A 16-bit typedef - unsigned short |
BYTE | A 32-bit typedef - unsigned long |
UINT | Machine specific size - unsigned int |
MAKEWORD(hi, lo) | 2 BYTEs {hi} and {lo} are used to create a WORD {hi lo} |
MAKEDWORD(hi, lo) | 2 WORDs {hi} and {lo} are used to create a DWORD {hi lo} |
LOWORD(dw) | Extracts the lower order 16 bits from a DWORD |
HIWORD(dw) | Extracts the higher order 16 bits from a DWORD |
BYTEx(dw) |
{x}={0,1,2,3} Extracts the BYTE from a DWORD {b3 b2 b1 b0} |
BITMASK(n) | Returns a DWORD with the nth bit set |
WIDTHMASK(n) | Sets the lower n bits on |
CEILN(num, N) |
Ceiling function in N. Given {num} it will find the next multiple of {N} (eg. CEIL(25, 8) = 32, 25 is closest to the next multiple of 8, which is 32) |
FLOORN(num, N) |
Floor function in N. Given {num} it will find the previous multiple of {N} (eg. FLOORN(25, 8) = 24, 25 is closest to the previous multiple of 8, which is 24) |
COLORREF | A typedef which is really a DWORD, 0x00bbggrr, representing true-color. |
RGB(r,g,b) | Given {r}ed, {g}reen and {b}lue, it creates a COLORREF. |
GetXValue(rgb) |
Where {X}={R,G,B,V,L}. {R}ed, {G}reen, {B}lue, {V}alue (brightness), AntiVa{L}ue (dullness) Retrieve BYTE color component from COLORREF. |