API Macros Changed in Version 2025.2

www.CAD6.com

The macros in this section will be listed in form of standard procedure prototypes to show the types of parameters they expect and return. If you are interested in the implementation of these macros, you will have to look inside the header file MKI_LIB6.H.

 

C++ Syntax

#define mki_touch( p ) ( p ) New in Version 2025.2

Touches the given parameter (marks it as used) to avoid compiler warnings for unused formal parameters.

#define mki_asizeof( p ) ( sizeof( p ) / sizeof( char ) ) New in Version 2022.1

Returns the size of a variable or a data type in Ansi characters.

#define mki_wsizeof( p ) ( sizeof( p ) / sizeof( wchar_t ) ) New in Version 2019.1

Returns the size of a variable or a data type in wide characters.

#define mki_arraysize( p ) ( sizeof( p ) / sizeof( p[0] ) ) New in Version 2022.1

Returns the size of an array in number of entries.

 

template <class TYPE> void

mki_swap( TYPE& f_rData1, TYPE& f_rData2 ) New in Version 2025.0

Exchanges the contents of two instances of the same class by copying, i.e. no constructor or destructor will be called.

Will place a buffer of class size onto the stack, so don't use for huge classes (greater than a few KiB)!

 

MKI_ALPHAVALUE mki_opacity_to_alpha(

 const double f_dValue ); New in Version 2024.1

Convert an opacity value (0.002 .. 1.0) to an alpha value (254 .. 0). Do not use for an opacity of 0.0 (completely invisible).

double mki_alpha_to_opacity(

 MKI_ALPHAVALUE f_bAlpha ); New in Version 2024.1

Convert an alpha value (0 .. 254) to an opacity value (1.0 .. 0.002). Do not use for an alpha value of 255 (MKI_ALPHA_BYLAYER).

BYTE mki_color_get_cmyk_c(

 const MKI_COLORVALUE f_cColor );

Extracts the cyan component of a CMYK color definition (0 .. 255).

BYTE mki_color_get_cmyk_m(

 const MKI_COLORVALUE f_cColor );

Extracts the magenta component of a CMYK color definition (0 .. 255).

BYTE mki_color_get_cmyk_y(

 const MKI_COLORVALUE f_cColor );

Extracts the yellow component of a CMYK color definition (0 .. 255).

BYTE mki_color_get_cmyk_k(

 const MKI_COLORVALUE f_cColor );

Extracts the black component of a CMYK color definition (0 .. 255).

MKI_COLORVALUE mki_color_make_cmyk(

 const DWORD f_dwValueC,

 const DWORD f_dwValueM,

 const DWORD f_dwValueY,

 const DWORD f_dwValueK );

Creates a CMYK color definition from its components.

BYTE mki_color_get_gray_k( const MKI_COLORVALUE f_cColor );

Extracts the black component of a GRAY color definition (0 .. 255).

MKI_COLORVALUE mki_color_make_gray(

 const DWORD f_dwValueK );

Creates a GRAY color definition from its components.

WORD mki_color_get_hsb_h(

 const MKI_COLORVALUE f_cColor );

Extracts the hue component of a HSB color definition (0 .. 360).

BYTE mki_color_get_hsb_s(

 const MKI_COLORVALUE f_cColor );

Extracts the saturation component of a HSB color definition (0 .. 200).

BYTE mki_color_get_hsb_b(

 const MKI_COLORVALUE f_cColor );

Extracts the brightness component of a HSB color definition (0 .. 200).

MKI_COLORVALUE mki_color_make_hsb(

 const DWORD f_dwValueH,

 const DWORD f_dwValueS,

 const DWORD f_dwValueB );

Creates a HSB color definition from its components.

double mki_color_get_lab_l(

 const MKI_COLORVALUE f_cColor ); Changed in Version 2014.0

Extracts the L* component of a LAB color definition (0.0 .. 100.0).

double mki_color_get_lab_a(

 const MKI_COLORVALUE f_cColor ); Changed in Version 2014.0

Extracts the a* component of a LAB color definition (-150.0 .. 150.0).

double mki_color_get_lab_b(

 const MKI_COLORVALUE f_cColor ); Changed in Version 2014.0

Extracts the b* component of a LAB color definition (-150.0 .. 150.0).

MKI_COLORVALUE mki_color_make_lab(

 const double f_dValueL,

 const double f_dValueA,

 const double f_dValueB ); Changed in Version 2014.0

Creates a LAB color definition from its components.

BYTE mki_color_get_rgb_r(

 const MKI_COLORVALUE f_cColor );

Extracts the red component of a RGB color definition (0 .. 255).

BYTE mki_color_get_rgb_g(

 const MKI_COLORVALUE f_cColor );

Extracts the green component of a RGB color definition (0 .. 255).

BYTE mki_color_get_rgb_b(

 const MKI_COLORVALUE f_cColor );

Extracts the blue component of a RGB color definition (0 .. 255).

MKI_COLORVALUE mki_color_make_rgb(

 const DWORD f_dwValueR,

 const DWORD f_dwValueG,
 const DWORD f_dwValueB );

Creates a RGB color definition from its components.

 

__int32 mki_int32_loword(

 const __int32 f_nValue );

Extracts the lower 16 bits of an __int32 value.

__int32 mki_int32_hiword(

 const __int32 f_nValue );

Extracts the higher 16 bits of an __int32 value.

__int32 mki_int32_make(

 const __int32 f_nValueHi,

 const __int32 f_nValueLo );

Creates an __int32 value by concatenating the lower and higher 16 bits.

__int16 mki_round16(

 const double f_dValue );

Rounding of a double value into a __int16 value.

__int32 mki_round32(

 const double f_dValue );

Rounding of a double value into an __int32 value.

__int64 mki_round64(

 const double f_dValue );

Rounding of a double value into an __int64 value.

 

__int32 mki_elem_mode(

 const __int32 f_nValue );

Returns the MKI_ELEM_MODE_MASK part of an element index (highest 4 bits).

__int32 mki_elem_index(

 const __int32 f_nValue );

Returns the MKI_ELEM_INDEX_MASK part of an element index (lower 16 bits).

__int32 mki_elem_entry(

 const __int32 f_nValue );

Returns the MKI_ELEM_ENTRY_MASK part of an element index (bits 16 to 28, shifted down by 16 bits).

__int32 mki_elem_set_entry(

 const __int32 f_nValue );

Prepares the entry part of an element index (shifting up by 16 bits).

 

double mki_abs(

 const double f_dValue );

Returns the absolute value of a double value.

__int32 mki_abs(

 const __int32 f_nValue ); New in Version 2016.1

Returns the absolute value of a __int32 value.

bool mki_abs_smaller(

 const double f_dValue,

 const double f_dThreshold );

Checks if the absolute of the given double value is smaller than the given threshold (which must be a positive value).

bool mki_abs_smaller(

 const __int32 f_nValue,

 const __int32 f_nThreshold ); New in Version 2016.1

Checks if the absolute of the given __int32 value is smaller than the given threshold (which must be a positive value).

bool mki_abs_larger(

 const double f_dValue,

 const double f_dThreshold );

Checks if the absolute of the given double value is larger than the given threshold (which must be a positive value).

bool mki_abs_larger(

 const __int32 f_nValue,

 const __int32 f_nThreshold ); New in Version 2016.1

Checks if the absolute of the given __int32 value is larger than the given threshold (which must be a positive value).

double mki_fixed(

 const FIXED f_cValue );

Conversion of a FIXED real value (as used by some Win32/x64 procedures) into a double value.

MKI_OFFSET mki_db_alignsize(

 MKI_OFFSET f_nSize );

Calculation of a data block's aligned size (multiple of eight) based on its real size Size.

MKI_OFFSET mki_db_textsize(

 LPCWSTR f_pszText );

Calculation of the aligned byte size (multiple of eight) of the string Text.

 

CAD6interface 2026.0 - Copyright 2026 Malz++Kassner® GmbH