Macros

Preprocessor macros and compile-time constants.

Macros

Version Information

Target Information

Decorators

Assumptions

Debugging and Error Handling

Utilities

Macro Definition Documentation

BL_MAKE_VERSION

#define BL_MAKE_VERSION (   MAJOR,
  MINOR,
  PATCH 
)    (((MAJOR) << 16) | ((MINOR) << 8) | (PATCH))

Makes a version number representing a MAJOR.MINOR.PATCH combination.

BL_VERSION

#define BL_VERSION   BL_MAKE_VERSION(0, 0, 1)

Blend2D library version.

BL_BUILD_BYTE_ORDER

#define BL_BUILD_BYTE_ORDER   1234

A compile-time constant (macro) that defines byte-order of the target. It can be either 1234 for little-endian targets or 4321 for big-endian targets. Blend2D uses this macro internally, but it's also available to end users as sometimes it could be important for deciding between pixel formats or other important details.

BL_API

#define BL_API

A base API decorator that marks functions and variables exported by Blend2D. This decorator is internally only used to make BL_API_C decorator, which adds extern "C" for C linkage.

BL_API_C

#define BL_API_C   extern "C" BL_API

A decorator that marks functions and variables exported by Blend2D to use C linkage. Public API should only use this decorator and not plain BL_API.

BL_CDECL

#define BL_CDECL

Calling convention used by all exported functions and function callbacks. If you pass callbacks to Blend2D it's strongly advised to use this macro, because some compilers provide a way of overriding a global calling convention (like __vectorcall on Windows platforms), which would break the use of such callbacks.

BL_INLINE

#define BL_INLINE   inline

Marks functions that should always be inlined.

BL_NORETURN

#define BL_NORETURN

Function attribute used by functions that never return (that terminate the process). This attribute is used only once by blRuntimeAssertionFailure() function, which is only used when assertions are enabled. This macro should be considered internal and it's not designed for Blend2D users.

BL_NOEXCEPT

#define BL_NOEXCEPT   noexcept

Defined to noexcept in C++17 mode an nothing in C mode. The reason this macro is provided is because Blend2D C API doesn't use exceptions and is marked as such.

BL_NOEXCEPT_C

#define BL_NOEXCEPT_C   noexcept

Defined to noexcept in C++11 mode an nothing in C mode. This is used to mark Blend2D C API, which is noexcept by design.

BL_ASSUME

#define BL_ASSUME (   ...)    (void)0

Macro that tells the C/C++ compiler that the expression ... evaluates to true. This macro is only used by few places and should be considered internal as you shouldn't need it when using Blend2D library.

BL_LIKELY

#define BL_LIKELY (   ...)    (__VA_ARGS__)

A condition is likely.

BL_UNLIKELY

#define BL_UNLIKELY (   ...)    (__VA_ARGS__)

A condition is unlikely.

BL_ASSERT

#define BL_ASSERT (   EXP)
Value:
do { \
if (BL_UNLIKELY(!(EXP))) \
blRuntimeAssertionFailure(__FILE__, __LINE__, #EXP); \
} while (0)

Run-time assertion executed in debug builds.

BL_PROPAGATE

#define BL_PROPAGATE (   ...)
Value:
do { \
BLResult resultToPropagate = (__VA_ARGS__); \
if (BL_UNLIKELY(resultToPropagate)) \
return resultToPropagate; \
} while (0)

Executes the code within the macro and returns if it returned any value other than BL_SUCCESS. This macro is heavily used across the library for error handling.

BL_MAKE_TAG

#define BL_MAKE_TAG (   A,
  B,
  C,
 
)    ((BLTag)(((BLTag)(A) << 24) | ((BLTag)(B) << 16) | ((BLTag)(C) << 8) | ((BLTag)(D))))

Creates a 32-bit tag (uint32_t) from the given A, B, C, and D values.

BL_HAS_TYPED_MEMBERS

#define BL_HAS_TYPED_MEMBERS (   ...)
Value:
BL_INLINE __VA_ARGS__() noexcept {} \
BL_INLINE __VA_ARGS__(const __VA_ARGS__& other) noexcept { \
memcpy(this, &other, sizeof(__VA_ARGS__)); \
} \
BL_INLINE ~__VA_ARGS__() noexcept {} \
\
BL_INLINE __VA_ARGS__& operator=(const __VA_ARGS__& other) noexcept { \
memcpy(this, &other, sizeof(__VA_ARGS__)); \
return *this; \
}