IndexMacros
Macros

Preprocessor macros and compile-time constants.

Macros

Version Information

Target Information

Decorators

Assumptions

Debugging and Error Handling

Utilities

#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, 11, 5)[¶]

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 decorate the callback explicitly as some compilers provide a way of overriding a global calling convention (like __vectorcall on Windows platform), which would break the use of such callbacks.

#define BL_INLINE inline[¶]

Marks functions that should always be inlined.

#define BL_INLINE_NODEBUG BL_INLINE[¶]

The same as BL_INLINE possibly combined with __attribute__((artificial)) or __attribute__((nodebug)) if the compiler supports any of them.

The purpose of this macro is to tell the compiler that the function should not need debugging, thus the debug information can be omitted completely. Blend2D uses tris decorator to decorate C++ inline functions that either call C API or that are trivial to improve debugging experience of some tiny abstractions.

#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_NODISCARD[[nodiscard]][¶]

Tells the compiler to issue a warning in case that the return value of a function was not used.

#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_CONSTEXPR constexpr[¶]

Evaluates to constexpr in C++17 mode.

#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 effects. The macro expands to __attribute__((__pure__)) when compiling with GCC or Clang if the attribute is supported, otherwise it expands to nothing.

#define BL_ALIGN_TYPE(
TYPE, ALIGNMENT
) TYPE[¶]

Defines a type with a particular alignment, avoiding the use of alignas() as some compilers have a buggy implementation and restrict alignas() more than a compiler specific attribute.

#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
)((void) 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, which is expected to provide a BLResult, which is returned in case that it is not successful (not equal to BL_SUCCESS). This macro is heavily used across the library for error handling and it's also exposed to end users in case they find comfortable using the same error handling technique to handle errors returned by Blend2D or user code returning BLResult.

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