Macros

Preprocessor macros and compile-time constants.

Macros

Version Information

Target Information

Decorators

Assumptions

Debugging and Error Handling

Utilities

Macro Definition Documentation

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

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

#define BL_VERSION BL_MAKE_VERSION(0, 0, 1)

Blend2D library version.

#define BL_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.

#define BL_API

A base API decorator that marks functions and variables exported by Blend2D.

#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 decorator, 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.

#define BL_INLINE inline

Marks functions that should always be inlined.

#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.

#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.

#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.

#define BL_PURE

Function attribute that describes functions that have no side effect. The macro expands to __attribute__((__pure__)) when compiling with GCC or Clang if the attribute is supported, otherwise it expands to nothing.

#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.

#define BL_LIKELY(...)(__VA_ARGS__)

A condition is likely.

#define BL_UNLIKELY(...)(__VA_ARGS__)

A condition is unlikely.

#define BL_ASSERT(EXP)

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

Run-time assertion executed in debug builds.

#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.

#define BL_MAKE_TAG(A, B, C, D)((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.