1 | // [Blend2D] |
2 | // 2D Vector Graphics Powered by a JIT Compiler. |
3 | // |
4 | // [License] |
5 | // Zlib - See LICENSE.md file in the package. |
6 | |
7 | #ifndef BLEND2D_BLAPI_H |
8 | #define BLEND2D_BLAPI_H |
9 | |
10 | // This header can only be included by either <blend2d.h> or by Blend2D headers |
11 | // during the build. Prevent users including <blend2d/> headers by accident and |
12 | // prevent not including "blend2d/blapi-build_p.h" during the build. |
13 | #if !defined(BLEND2D_H) && !defined(BLEND2D_BLAPI_BUILD_P_H) |
14 | #pragma message("Include either <blend2d.h> or <blend2d-impl.h> to use Blend2D library") |
15 | #endif |
16 | |
17 | // ---------------------------------------------------------------------------- |
18 | // [Documentation] |
19 | // ---------------------------------------------------------------------------- |
20 | |
21 | //! \mainpage API Reference |
22 | //! |
23 | //! Blend2D C/C++ API reference documentation generated by Doxygen. |
24 | //! |
25 | //! \section main_introduction Introduction |
26 | //! |
27 | //! Blend2D API consists of enumerations, functions, structs, and C++ classes. |
28 | //! Common concepts like enumerations and POD structs are shared between C and |
29 | //! C++. Some structs contain extra functionality like `BLSomething::reset()` |
30 | //! that is only available to C++ users, however, such functionality is only |
31 | //! provided for convenience and doesn't affect how Blend2D can be used from C. |
32 | //! |
33 | //! Blend2D C++ API is in fact build on top of the C API and all C++ functions |
34 | //! are inlines that call C API without any overhead. It would require double |
35 | //! effort to document both C and C++ APIs separately so we have decided to only |
36 | //! document C++ API and to only list \ref blend2d_api_c_functions "C API" for |
37 | //! users that need it. The C API should be straightforward and matches very |
38 | //! well the C++ part. |
39 | //! |
40 | //! \section main_important Important |
41 | //! |
42 | //! Doxygen sorts struct members in anonymous structs and unions and we haven't |
43 | //! figured out how to turn this off. This means that the order of members in |
44 | //! "Public Attributes" doesn't have to reflect the original struct packing. |
45 | //! So please always double-check struct members in case you plan to use |
46 | //! braces-based initialization of simple structs. |
47 | //! |
48 | //! \section main_groups Groups |
49 | //! |
50 | //! The documentation is split into the following groups: |
51 | //! |
52 | //! $$DOCS_GROUP_OVERVIEW$$ |
53 | //! |
54 | //! \section main_other Other Pages |
55 | //! |
56 | //! - <a href="../doc/getting-started.html">Getting Started</a> - Covers basic |
57 | //! setup and few sample applications |
58 | //! - <a href="annotated.html">Class List</a> - Provides a list of classes |
59 | //! sorted alphabetically |
60 | |
61 | //! \defgroup blend2d_api_globals Global API |
62 | //! \brief Global functions, constants, and classes used universally across |
63 | //! the library. |
64 | |
65 | //! \defgroup blend2d_api_geometry Geometry API |
66 | //! \brief Geometries, paths, and transformations. |
67 | //! |
68 | //! Blend2D offers various geometry structures and objects that can be used with |
69 | //! either `BLPath` for path building or `BLContext` for rendering. |
70 | |
71 | //! \defgroup blend2d_api_imaging Imaging API |
72 | //! \brief Images and image codecs. |
73 | |
74 | //! \defgroup blend2d_api_styling Styling API |
75 | //! \brief Colors, gradients, and patterns. |
76 | |
77 | //! \defgroup blend2d_api_text Text API |
78 | //! \brief Fonts & Text support. |
79 | |
80 | //! \defgroup blend2d_api_rendering Rendering API |
81 | //! \brief 2D rendering context, helper structures, and constants. |
82 | |
83 | //! \defgroup blend2d_api_runtime Runtime API |
84 | //! \brief Interaction with Blend2D runtime. |
85 | |
86 | //! \defgroup blend2d_api_filesystem Filesystem API |
87 | //! \brief Filesystem utilities. |
88 | |
89 | //! \defgroup blend2d_api_impl Impl API |
90 | //! \brief API required for extending Blend2D functionality. |
91 | //! |
92 | //! Everything that is part of this group requires `<blend2d-impl.h>` to be |
93 | //! included before the use as this API is only for users that extend Blend2D. |
94 | |
95 | //! \defgroup blend2d_api_macros Macros |
96 | //! \brief Preprocessor macros and compile-time constants. |
97 | |
98 | //! \defgroup blend2d_api_c_functions C API |
99 | //! \brief Global C API functions exported as `extern "C"` (C API). |
100 | //! |
101 | //! We do not document these functions as they are called from C++ wrappers, |
102 | //! which are documented and should be used as a reference. The most important |
103 | //! thing in using C API is to understand how lifetime of objects is managed. |
104 | //! |
105 | //! Each type that requires initialization provides `Init` and `Reset` functions. |
106 | //! These functions are called by C++ constructors and destructors on C++ side |
107 | //! and must be used the same way by C users. Although these functions return |
108 | //! `BLResult` it's guaranteed the result is always `BL_SUCCESS` - the return |
109 | //! value is only provided for consistency and possible tail calling. |
110 | //! |
111 | //! The following example should illustrate how `Init` and `Reset` works: |
112 | //! |
113 | //! ``` |
114 | //! BLImageCore img; |
115 | //! blImageInit(&img); |
116 | //! blImageCreate(&img, 128, 128, BL_FORMAT_PRGB32); |
117 | //! blImageReset(&img); |
118 | //! ``` |
119 | //! |
120 | //! Some init functions may provide shortcuts for the most used scenarios that |
121 | //! merge initialization and resource allocation into a single function. |
122 | //! |
123 | //! ``` |
124 | //! BLImageCore img; |
125 | //! blImageInitAs(&img, 128, 128, BL_FORMAT_PRGB32); |
126 | //! blImageReset(&img); |
127 | //! ``` |
128 | //! |
129 | //! It's worth knowing that default initialization in Blend2D costs nothing |
130 | //! and no resources are allocated, thus initialization never fails and in |
131 | //! theory default initialized objects don't have to be reset as they don't |
132 | //! hold any data (however never do that in practice). Resetting always resets |
133 | //! the object into its default initialized form, so you can reuse such object |
134 | //! afterwards (after reset it's still properly initialized) or consider it |
135 | //! destroyed. |
136 | //! |
137 | //! The following example should explain how init/reset works: |
138 | //! |
139 | //! \code |
140 | //! BLImageCore img; |
141 | //! |
142 | //! // Now image is default constructed/initialized. if you did just this and |
143 | //! // abandon it then no resources will be leaked as default construction is |
144 | //! // not allocating any resources nor increasing any reference counters. |
145 | //! blImageInit(&img); |
146 | //! |
147 | //! // Now image will have to dynamically allocate some memory to store pixel |
148 | //! // data. If this succeeds the image will have to be reset to destroy the |
149 | //! // data it holds. |
150 | //! BLResult result = blImageCreate(&img, 128, 128, BL_FORMAT_PRGB32); |
151 | //! if (result != BL_SUCCESS) { |
152 | //! // If function fails it should behave like it was never called, so `img` |
153 | //! // would still be default initialized in this case. this means that you |
154 | //! // don't have to reset it explicitly although the C++ API would do it in |
155 | //! // image destructor. |
156 | //! return result; |
157 | //! } |
158 | //! |
159 | //! // Resetting image would destroy its data and make it default constructed. |
160 | //! blImageReset(&img); |
161 | //! |
162 | //! // You can still use the image after it has been reset as the data it holds |
163 | //! // is still valid, but the image is of course empty. |
164 | //! printf("%d", blImageEquals(&img, &img)); |
165 | //! \endcode |
166 | |
167 | //! \cond INTERNAL |
168 | |
169 | //! \defgroup blend2d_internal Internal |
170 | //! |
171 | //! \brief Internal API. |
172 | |
173 | //! \defgroup blend2d_internal_codecs Codecs |
174 | //! |
175 | //! \brief Codecs implementation. |
176 | |
177 | //! \defgroup blend2d_internal_raster Raster |
178 | //! |
179 | //! \brief Raster rendering context. |
180 | |
181 | //! \defgroup blend2d_internal_pipegen PipeGen |
182 | //! |
183 | //! \brief Pipeline generator. |
184 | |
185 | //! \defgroup blend2d_internal_opentype OpenType |
186 | //! |
187 | //! \brief OpenType implementation. |
188 | |
189 | //! \endcond |
190 | |
191 | // ============================================================================ |
192 | // [Version] |
193 | // ============================================================================ |
194 | |
195 | //! \addtogroup blend2d_api_macros |
196 | //! \{ |
197 | |
198 | //! \name Version Information |
199 | //! \{ |
200 | |
201 | //! Makes a version number representing a `MAJOR.MINOR.PATCH` combination. |
202 | #define BL_MAKE_VERSION(MAJOR, MINOR, PATCH) (((MAJOR) << 16) | ((MINOR) << 8) | (PATCH)) |
203 | |
204 | //! Blend2D library version. |
205 | #define BL_VERSION BL_MAKE_VERSION(0, 0, 1) |
206 | |
207 | //! \} |
208 | |
209 | //! \} |
210 | |
211 | // ============================================================================ |
212 | // [Build Options] |
213 | // ============================================================================ |
214 | |
215 | // These definitions can be used to enable static library build. Embed is used |
216 | // when Blend2D's source code is embedded directly in another project, implies |
217 | // static build as well. |
218 | // |
219 | // #define BL_STATIC // Blend2D is a statically linked library. |
220 | |
221 | // DEPRECATED: Will be removed in the future. |
222 | #if defined(BL_BUILD_EMBED) || defined(BL_BUILD_STATIC) |
223 | #if defined(BL_BUILD_EMBED) |
224 | #pragma message("'BL_BUILD_EMBED' is deprecated, use BL_STATIC") |
225 | #endif |
226 | #if defined(BL_BUILD_STATIC) |
227 | #pragma message("'BL_BUILD_STATIC' is deprecated, use BL_STATIC") |
228 | #endif |
229 | #if !defined(BL_STATIC) |
230 | #define BL_STATIC |
231 | #endif |
232 | #endif |
233 | |
234 | // These definitions control the build mode and tracing support. The build mode |
235 | // should be auto-detected at compile time, but it's possible to override it in |
236 | // case that the auto-detection fails. |
237 | // |
238 | // Tracing is a feature that is never compiled by default and it's only used to |
239 | // debug Blend2D itself. |
240 | // |
241 | // #define BL_BUILD_DEBUG // Define to enable debug-mode. |
242 | // #define BL_BUILD_RELEASE // Define to enable release-mode. |
243 | |
244 | // Detect BL_BUILD_DEBUG and BL_BUILD_RELEASE if not defined. |
245 | #if !defined(BL_BUILD_DEBUG) && !defined(BL_BUILD_RELEASE) |
246 | #ifndef NDEBUG |
247 | #define BL_BUILD_DEBUG |
248 | #else |
249 | #define BL_BUILD_RELEASE |
250 | #endif |
251 | #endif |
252 | |
253 | // ============================================================================ |
254 | // [Dependencies] |
255 | // ============================================================================ |
256 | |
257 | #include <stdarg.h> |
258 | #include <stddef.h> |
259 | #include <stdint.h> |
260 | #include <string.h> |
261 | |
262 | #ifdef __cplusplus |
263 | #include <type_traits> |
264 | #include <utility> |
265 | #else |
266 | #include <stdbool.h> |
267 | #endif |
268 | |
269 | // ============================================================================ |
270 | // [Public Macros] |
271 | // ============================================================================ |
272 | |
273 | //! \addtogroup blend2d_api_macros |
274 | //! \{ |
275 | |
276 | //! \name Target Information |
277 | //! \{ |
278 | |
279 | //! \def BL_BYTE_ORDER |
280 | //! |
281 | //! A compile-time constant (macro) that defines byte-order of the target. It |
282 | //! can be either `1234` for little-endian targets or `4321` for big-endian |
283 | //! targets. Blend2D uses this macro internally, but it's also available to |
284 | //! end users as sometimes it could be important for deciding between pixel |
285 | //! formats or other important details. |
286 | #if (defined(__ARMEB__)) || (defined(__MIPSEB__)) || \ |
287 | (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)) |
288 | #define BL_BYTE_ORDER 4321 |
289 | #else |
290 | #define BL_BYTE_ORDER 1234 |
291 | #endif |
292 | |
293 | //! \} |
294 | |
295 | //! \name Decorators |
296 | //! \{ |
297 | |
298 | //! \def BL_API |
299 | //! |
300 | //! A base API decorator that marks functions and variables exported by Blend2D. |
301 | #if !defined(BL_STATIC) |
302 | #if defined(_WIN32) && (defined(_MSC_VER) || defined(__MINGW32__)) |
303 | #if defined(BL_BUILD_EXPORT) |
304 | #define BL_API __declspec(dllexport) |
305 | #else |
306 | #define BL_API __declspec(dllimport) |
307 | #endif |
308 | #elif defined(_WIN32) && defined(__GNUC__) |
309 | #if defined(BL_BUILD_EXPORT) |
310 | #define BL_API __attribute__((dllexport)) |
311 | #else |
312 | #define BL_API __attribute__((dllimport)) |
313 | #endif |
314 | #elif defined(__GNUC__) |
315 | #define BL_API __attribute__((__visibility__("default"))) |
316 | #endif |
317 | #endif |
318 | |
319 | #ifndef BL_API |
320 | #define BL_API |
321 | #endif |
322 | |
323 | //! \def BL_CDECL |
324 | //! |
325 | //! Calling convention used by all exported functions and function callbacks. |
326 | //! If you pass callbacks to Blend2D it's strongly advised to use this decorator, |
327 | //! because some compilers provide a way of overriding a global calling |
328 | //! convention (like __vectorcall on Windows platforms), which would break the |
329 | //! use of such callbacks. |
330 | #if defined(__GNUC__) && defined(__i386__) && !defined(__x86_64__) |
331 | #define BL_CDECL __attribute__((__cdecl__)) |
332 | #elif defined(_MSC_VER) |
333 | #define BL_CDECL __cdecl |
334 | #else |
335 | #define BL_CDECL |
336 | #endif |
337 | |
338 | //! \def BL_INLINE |
339 | //! |
340 | //! Marks functions that should always be inlined. |
341 | |
342 | #if defined(__GNUC__) && !defined(BL_BUILD_DEBUG) |
343 | #define BL_INLINE inline __attribute__((__always_inline__)) |
344 | #elif defined(_MSC_VER) |
345 | #define BL_INLINE __forceinline |
346 | #else |
347 | #define BL_INLINE inline |
348 | #endif |
349 | |
350 | //! \def BL_NORETURN |
351 | //! |
352 | //! Function attribute used by functions that never return (that terminate the |
353 | //! process). This attribute is used only once by `blRuntimeAssertionFailure()` |
354 | //! function, which is only used when assertions are enabled. This macro should |
355 | //! be considered internal and it's not designed for Blend2D users. |
356 | #if defined(__GNUC__) |
357 | #define BL_NORETURN __attribute__((noreturn)) |
358 | #elif defined(_MSC_VER) |
359 | #define BL_NORETURN __declspec(noreturn) |
360 | #else |
361 | #define BL_NORETURN |
362 | #endif |
363 | |
364 | //! \def BL_NOEXCEPT |
365 | //! |
366 | //! Defined to `noexcept` in C++17 mode an nothing in C mode. The reason this |
367 | //! macro is provided is because Blend2D C API doesn't use exceptions and is |
368 | //! marked as such. |
369 | #if defined(__cplusplus) && __cplusplus >= 201703L |
370 | // Function typedefs are `noexcept`, however, it's not available until C++17. |
371 | #define BL_NOEXCEPT noexcept |
372 | #else |
373 | #define BL_NOEXCEPT |
374 | #endif |
375 | |
376 | //! \def BL_NOEXCEPT_C |
377 | //! |
378 | //! Defined to `noexcept` in C++11 mode an nothing in C mode. This is used to |
379 | //! mark Blend2D C API, which is `noexcept` by design. |
380 | #if defined(__cplusplus) |
381 | #define BL_NOEXCEPT_C noexcept |
382 | #else |
383 | #define BL_NOEXCEPT_C |
384 | #endif |
385 | |
386 | //! \} |
387 | |
388 | //! \name Assumptions |
389 | //! \{ |
390 | |
391 | //! \def BL_ASSUME(...) |
392 | //! |
393 | //! Macro that tells the C/C++ compiler that the expression `...` evaluates |
394 | //! to true. This macro is only used by few places and should be considered |
395 | //! internal as you shouldn't need it when using Blend2D library. |
396 | #if defined(__clang__) |
397 | #define BL_ASSUME(...) __builtin_assume(__VA_ARGS__) |
398 | #elif defined(__GNUC__) |
399 | #define BL_ASSUME(...) do { if (!(__VA_ARGS__)) __builtin_unreachable(); } while (0) |
400 | #elif defined(_MSC_VER) |
401 | #define BL_ASSUME(...) __assume(__VA_ARGS__) |
402 | #else |
403 | #define BL_ASSUME(...) (void)0 |
404 | #endif |
405 | |
406 | //! \def BL_LIKELY(...) |
407 | //! |
408 | //! A condition is likely. |
409 | |
410 | //! \def BL_UNLIKELY(...) |
411 | //! |
412 | //! A condition is unlikely. |
413 | |
414 | #if defined(__GNUC__) |
415 | #define BL_LIKELY(...) __builtin_expect(!!(__VA_ARGS__), 1) |
416 | #define BL_UNLIKELY(...) __builtin_expect(!!(__VA_ARGS__), 0) |
417 | #else |
418 | #define BL_LIKELY(...) (__VA_ARGS__) |
419 | #define BL_UNLIKELY(...) (__VA_ARGS__) |
420 | #endif |
421 | |
422 | //! \} |
423 | |
424 | //! \name Debugging and Error Handling |
425 | //! \{ |
426 | |
427 | //! \def BL_ASSERT(EXP) |
428 | //! |
429 | //! Run-time assertion executed in debug builds. |
430 | #ifdef BL_BUILD_DEBUG |
431 | #define BL_ASSERT(EXP) \ |
432 | do { \ |
433 | if (BL_UNLIKELY(!(EXP))) \ |
434 | blRuntimeAssertionFailure(__FILE__, __LINE__, #EXP); \ |
435 | } while (0) |
436 | #else |
437 | #define BL_ASSERT(EXP) ((void)0) |
438 | #endif |
439 | |
440 | //! Executes the code within the macro and returns if it returned any value other |
441 | //! than `BL_SUCCESS`. This macro is heavily used across the library for error |
442 | //! handling. |
443 | #define BL_PROPAGATE(...) \ |
444 | do { \ |
445 | BLResult resultToPropagate = (__VA_ARGS__); \ |
446 | if (BL_UNLIKELY(resultToPropagate)) \ |
447 | return resultToPropagate; \ |
448 | } while (0) |
449 | |
450 | //! \} |
451 | |
452 | //! \name Utilities |
453 | //! \{ |
454 | |
455 | //! Creates a 32-bit tag (uint32_t) from the given `A`, `B`, `C`, and `D` values. |
456 | #define BL_MAKE_TAG(A, B, C, D) \ |
457 | ((BLTag)(((BLTag)(A) << 24) | ((BLTag)(B) << 16) | ((BLTag)(C) << 8) | ((BLTag)(D)))) |
458 | |
459 | //! \} |
460 | |
461 | //! \cond INTERNAL |
462 | //! \name Internals |
463 | //! \{ |
464 | |
465 | //! \def BL_DEFINE_ENUM(NAME) |
466 | //! |
467 | //! Defines an enumeration used by Blend2D that is `uint32_t`. |
468 | |
469 | //! \} |
470 | //! \endcond |
471 | |
472 | #ifdef __cplusplus |
473 | #define BL_DEFINE_ENUM(NAME) enum NAME : uint32_t |
474 | #else |
475 | #define BL_DEFINE_ENUM(NAME) enum NAME |
476 | #endif |
477 | |
478 | #if defined(BL_DOXYGEN) |
479 | // Only for doxygen to make these members nicer. |
480 | #define BL_TYPED_MEMBER(CORE_TYPE, CPP_TYPE, NAME) CPP_TYPE NAME; |
481 | #define BL_HAS_TYPED_MEMBERS(...) |
482 | |
483 | #elif defined(__cplusplus) |
484 | // Union prevents C++ compiler from constructing / destructing its members. |
485 | #define BL_TYPED_MEMBER(CORE_TYPE, CPP_TYPE, NAME) union { CPP_TYPE NAME; } |
486 | |
487 | // However, we have to provide default constructors, destructor, and |
488 | // copy-assignment to pay for such union {}. |
489 | #define BL_HAS_TYPED_MEMBERS(...) \ |
490 | BL_INLINE __VA_ARGS__() noexcept {} \ |
491 | BL_INLINE __VA_ARGS__(const __VA_ARGS__& other) noexcept { \ |
492 | memcpy(this, &other, sizeof(__VA_ARGS__)); \ |
493 | } \ |
494 | BL_INLINE ~__VA_ARGS__() noexcept {} \ |
495 | \ |
496 | BL_INLINE __VA_ARGS__& operator=(const __VA_ARGS__& other) noexcept { \ |
497 | memcpy(this, &other, sizeof(__VA_ARGS__)); \ |
498 | return *this; \ |
499 | } |
500 | #else |
501 | #define BL_TYPED_MEMBER(CORE_TYPE, CPP_TYPE, NAME) CORE_TYPE NAME |
502 | #define BL_HAS_TYPED_MEMBERS(...) |
503 | #endif |
504 | |
505 | //! \} |
506 | |
507 | // ============================================================================ |
508 | // [Diagnostic] |
509 | // ============================================================================ |
510 | |
511 | //! \cond INTERNAL |
512 | //! \name Internals |
513 | //! \{ |
514 | |
515 | // Diagnostic warnings can be turned on/off by using pragmas, however, this is |
516 | // a compiler specific stuff we have to maintain for each compiler. Ideally we |
517 | // should have a clean code that would compile without any warnings with all of |
518 | // them enabled by default, but since there is a lot of nitpicks we just disable |
519 | // some locally when needed (like unused parameter in null-impl functions, etc). |
520 | #if defined(__INTEL_COMPILER) |
521 | // Not regularly tested. |
522 | #elif defined(__clang__) |
523 | #define BL_DIAGNOSTIC_PUSH(...) _Pragma("clang diagnostic push") __VA_ARGS__ |
524 | #define BL_DIAGNOSTIC_POP _Pragma("clang diagnostic pop") |
525 | #define BL_DIAGNOSTIC_NO_INVALID_OFFSETOF _Pragma("clang diagnostic ignored \"-Winvalid-offsetof\"") |
526 | #define BL_DIAGNOSTIC_NO_SHADOW _Pragma("clang diagnostic ignored \"-Wshadow\"") |
527 | #define BL_DIAGNOSTIC_NO_STRICT_ALIASING _Pragma("clang diagnostic ignored \"-Wstrict-aliasing\"") |
528 | #define BL_DIAGNOSTIC_NO_UNUSED_FUNCTIONS _Pragma("clang diagnostic ignored \"-Wunused-function\"") |
529 | #define BL_DIAGNOSTIC_NO_UNUSED_PARAMETERS _Pragma("clang diagnostic ignored \"-Wunused-parameter\"") |
530 | #define _Pragma("clang diagnostic ignored \"-Wextra\"") |
531 | #elif defined(__GNUC__) |
532 | #define BL_DIAGNOSTIC_PUSH(...) _Pragma("GCC diagnostic push") __VA_ARGS__ |
533 | #define BL_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop") |
534 | #define BL_DIAGNOSTIC_NO_INVALID_OFFSETOF _Pragma("GCC diagnostic ignored \"-Winvalid-offsetof\"") |
535 | #define BL_DIAGNOSTIC_NO_SHADOW _Pragma("GCC diagnostic ignored \"-Wshadow\"") |
536 | #define BL_DIAGNOSTIC_NO_STRICT_ALIASING _Pragma("GCC diagnostic ignored \"-Wstrict-aliasing\"") |
537 | #define BL_DIAGNOSTIC_NO_UNUSED_FUNCTIONS _Pragma("GCC diagnostic ignored \"-Wunused-function\"") |
538 | #define BL_DIAGNOSTIC_NO_UNUSED_PARAMETERS _Pragma("GCC diagnostic ignored \"-Wunused-parameter\"") |
539 | #define BL_DIAGNOSTIC_NO_EXTRA_WARNINGS _Pragma("GCC diagnostic ignored \"-Wextra\"") |
540 | #elif defined(_MSC_VER) |
541 | #define BL_DIAGNOSTIC_PUSH(...) __pragma(warning(push)) __VA_ARGS__ |
542 | #define BL_DIAGNOSTIC_POP __pragma(warning(pop)) |
543 | #define BL_DIAGNOSTIC_NO_INVALID_OFFSETOF |
544 | #define BL_DIAGNOSTIC_NO_SHADOW __pragma(warning(disable: 4458)) |
545 | #define BL_DIAGNOSTIC_NO_STRICT_ALIASING |
546 | #define BL_DIAGNOSTIC_NO_UNUSED_FUNCTIONS __pragma(warning(disable: 4505)) |
547 | #define BL_DIAGNOSTIC_NO_UNUSED_PARAMETERS __pragma(warning(disable: 4100)) |
548 | #define BL_DIAGNOSTIC_NO_EXTRA_WARNINGS |
549 | #endif |
550 | |
551 | #if !defined(BL_DIAGNOSTIC_PUSH) |
552 | #define BL_DIAGNOSTIC_PUSH(...) |
553 | #define BL_DIAGNOSTIC_POP |
554 | #define BL_DIAGNOSTIC_NO_INVALID_OFFSETOF |
555 | #define BL_DIAGNOSTIC_NO_SHADOW |
556 | #define BL_DIAGNOSTIC_NO_STRICT_ALIASING |
557 | #define BL_DIAGNOSTIC_NO_UNUSED_FUNCTIONS |
558 | #define BL_DIAGNOSTIC_NO_UNUSED_PARAMETERS |
559 | #define BL_DIAGNOSTIC_NO_EXTRA_WARNINGS |
560 | #endif |
561 | |
562 | //! \} |
563 | //! \endcond |
564 | |
565 | // ============================================================================ |
566 | // [Forward Declarations] |
567 | // ============================================================================ |
568 | |
569 | #ifdef __cplusplus |
570 | #define BL_DEFINE_STRUCT(NAME) struct NAME |
571 | #else |
572 | #define BL_DEFINE_STRUCT(NAME) typedef struct NAME NAME |
573 | #endif |
574 | |
575 | BL_DEFINE_STRUCT(BLRange); |
576 | BL_DEFINE_STRUCT(BLRandom); |
577 | BL_DEFINE_STRUCT(BLCreateForeignInfo); |
578 | BL_DEFINE_STRUCT(BLFileCore); |
579 | |
580 | BL_DEFINE_STRUCT(BLRuntimeBuildInfo); |
581 | BL_DEFINE_STRUCT(BLRuntimeSystemInfo); |
582 | BL_DEFINE_STRUCT(BLRuntimeMemoryInfo); |
583 | |
584 | BL_DEFINE_STRUCT(BLStringCore); |
585 | BL_DEFINE_STRUCT(BLStringImpl); |
586 | BL_DEFINE_STRUCT(BLArrayCore); |
587 | BL_DEFINE_STRUCT(BLArrayImpl); |
588 | BL_DEFINE_STRUCT(BLVariantCore); |
589 | BL_DEFINE_STRUCT(BLVariantImpl); |
590 | |
591 | BL_DEFINE_STRUCT(BLPointI); |
592 | BL_DEFINE_STRUCT(BLPoint); |
593 | BL_DEFINE_STRUCT(BLSizeI); |
594 | BL_DEFINE_STRUCT(BLSize); |
595 | BL_DEFINE_STRUCT(BLBoxI); |
596 | BL_DEFINE_STRUCT(BLBox); |
597 | BL_DEFINE_STRUCT(BLRectI); |
598 | BL_DEFINE_STRUCT(BLRect); |
599 | BL_DEFINE_STRUCT(BLLine); |
600 | BL_DEFINE_STRUCT(BLTriangle); |
601 | BL_DEFINE_STRUCT(BLRoundRect); |
602 | BL_DEFINE_STRUCT(BLCircle); |
603 | BL_DEFINE_STRUCT(BLEllipse); |
604 | BL_DEFINE_STRUCT(BLArc); |
605 | BL_DEFINE_STRUCT(BLMatrix2D); |
606 | BL_DEFINE_STRUCT(BLPathCore); |
607 | BL_DEFINE_STRUCT(BLPathImpl); |
608 | BL_DEFINE_STRUCT(BLPathView); |
609 | BL_DEFINE_STRUCT(BLRegionCore); |
610 | BL_DEFINE_STRUCT(BLRegionImpl); |
611 | BL_DEFINE_STRUCT(BLApproximationOptions); |
612 | BL_DEFINE_STRUCT(BLStrokeOptionsCore); |
613 | |
614 | BL_DEFINE_STRUCT(BLFormatInfo); |
615 | BL_DEFINE_STRUCT(BLImageCore); |
616 | BL_DEFINE_STRUCT(BLImageImpl); |
617 | BL_DEFINE_STRUCT(BLImageData); |
618 | BL_DEFINE_STRUCT(BLImageInfo); |
619 | BL_DEFINE_STRUCT(BLImageScaleOptions); |
620 | BL_DEFINE_STRUCT(BLPixelConverterCore); |
621 | BL_DEFINE_STRUCT(BLPixelConverterOptions); |
622 | |
623 | BL_DEFINE_STRUCT(BLImageCodecCore); |
624 | BL_DEFINE_STRUCT(BLImageCodecImpl); |
625 | BL_DEFINE_STRUCT(BLImageCodecVirt); |
626 | BL_DEFINE_STRUCT(BLImageDecoderCore); |
627 | BL_DEFINE_STRUCT(BLImageDecoderImpl); |
628 | BL_DEFINE_STRUCT(BLImageDecoderVirt); |
629 | BL_DEFINE_STRUCT(BLImageEncoderCore); |
630 | BL_DEFINE_STRUCT(BLImageEncoderImpl); |
631 | BL_DEFINE_STRUCT(BLImageEncoderVirt); |
632 | |
633 | BL_DEFINE_STRUCT(BLRgba32); |
634 | BL_DEFINE_STRUCT(BLRgba64); |
635 | BL_DEFINE_STRUCT(BLRgba128); |
636 | BL_DEFINE_STRUCT(BLGradientCore); |
637 | BL_DEFINE_STRUCT(BLGradientImpl); |
638 | BL_DEFINE_STRUCT(BLGradientStop); |
639 | BL_DEFINE_STRUCT(BLLinearGradientValues); |
640 | BL_DEFINE_STRUCT(BLRadialGradientValues); |
641 | BL_DEFINE_STRUCT(BLConicalGradientValues); |
642 | BL_DEFINE_STRUCT(BLPatternCore); |
643 | BL_DEFINE_STRUCT(BLPatternImpl); |
644 | |
645 | BL_DEFINE_STRUCT(BLContextCore); |
646 | BL_DEFINE_STRUCT(BLContextImpl); |
647 | BL_DEFINE_STRUCT(BLContextVirt); |
648 | BL_DEFINE_STRUCT(BLContextCookie); |
649 | BL_DEFINE_STRUCT(BLContextCreateInfo); |
650 | BL_DEFINE_STRUCT(BLContextHints); |
651 | BL_DEFINE_STRUCT(BLContextState); |
652 | |
653 | BL_DEFINE_STRUCT(BLGlyphBufferCore); |
654 | BL_DEFINE_STRUCT(BLGlyphBufferImpl); |
655 | BL_DEFINE_STRUCT(BLGlyphInfo); |
656 | BL_DEFINE_STRUCT(BLGlyphItem); |
657 | BL_DEFINE_STRUCT(BLGlyphMappingState); |
658 | BL_DEFINE_STRUCT(BLGlyphOutlineSinkInfo); |
659 | BL_DEFINE_STRUCT(BLGlyphPlacement); |
660 | BL_DEFINE_STRUCT(BLGlyphRun); |
661 | |
662 | BL_DEFINE_STRUCT(BLFontUnicodeCoverage); |
663 | BL_DEFINE_STRUCT(BLFontFaceInfo); |
664 | BL_DEFINE_STRUCT(BLFontFeature); |
665 | BL_DEFINE_STRUCT(BLFontDesignMetrics); |
666 | BL_DEFINE_STRUCT(BLFontMatrix); |
667 | BL_DEFINE_STRUCT(BLFontMetrics); |
668 | BL_DEFINE_STRUCT(BLFontPanose); |
669 | BL_DEFINE_STRUCT(BLFontTable); |
670 | BL_DEFINE_STRUCT(BLFontVariation); |
671 | BL_DEFINE_STRUCT(BLTextMetrics); |
672 | |
673 | BL_DEFINE_STRUCT(BLFontCore); |
674 | BL_DEFINE_STRUCT(BLFontImpl); |
675 | BL_DEFINE_STRUCT(BLFontVirt); |
676 | BL_DEFINE_STRUCT(BLFontFaceCore); |
677 | BL_DEFINE_STRUCT(BLFontFaceImpl); |
678 | BL_DEFINE_STRUCT(BLFontFaceVirt); |
679 | BL_DEFINE_STRUCT(BLFontDataCore); |
680 | BL_DEFINE_STRUCT(BLFontDataImpl); |
681 | BL_DEFINE_STRUCT(BLFontDataVirt); |
682 | BL_DEFINE_STRUCT(BLFontLoaderCore); |
683 | BL_DEFINE_STRUCT(BLFontLoaderImpl); |
684 | BL_DEFINE_STRUCT(BLFontLoaderVirt); |
685 | |
686 | #undef BL_DEFINE_STRUCT |
687 | |
688 | // C++ API. |
689 | #ifdef __cplusplus |
690 | class BLFile; |
691 | class BLVariant; |
692 | template<typename T> class BLArray; |
693 | class BLString; |
694 | class BLPath; |
695 | class BLRegion; |
696 | class BLStrokeOptions; |
697 | class BLImage; |
698 | class BLImageCodec; |
699 | class BLImageDecoder; |
700 | class BLImageEncoder; |
701 | class BLPattern; |
702 | class BLGradient; |
703 | class BLContext; |
704 | class BLPixelConverter; |
705 | class BLGlyphBuffer; |
706 | class BLGlyphRunIterator; |
707 | class BLFont; |
708 | class BLFontData; |
709 | class BLFontFace; |
710 | class BLFontLoader; |
711 | #endif |
712 | |
713 | // ============================================================================ |
714 | // [Public Types] |
715 | // ============================================================================ |
716 | |
717 | //! \ingroup blend2d_api_globals |
718 | //! |
719 | //! Result code used by most Blend2D functions (32-bit unsigned integer). |
720 | //! |
721 | //! The `BLResultCode` enumeration contains Blend2D result codes that contain |
722 | //! Blend2D specific set of errors and an extended set of errors that can come |
723 | //! from WIN32 or POSIX APIs. Since the success result code is zero it's |
724 | //! recommended to use the following check to determine whether a call failed |
725 | //! or not: |
726 | //! |
727 | //! ``` |
728 | //! BLResult result = doSomething(); |
729 | //! if (result != BL_SUCCESS) { |
730 | //! // `doSomething()` failed... |
731 | //! } |
732 | //! ``` |
733 | typedef uint32_t BLResult; |
734 | |
735 | //! \ingroup blend2d_api_globals |
736 | //! |
737 | //! A type used to store a pack of bits (typedef to `uintptr_t`). |
738 | //! |
739 | //! BitWord should be equal in size to a machine word. |
740 | typedef uintptr_t BLBitWord; |
741 | |
742 | //! \ingroup blend2d_api_globals |
743 | //! |
744 | //! Tag is a 32-bit integer consisting of 4 characters in the following format: |
745 | //! |
746 | //! ``` |
747 | //! tag = ((a << 24) | (b << 16) | (c << 8) | d) |
748 | //! ``` |
749 | //! |
750 | //! Tags are used extensively by OpenType fonts and other binary formats like |
751 | //! PNG. In most cases TAGs should only contain ASCII letters, digits, and spaces. |
752 | //! |
753 | //! Blend2D uses `BLTag` in public and internal APIs to distinguish between a |
754 | //! regular `uint32_t` and tag. |
755 | typedef uint32_t BLTag; |
756 | |
757 | //! \ingroup blend2d_api_globals |
758 | //! |
759 | //! A function callback that is called when an Impl is destroyed. It's often used |
760 | //! to notify that a data passed to a certain Impl is no longer in use. |
761 | typedef void (BL_CDECL* BLDestroyImplFunc)(void* impl, void* destroyData) BL_NOEXCEPT; |
762 | |
763 | //! \ingroup blend2d_api_geometry |
764 | //! |
765 | //! Optional callback that can be used to consume a path data. |
766 | typedef BLResult (BL_CDECL* BLPathSinkFunc)(BLPathCore* path, const void* info, void* closure) BL_NOEXCEPT; |
767 | |
768 | //! \ingroup blend2d_api_text |
769 | //! |
770 | //! Glyph identifier is an index to a glyph stored in a font. |
771 | //! |
772 | //! GlyphId is always an unsigned 16-bit integer as used by TrueType and OpenType |
773 | //! fonts. There are some libraries that use 32-bit integers for Glyph indexes, |
774 | //! but values above 65535 are never used in practice as font's generally do |
775 | //! not have the ability to index more than 65535 glyphs (excluding null glyph). |
776 | typedef uint16_t BLGlyphId; |
777 | |
778 | // ============================================================================ |
779 | // [Constants] |
780 | // ============================================================================ |
781 | |
782 | //! \ingroup blend2d_api_globals |
783 | //! |
784 | //! Blend2D result code. |
785 | BL_DEFINE_ENUM(BLResultCode) { |
786 | //! Successful result code. |
787 | BL_SUCCESS = 0, |
788 | |
789 | BL_ERROR_START_INDEX = 0x00010000u, |
790 | |
791 | BL_ERROR_OUT_OF_MEMORY = 0x00010000u, //!< Out of memory [ENOMEM]. |
792 | BL_ERROR_INVALID_VALUE, //!< Invalid value/argument [EINVAL]. |
793 | BL_ERROR_INVALID_STATE, //!< Invalid state [EFAULT]. |
794 | BL_ERROR_INVALID_HANDLE, //!< Invalid handle or file. [EBADF]. |
795 | BL_ERROR_VALUE_TOO_LARGE, //!< Value too large [EOVERFLOW]. |
796 | BL_ERROR_NOT_INITIALIZED, //!< Not initialized (some instance is built-in none when it shouldn't be). |
797 | BL_ERROR_NOT_IMPLEMENTED, //!< Not implemented [ENOSYS]. |
798 | BL_ERROR_NOT_PERMITTED, //!< Operation not permitted [EPERM]. |
799 | |
800 | BL_ERROR_IO, //!< IO error [EIO]. |
801 | BL_ERROR_BUSY, //!< Device or resource busy [EBUSY]. |
802 | BL_ERROR_INTERRUPTED, //!< Operation interrupted [EINTR]. |
803 | BL_ERROR_TRY_AGAIN, //!< Try again [EAGAIN]. |
804 | BL_ERROR_TIMED_OUT, //!< Timed out [ETIMEDOUT]. |
805 | BL_ERROR_BROKEN_PIPE, //!< Broken pipe [EPIPE]. |
806 | BL_ERROR_INVALID_SEEK, //!< File is not seekable [ESPIPE]. |
807 | BL_ERROR_SYMLINK_LOOP, //!< Too many levels of symlinks [ELOOP]. |
808 | BL_ERROR_FILE_TOO_LARGE, //!< File is too large [EFBIG]. |
809 | BL_ERROR_ALREADY_EXISTS, //!< File/directory already exists [EEXIST]. |
810 | BL_ERROR_ACCESS_DENIED, //!< Access denied [EACCES]. |
811 | BL_ERROR_MEDIA_CHANGED, //!< Media changed [Windows::ERROR_MEDIA_CHANGED]. |
812 | BL_ERROR_READ_ONLY_FS, //!< The file/FS is read-only [EROFS]. |
813 | BL_ERROR_NO_DEVICE, //!< Device doesn't exist [ENXIO]. |
814 | BL_ERROR_NO_ENTRY, //!< Not found, no entry (fs) [ENOENT]. |
815 | BL_ERROR_NO_MEDIA, //!< No media in drive/device [ENOMEDIUM]. |
816 | BL_ERROR_NO_MORE_DATA, //!< No more data / end of file [ENODATA]. |
817 | BL_ERROR_NO_MORE_FILES, //!< No more files [ENMFILE]. |
818 | BL_ERROR_NO_SPACE_LEFT, //!< No space left on device [ENOSPC]. |
819 | BL_ERROR_NOT_EMPTY, //!< Directory is not empty [ENOTEMPTY]. |
820 | BL_ERROR_NOT_FILE, //!< Not a file [EISDIR]. |
821 | BL_ERROR_NOT_DIRECTORY, //!< Not a directory [ENOTDIR]. |
822 | BL_ERROR_NOT_SAME_DEVICE, //!< Not same device [EXDEV]. |
823 | BL_ERROR_NOT_BLOCK_DEVICE, //!< Not a block device [ENOTBLK]. |
824 | |
825 | BL_ERROR_INVALID_FILE_NAME, //!< File/path name is invalid [n/a]. |
826 | BL_ERROR_FILE_NAME_TOO_LONG, //!< File/path name is too long [ENAMETOOLONG]. |
827 | |
828 | BL_ERROR_TOO_MANY_OPEN_FILES, //!< Too many open files [EMFILE]. |
829 | BL_ERROR_TOO_MANY_OPEN_FILES_BY_OS, //!< Too many open files by OS [ENFILE]. |
830 | BL_ERROR_TOO_MANY_LINKS, //!< Too many symbolic links on FS [EMLINK]. |
831 | BL_ERROR_TOO_MANY_THREADS, //!< Too many threads [EAGAIN]. |
832 | |
833 | BL_ERROR_FILE_EMPTY, //!< File is empty (not specific to any OS error). |
834 | BL_ERROR_OPEN_FAILED, //!< File open failed [Windows::ERROR_OPEN_FAILED]. |
835 | BL_ERROR_NOT_ROOT_DEVICE, //!< Not a root device/directory [Windows::ERROR_DIR_NOT_ROOT]. |
836 | |
837 | BL_ERROR_UNKNOWN_SYSTEM_ERROR, //!< Unknown system error that failed to translate to Blend2D result code. |
838 | |
839 | BL_ERROR_INVALID_ALIGNMENT, //!< Invalid data alignment. |
840 | BL_ERROR_INVALID_SIGNATURE, //!< Invalid data signature or header. |
841 | BL_ERROR_INVALID_DATA, //!< Invalid or corrupted data. |
842 | BL_ERROR_INVALID_STRING, //!< Invalid string (invalid data of either UTF8, UTF16, or UTF32). |
843 | BL_ERROR_DATA_TRUNCATED, //!< Truncated data (more data required than memory/stream provides). |
844 | BL_ERROR_DATA_TOO_LARGE, //!< Input data too large to be processed. |
845 | BL_ERROR_DECOMPRESSION_FAILED, //!< Decompression failed due to invalid data (RLE, Huffman, etc). |
846 | |
847 | BL_ERROR_INVALID_GEOMETRY, //!< Invalid geometry (invalid path data or shape). |
848 | BL_ERROR_NO_MATCHING_VERTEX, //!< Returned when there is no matching vertex in path data. |
849 | |
850 | BL_ERROR_NO_MATCHING_COOKIE, //!< No matching cookie (BLContext). |
851 | BL_ERROR_NO_STATES_TO_RESTORE, //!< No states to restore (BLContext). |
852 | |
853 | BL_ERROR_IMAGE_TOO_LARGE, //!< The size of the image is too large. |
854 | BL_ERROR_IMAGE_NO_MATCHING_CODEC, //!< Image codec for a required format doesn't exist. |
855 | BL_ERROR_IMAGE_UNKNOWN_FILE_FORMAT, //!< Unknown or invalid file format that cannot be read. |
856 | BL_ERROR_IMAGE_DECODER_NOT_PROVIDED, //!< Image codec doesn't support reading the file format. |
857 | BL_ERROR_IMAGE_ENCODER_NOT_PROVIDED, //!< Image codec doesn't support writing the file format. |
858 | |
859 | BL_ERROR_PNG_MULTIPLE_IHDR, //!< Multiple IHDR chunks are not allowed (PNG). |
860 | BL_ERROR_PNG_INVALID_IDAT, //!< Invalid IDAT chunk (PNG). |
861 | BL_ERROR_PNG_INVALID_IEND, //!< Invalid IEND chunk (PNG). |
862 | BL_ERROR_PNG_INVALID_PLTE, //!< Invalid PLTE chunk (PNG). |
863 | BL_ERROR_PNG_INVALID_TRNS, //!< Invalid tRNS chunk (PNG). |
864 | BL_ERROR_PNG_INVALID_FILTER, //!< Invalid filter type (PNG). |
865 | |
866 | BL_ERROR_JPEG_UNSUPPORTED_FEATURE, //!< Unsupported feature (JPEG). |
867 | BL_ERROR_JPEG_INVALID_SOS, //!< Invalid SOS marker or header (JPEG). |
868 | BL_ERROR_JPEG_INVALID_SOF, //!< Invalid SOF marker (JPEG). |
869 | BL_ERROR_JPEG_MULTIPLE_SOF, //!< Multiple SOF markers (JPEG). |
870 | BL_ERROR_JPEG_UNSUPPORTED_SOF, //!< Unsupported SOF marker (JPEG). |
871 | |
872 | BL_ERROR_FONT_NO_CHARACTER_MAPPING, //!< Font has no character to glyph mapping data. |
873 | BL_ERROR_FONT_MISSING_IMPORTANT_TABLE, //!< Font has missing an important table. |
874 | BL_ERROR_FONT_FEATURE_NOT_AVAILABLE, //!< Font feature is not available. |
875 | BL_ERROR_FONT_CFF_INVALID_DATA, //!< Font has an invalid CFF data. |
876 | BL_ERROR_FONT_PROGRAM_TERMINATED, //!< Font program terminated because the execution reached the limit. |
877 | |
878 | BL_ERROR_INVALID_GLYPH //!< Invalid glyph identifier. |
879 | }; |
880 | |
881 | //! \ingroup blend2d_api_globals |
882 | //! |
883 | //! Byte order. |
884 | BL_DEFINE_ENUM(BLByteOrder) { |
885 | //! Little endian byte-order. |
886 | BL_BYTE_ORDER_LE = 0, |
887 | //! Big endian byte-order. |
888 | BL_BYTE_ORDER_BE = 1, |
889 | |
890 | //! Native (host) byte-order. |
891 | BL_BYTE_ORDER_NATIVE = BL_BYTE_ORDER == 1234 ? BL_BYTE_ORDER_LE : BL_BYTE_ORDER_BE, |
892 | //! Swapped byte-order (BE if host is LE and vice versa). |
893 | BL_BYTE_ORDER_SWAPPED = BL_BYTE_ORDER == 1234 ? BL_BYTE_ORDER_BE : BL_BYTE_ORDER_LE |
894 | }; |
895 | |
896 | //! \ingroup blend2d_api_globals |
897 | //! |
898 | //! Data access flags. |
899 | BL_DEFINE_ENUM(BLDataAccessFlags) { |
900 | //! Read access. |
901 | BL_DATA_ACCESS_READ = 0x01u, |
902 | //! Write access. |
903 | BL_DATA_ACCESS_WRITE = 0x02u, |
904 | //! Read and write access. |
905 | BL_DATA_ACCESS_RW = 0x03u |
906 | }; |
907 | |
908 | //! \ingroup blend2d_api_globals |
909 | //! |
910 | //! Data source type. |
911 | BL_DEFINE_ENUM(BLDataSourceType) { |
912 | //! No data source. |
913 | BL_DATA_SOURCE_TYPE_NONE = 0, |
914 | //! Memory data source. |
915 | BL_DATA_SOURCE_TYPE_MEMORY = 1, |
916 | //! File data source. |
917 | BL_DATA_SOURCE_TYPE_FILE = 2, |
918 | //! Custom data source. |
919 | BL_DATA_SOURCE_TYPE_CUSTOM = 3, |
920 | |
921 | //! Count of data source types. |
922 | BL_DATA_SOURCE_TYPE_COUNT = 4 |
923 | }; |
924 | |
925 | //! \ingroup blend2d_api_globals |
926 | //! |
927 | //! Modification operation applied to Blend2D containers. |
928 | BL_DEFINE_ENUM(BLModifyOp) { |
929 | //! Assign operation and reserve only space to fit the input. |
930 | BL_MODIFY_OP_ASSIGN_FIT = 0, |
931 | //! Assign operation and reserve more capacity for growing. |
932 | BL_MODIFY_OP_ASSIGN_GROW = 1, |
933 | //! Append operation and reserve only space to fit the input. |
934 | BL_MODIFY_OP_APPEND_FIT = 2, |
935 | //! Append operation and reserve more capacity for growing. |
936 | BL_MODIFY_OP_APPEND_GROW = 3, |
937 | |
938 | //! Count of data operations. |
939 | BL_MODIFY_OP_COUNT = 4 |
940 | }; |
941 | |
942 | //! \ingroup blend2d_api_globals |
943 | //! |
944 | //! Boolean operator. |
945 | BL_DEFINE_ENUM(BLBooleanOp) { |
946 | //! Result = B. |
947 | BL_BOOLEAN_OP_COPY = 0, |
948 | //! Result = A & B. |
949 | BL_BOOLEAN_OP_AND = 1, |
950 | //! Result = A | B. |
951 | BL_BOOLEAN_OP_OR = 2, |
952 | //! Result = A ^ B. |
953 | BL_BOOLEAN_OP_XOR = 3, |
954 | //! Result = A - B. |
955 | BL_BOOLEAN_OP_SUB = 4, |
956 | |
957 | BL_BOOLEAN_OP_COUNT = 5 |
958 | }; |
959 | |
960 | //! \ingroup blend2d_api_styling |
961 | //! |
962 | //! Extend mode. |
963 | BL_DEFINE_ENUM(BLExtendMode) { |
964 | //! Pad extend [default]. |
965 | BL_EXTEND_MODE_PAD = 0, |
966 | //! Repeat extend. |
967 | BL_EXTEND_MODE_REPEAT = 1, |
968 | //! Reflect extend. |
969 | BL_EXTEND_MODE_REFLECT = 2, |
970 | |
971 | //! Alias to `BL_EXTEND_MODE_PAD`. |
972 | BL_EXTEND_MODE_PAD_X_PAD_Y = 0, |
973 | //! Alias to `BL_EXTEND_MODE_REPEAT`. |
974 | BL_EXTEND_MODE_REPEAT_X_REPEAT_Y = 1, |
975 | //! Alias to `BL_EXTEND_MODE_REFLECT`. |
976 | BL_EXTEND_MODE_REFLECT_X_REFLECT_Y = 2, |
977 | //! Pad X and repeat Y. |
978 | BL_EXTEND_MODE_PAD_X_REPEAT_Y = 3, |
979 | //! Pad X and reflect Y. |
980 | BL_EXTEND_MODE_PAD_X_REFLECT_Y = 4, |
981 | //! Repeat X and pad Y. |
982 | BL_EXTEND_MODE_REPEAT_X_PAD_Y = 5, |
983 | //! Repeat X and reflect Y. |
984 | BL_EXTEND_MODE_REPEAT_X_REFLECT_Y = 6, |
985 | //! Reflect X and pad Y. |
986 | BL_EXTEND_MODE_REFLECT_X_PAD_Y = 7, |
987 | //! Reflect X and repeat Y. |
988 | BL_EXTEND_MODE_REFLECT_X_REPEAT_Y = 8, |
989 | |
990 | //! Count of simple extend modes (that use the same value for X and Y). |
991 | BL_EXTEND_MODE_SIMPLE_COUNT = 3, |
992 | //! Count of complex extend modes (that can use independent values for X and Y). |
993 | BL_EXTEND_MODE_COMPLEX_COUNT = 9 |
994 | }; |
995 | |
996 | //! \ingroup blend2d_api_styling |
997 | //! |
998 | //! Style type. |
999 | BL_DEFINE_ENUM(BLStyleType) { |
1000 | //! No style, nothing will be paint. |
1001 | BL_STYLE_TYPE_NONE = 0, |
1002 | //! Solid color style. |
1003 | BL_STYLE_TYPE_SOLID = 1, |
1004 | //! Pattern style. |
1005 | BL_STYLE_TYPE_PATTERN = 2, |
1006 | //! Gradient style. |
1007 | BL_STYLE_TYPE_GRADIENT = 3, |
1008 | |
1009 | //! Count of style types. |
1010 | BL_STYLE_TYPE_COUNT = 4 |
1011 | }; |
1012 | |
1013 | //! \ingroup blend2d_api_text |
1014 | //! |
1015 | //! Text encoding. |
1016 | BL_DEFINE_ENUM(BLTextEncoding) { |
1017 | //! UTF-8 encoding. |
1018 | BL_TEXT_ENCODING_UTF8 = 0, |
1019 | //! UTF-16 encoding (native endian). |
1020 | BL_TEXT_ENCODING_UTF16 = 1, |
1021 | //! UTF-32 encoding (native endian). |
1022 | BL_TEXT_ENCODING_UTF32 = 2, |
1023 | //! LATIN1 encoding (one byte per character). |
1024 | BL_TEXT_ENCODING_LATIN1 = 3, |
1025 | |
1026 | //! Platform native `wchar_t` (or Windows `WCHAR`) encoding, alias to |
1027 | //! either UTF-32, UTF-16, or UTF-8 depending on `sizeof(wchar_t)`. |
1028 | BL_TEXT_ENCODING_WCHAR |
1029 | = sizeof(wchar_t) == 4 ? BL_TEXT_ENCODING_UTF32 : |
1030 | sizeof(wchar_t) == 2 ? BL_TEXT_ENCODING_UTF16 : BL_TEXT_ENCODING_UTF8, |
1031 | |
1032 | //! Count of text supported text encodings. |
1033 | BL_TEXT_ENCODING_COUNT = 4 |
1034 | }; |
1035 | |
1036 | // ============================================================================ |
1037 | // [Internal API] |
1038 | // ============================================================================ |
1039 | |
1040 | #ifdef __cplusplus |
1041 | //! \cond INTERNAL |
1042 | |
1043 | //! \ingroup blend2d_internal |
1044 | //! |
1045 | //! Internal namespace that should never be used by Blend2D users. |
1046 | namespace BLInternal { |
1047 | |
1048 | //! StdInt provides an integer defined by <stdint.h> by size and signedness. |
1049 | //! |
1050 | //! This struct is visible to Blend2D users, because it's required by the |
1051 | //! `BLArray<>` template. However, it's still considered internal and should |
1052 | //! not be used outside of Blend2D source code. |
1053 | template<size_t Size, unsigned Unsigned> |
1054 | struct StdInt {}; |
1055 | |
1056 | template<> struct StdInt<1, 0> { typedef int8_t Type; }; |
1057 | template<> struct StdInt<1, 1> { typedef uint8_t Type; }; |
1058 | template<> struct StdInt<2, 0> { typedef int16_t Type; }; |
1059 | template<> struct StdInt<2, 1> { typedef uint16_t Type; }; |
1060 | template<> struct StdInt<4, 0> { typedef int32_t Type; }; |
1061 | template<> struct StdInt<4, 1> { typedef uint32_t Type; }; |
1062 | template<> struct StdInt<8, 0> { typedef int64_t Type; }; |
1063 | template<> struct StdInt<8, 1> { typedef uint64_t Type; }; |
1064 | |
1065 | //! Implementation of `blDownCast()`, which can be used to downcast a Blend2D |
1066 | //! core struct / object into its C++ counterpart. The cast is always safe. |
1067 | template<typename T> |
1068 | struct DownCast { T Type; }; |
1069 | |
1070 | #define BL_DCAST_IMPL(T) template<> struct DownCast<T##Core> { typedef T Type; } |
1071 | |
1072 | BL_DCAST_IMPL(BLContext); |
1073 | BL_DCAST_IMPL(BLFile); |
1074 | BL_DCAST_IMPL(BLFont); |
1075 | BL_DCAST_IMPL(BLFontData); |
1076 | BL_DCAST_IMPL(BLFontFace); |
1077 | BL_DCAST_IMPL(BLFontLoader); |
1078 | BL_DCAST_IMPL(BLGlyphBuffer); |
1079 | BL_DCAST_IMPL(BLGradient); |
1080 | BL_DCAST_IMPL(BLImage); |
1081 | BL_DCAST_IMPL(BLImageCodec); |
1082 | BL_DCAST_IMPL(BLImageDecoder); |
1083 | BL_DCAST_IMPL(BLImageEncoder); |
1084 | BL_DCAST_IMPL(BLPath); |
1085 | BL_DCAST_IMPL(BLPattern); |
1086 | BL_DCAST_IMPL(BLPixelConverter); |
1087 | BL_DCAST_IMPL(BLRegion); |
1088 | BL_DCAST_IMPL(BLString); |
1089 | BL_DCAST_IMPL(BLStrokeOptions); |
1090 | BL_DCAST_IMPL(BLVariant); |
1091 | |
1092 | #undef BL_DCAST_IMPL |
1093 | |
1094 | //! Helper to implement placement new/delete without relying on `<new>` header. |
1095 | struct PlacementNew { void* ptr; }; |
1096 | |
1097 | } // {BLInternal} |
1098 | |
1099 | //! Implementation of placement new so we don't have to depend on `<new>`. |
1100 | inline void* operator new(std::size_t, const BLInternal::PlacementNew& p) { |
1101 | BL_ASSUME(p.ptr != nullptr); // Otherwise MSVC would generate nullptr check. |
1102 | return p.ptr; |
1103 | } |
1104 | |
1105 | //! \endcond |
1106 | #endif |
1107 | |
1108 | // ============================================================================ |
1109 | // [Public API - TraceError] |
1110 | // ============================================================================ |
1111 | |
1112 | //! \addtogroup blend2d_api_globals |
1113 | //! \{ |
1114 | //! \name Debugging Functionality |
1115 | //! \{ |
1116 | |
1117 | //! Returns the `result` passed. |
1118 | //! |
1119 | //! Provided for debugging purposes. Putting a breakpoint inside `blTraceError()` |
1120 | //! can help with tracing an origin of errors reported / returned by Blend2D as |
1121 | //! each error goes through this function. |
1122 | //! |
1123 | //! It's a zero-cost solution that doesn't affect release builds in any way. |
1124 | static inline BLResult blTraceError(BLResult result) BL_NOEXCEPT_C { return result; } |
1125 | |
1126 | //! \} |
1127 | //! \} |
1128 | |
1129 | // ============================================================================ |
1130 | // [Public API - Templates] |
1131 | // ============================================================================ |
1132 | |
1133 | #ifdef __cplusplus |
1134 | // These are the only global functions provided in C++ mode. They are needed by |
1135 | // C++ API wrappers and can be used freely by Blend2D users as these templates |
1136 | // have specializations for some geometry types. For example `blMin(a, b)` works |
1137 | // with numbers as well as with `BLPoint`. |
1138 | |
1139 | //! \addtogroup blend2d_api_globals |
1140 | //! \{ |
1141 | //! \name Global C++ Functions |
1142 | //! \{ |
1143 | |
1144 | //! Returns an absolute value of `a`. |
1145 | template<typename T> |
1146 | constexpr T blAbs(const T& a) noexcept { return T(a < 0 ? -a : a); } |
1147 | |
1148 | //! Returns a minimum value of `a` and `b`. |
1149 | template<typename T> |
1150 | constexpr T blMin(const T& a, const T& b) noexcept { return T(b < a ? b : a); } |
1151 | |
1152 | //! Returns a maximum value of `a` and `b`. |
1153 | template<typename T> |
1154 | constexpr T blMax(const T& a, const T& b) noexcept { return T(a < b ? b : a); } |
1155 | |
1156 | //! Clamps `a` to a range defined as `[b, c]`. |
1157 | template<typename T> |
1158 | constexpr T blClamp(const T& a, const T& b, const T& c) noexcept { return blMin(c, blMax(b, a)); } |
1159 | |
1160 | //! Returns a minimum value of all arguments passed. |
1161 | template<typename T, typename... Args> |
1162 | constexpr T blMin(const T& a, const T& b, Args&&... args) noexcept { return blMin(blMin(a, b), std::forward<Args>(args)...); } |
1163 | |
1164 | //! Returns a maximum value of all arguments passed. |
1165 | template<typename T, typename... Args> |
1166 | constexpr T blMax(const T& a, const T& b, Args&&... args) noexcept { return blMax(blMax(a, b), std::forward<Args>(args)...); } |
1167 | |
1168 | //! Returns `true` if `a` and `b` equals at binary level. |
1169 | //! |
1170 | //! For example `blEquals(NaN, NaN) == true`. |
1171 | template<typename T> |
1172 | BL_INLINE bool blEquals(const T& a, const T& b) noexcept { return a == b; } |
1173 | |
1174 | //! \cond |
1175 | template<> |
1176 | BL_INLINE bool blEquals(const float& a, const float& b) noexcept { |
1177 | union { float f32[2]; uint32_t u32[2]; } view {{ a, b }}; |
1178 | return view.u32[0] == view.u32[1]; |
1179 | } |
1180 | |
1181 | template<> |
1182 | BL_INLINE bool blEquals(const double& a, const double& b) noexcept { |
1183 | union { double f64[2]; uint64_t u64[2]; } view {{ a, b }}; |
1184 | return view.u64[0] == view.u64[1]; |
1185 | } |
1186 | //! \endcond |
1187 | |
1188 | //! \} |
1189 | //! \} |
1190 | #endif |
1191 | |
1192 | // ============================================================================ |
1193 | // [Public API - DownCast] |
1194 | // ============================================================================ |
1195 | |
1196 | #ifdef __cplusplus |
1197 | //! \addtogroup blend2d_api_globals |
1198 | //! \{ |
1199 | //! \name Downcasting from Core type to C++ type |
1200 | //! \{ |
1201 | |
1202 | //! Downcasts a core type like `BLContextCore` into a C++ type like `BLContext`. |
1203 | //! Intended to be used by C++ users that work with C API as well (by either |
1204 | //! providing it directly or using some other code that uses Blend2D C API). |
1205 | template<typename T> |
1206 | static constexpr typename BLInternal::DownCast<T>::Type& blDownCast(T& ref) noexcept { |
1207 | return reinterpret_cast<typename BLInternal::DownCast<T>::Type&>(ref); |
1208 | } |
1209 | |
1210 | //! \overload |
1211 | template<typename T> |
1212 | static constexpr const typename BLInternal::DownCast<T>::Type& blDownCast(const T& ref) noexcept { |
1213 | return reinterpret_cast<const typename BLInternal::DownCast<T>::Type&>(ref); |
1214 | } |
1215 | |
1216 | //! \overload |
1217 | template<typename T> |
1218 | static constexpr typename BLInternal::DownCast<T>::Type* blDownCast(T* ptr) noexcept { |
1219 | return reinterpret_cast<typename BLInternal::DownCast<T>::Type*>(ptr); |
1220 | } |
1221 | |
1222 | //! \overload |
1223 | template<typename T> |
1224 | static constexpr const typename BLInternal::DownCast<T>::Type* blDownCast(const T* ptr) noexcept { |
1225 | return reinterpret_cast<const typename BLInternal::DownCast<T>::Type*>(ptr); |
1226 | } |
1227 | |
1228 | //! \} |
1229 | //! \} |
1230 | #endif |
1231 | |
1232 | // ============================================================================ |
1233 | // [BLRange] |
1234 | // ============================================================================ |
1235 | |
1236 | //! \addtogroup blend2d_api_globals |
1237 | //! \{ |
1238 | |
1239 | //! Provides start and end indexes. It's used to specify a range of an operation |
1240 | //! related to indexed containers like `BLArray`, `BLPath`, `BLGradient`, etc... |
1241 | struct BLRange { |
1242 | size_t start; |
1243 | size_t end; |
1244 | |
1245 | // -------------------------------------------------------------------------- |
1246 | #ifdef __cplusplus |
1247 | BL_DIAGNOSTIC_PUSH(BL_DIAGNOSTIC_NO_SHADOW) |
1248 | |
1249 | //! Create an uninitialized range. |
1250 | BL_INLINE BLRange() noexcept = default; |
1251 | //! Create a copy of `other` range. |
1252 | constexpr BLRange(const BLRange&) noexcept = default; |
1253 | |
1254 | //! Create a range from `start` to `end`. |
1255 | constexpr explicit BLRange(size_t start, size_t end) noexcept |
1256 | : start(start), |
1257 | end(end) {} |
1258 | |
1259 | static constexpr BLRange everything() noexcept { return BLRange(0, SIZE_MAX); } |
1260 | |
1261 | //! Reset the range to [0, 0). |
1262 | BL_INLINE void reset() noexcept { reset(0, 0); } |
1263 | |
1264 | //! Reset the range to [start, end). |
1265 | BL_INLINE void reset(size_t start, size_t end) noexcept { |
1266 | this->start = start; |
1267 | this->end = end; |
1268 | } |
1269 | |
1270 | BL_INLINE bool equals(const BLRange& other) const noexcept { |
1271 | return blEquals(this->start, other.start) & |
1272 | blEquals(this->end , other.end ) ; |
1273 | } |
1274 | |
1275 | BL_INLINE bool operator==(const BLRange& other) const noexcept { return equals(other); } |
1276 | BL_INLINE bool operator!=(const BLRange& other) const noexcept { return !equals(other); } |
1277 | |
1278 | BL_DIAGNOSTIC_POP |
1279 | #endif |
1280 | // -------------------------------------------------------------------------- |
1281 | }; |
1282 | |
1283 | //! \} |
1284 | |
1285 | // ============================================================================ |
1286 | // [BLCreateForeignInfo] |
1287 | // ============================================================================ |
1288 | |
1289 | //! \addtogroup blend2d_api_globals |
1290 | //! \{ |
1291 | |
1292 | //! Structure passed to a constructor (initializer) that provides foreign data |
1293 | //! that should be used to allocate its Impl (and data if it's a container). |
1294 | struct BLCreateForeignInfo { |
1295 | void* data; |
1296 | size_t size; |
1297 | BLDestroyImplFunc destroyFunc; |
1298 | void* destroyData; |
1299 | }; |
1300 | |
1301 | //! \} |
1302 | |
1303 | // ============================================================================ |
1304 | // [BLArrayView] |
1305 | // ============================================================================ |
1306 | |
1307 | //! \addtogroup blend2d_api_globals |
1308 | //! \{ |
1309 | |
1310 | #ifdef __cplusplus |
1311 | |
1312 | //! Array view of `T`. |
1313 | //! |
1314 | //! \note In C mode the type of data used by `BLArrayView` is `const void*`, |
1315 | //! thus it has to be retyped to a real type this view points to. There are |
1316 | //! only few specializations like `BLStringView` that point to a real type. |
1317 | template<typename T> |
1318 | struct BLArrayView { |
1319 | const T* data; |
1320 | size_t size; |
1321 | |
1322 | BL_INLINE void reset() noexcept { |
1323 | this->data = nullptr; |
1324 | this->size = 0; |
1325 | } |
1326 | |
1327 | BL_DIAGNOSTIC_PUSH(BL_DIAGNOSTIC_NO_SHADOW) |
1328 | BL_INLINE void reset(const T* data, size_t size) noexcept { |
1329 | this->data = data; |
1330 | this->size = size; |
1331 | } |
1332 | BL_DIAGNOSTIC_POP |
1333 | |
1334 | BL_INLINE const T* begin() const noexcept { return this->data; } |
1335 | BL_INLINE const T* end() const noexcept { return this->data + this->size; } |
1336 | }; |
1337 | |
1338 | // In C++ mode these are just typedefs of `BLArrayView<Type>`. |
1339 | |
1340 | //! View of char[] data used by String. |
1341 | typedef BLArrayView<char> BLStringView; |
1342 | |
1343 | //! View of BLBoxI[] data used by Region. |
1344 | typedef BLArrayView<BLBoxI> BLRegionView; |
1345 | |
1346 | //! View of untyped data. |
1347 | typedef BLArrayView<void> BLDataView; |
1348 | |
1349 | #else |
1350 | |
1351 | #define BL_DEFINE_ARRAY_VIEW(NAME, TYPE) \ |
1352 | typedef struct { \ |
1353 | const TYPE* data; \ |
1354 | size_t size; \ |
1355 | } NAME |
1356 | |
1357 | BL_DEFINE_ARRAY_VIEW(BLArrayView, void); |
1358 | BL_DEFINE_ARRAY_VIEW(BLStringView, char); |
1359 | BL_DEFINE_ARRAY_VIEW(BLRegionView, BLBoxI); |
1360 | |
1361 | typedef BLArrayView BLDataView; |
1362 | |
1363 | #undef BL_DEFINE_ARRAY_VIEW |
1364 | |
1365 | #endif |
1366 | |
1367 | //! \} |
1368 | |
1369 | // ============================================================================ |
1370 | // [C Interface - Core] |
1371 | // ============================================================================ |
1372 | |
1373 | //! \addtogroup blend2d_api_c_functions |
1374 | //! \{ |
1375 | |
1376 | #ifdef __cplusplus |
1377 | extern "C" { |
1378 | #endif |
1379 | |
1380 | //! \name BLArray |
1381 | //! |
1382 | //! Array functionality is provided by \ref BLArrayCore in C-API and wrapped by |
1383 | //! \ref BLArray template in C++ API. |
1384 | //! |
1385 | //! C API users must call either generic functions with `Item` suffix or correct |
1386 | //! specialized functions in case of typed arrays. For example if you create a |
1387 | //! `BLArray<uint32_t>` in C then you can only modify it through functions that |
1388 | //! have either `U32` or `Item` suffix. Arrays of signed types are treated as |
1389 | //! arrays of unsigned types at API level as there is no difference between them |
1390 | //! from implementation perspective. |
1391 | //! |
1392 | //! \{ |
1393 | BL_API BLResult BL_CDECL blArrayInit(BLArrayCore* self, uint32_t arrayTypeId) BL_NOEXCEPT_C; |
1394 | BL_API BLResult BL_CDECL blArrayReset(BLArrayCore* self) BL_NOEXCEPT_C; |
1395 | BL_API BLResult BL_CDECL blArrayCreateFromData(BLArrayCore* self, void* data, size_t size, size_t capacity, uint32_t dataAccessFlags, BLDestroyImplFunc destroyFunc, void* destroyData) BL_NOEXCEPT_C; |
1396 | BL_API size_t BL_CDECL blArrayGetSize(const BLArrayCore* self) BL_NOEXCEPT_C; |
1397 | BL_API size_t BL_CDECL blArrayGetCapacity(const BLArrayCore* self) BL_NOEXCEPT_C; |
1398 | BL_API const void* BL_CDECL blArrayGetData(const BLArrayCore* self) BL_NOEXCEPT_C; |
1399 | BL_API BLResult BL_CDECL blArrayClear(BLArrayCore* self) BL_NOEXCEPT_C; |
1400 | BL_API BLResult BL_CDECL blArrayShrink(BLArrayCore* self) BL_NOEXCEPT_C; |
1401 | BL_API BLResult BL_CDECL blArrayReserve(BLArrayCore* self, size_t n) BL_NOEXCEPT_C; |
1402 | BL_API BLResult BL_CDECL blArrayResize(BLArrayCore* self, size_t n, const void* fill) BL_NOEXCEPT_C; |
1403 | BL_API BLResult BL_CDECL blArrayMakeMutable(BLArrayCore* self, void** dataOut) BL_NOEXCEPT_C; |
1404 | BL_API BLResult BL_CDECL blArrayModifyOp(BLArrayCore* self, uint32_t op, size_t n, void** dataOut) BL_NOEXCEPT_C; |
1405 | BL_API BLResult BL_CDECL blArrayInsertOp(BLArrayCore* self, size_t index, size_t n, void** dataOut) BL_NOEXCEPT_C; |
1406 | BL_API BLResult BL_CDECL blArrayAssignMove(BLArrayCore* self, BLArrayCore* other) BL_NOEXCEPT_C; |
1407 | BL_API BLResult BL_CDECL blArrayAssignWeak(BLArrayCore* self, const BLArrayCore* other) BL_NOEXCEPT_C; |
1408 | BL_API BLResult BL_CDECL blArrayAssignDeep(BLArrayCore* self, const BLArrayCore* other) BL_NOEXCEPT_C; |
1409 | BL_API BLResult BL_CDECL blArrayAssignView(BLArrayCore* self, const void* items, size_t n) BL_NOEXCEPT_C; |
1410 | BL_API BLResult BL_CDECL blArrayAppendU8(BLArrayCore* self, uint8_t value) BL_NOEXCEPT_C; |
1411 | BL_API BLResult BL_CDECL blArrayAppendU16(BLArrayCore* self, uint16_t value) BL_NOEXCEPT_C; |
1412 | BL_API BLResult BL_CDECL blArrayAppendU32(BLArrayCore* self, uint32_t value) BL_NOEXCEPT_C; |
1413 | BL_API BLResult BL_CDECL blArrayAppendU64(BLArrayCore* self, uint64_t value) BL_NOEXCEPT_C; |
1414 | BL_API BLResult BL_CDECL blArrayAppendF32(BLArrayCore* self, float value) BL_NOEXCEPT_C; |
1415 | BL_API BLResult BL_CDECL blArrayAppendF64(BLArrayCore* self, double value) BL_NOEXCEPT_C; |
1416 | BL_API BLResult BL_CDECL blArrayAppendItem(BLArrayCore* self, const void* item) BL_NOEXCEPT_C; |
1417 | BL_API BLResult BL_CDECL blArrayAppendView(BLArrayCore* self, const void* items, size_t n) BL_NOEXCEPT_C; |
1418 | BL_API BLResult BL_CDECL blArrayInsertU8(BLArrayCore* self, size_t index, uint8_t value) BL_NOEXCEPT_C; |
1419 | BL_API BLResult BL_CDECL blArrayInsertU16(BLArrayCore* self, size_t index, uint16_t value) BL_NOEXCEPT_C; |
1420 | BL_API BLResult BL_CDECL blArrayInsertU32(BLArrayCore* self, size_t index, uint32_t value) BL_NOEXCEPT_C; |
1421 | BL_API BLResult BL_CDECL blArrayInsertU64(BLArrayCore* self, size_t index, uint64_t value) BL_NOEXCEPT_C; |
1422 | BL_API BLResult BL_CDECL blArrayInsertF32(BLArrayCore* self, size_t index, float value) BL_NOEXCEPT_C; |
1423 | BL_API BLResult BL_CDECL blArrayInsertF64(BLArrayCore* self, size_t index, double value) BL_NOEXCEPT_C; |
1424 | BL_API BLResult BL_CDECL blArrayInsertItem(BLArrayCore* self, size_t index, const void* item) BL_NOEXCEPT_C; |
1425 | BL_API BLResult BL_CDECL blArrayInsertView(BLArrayCore* self, size_t index, const void* items, size_t n) BL_NOEXCEPT_C; |
1426 | BL_API BLResult BL_CDECL blArrayReplaceU8(BLArrayCore* self, size_t index, uint8_t value) BL_NOEXCEPT_C; |
1427 | BL_API BLResult BL_CDECL blArrayReplaceU16(BLArrayCore* self, size_t index, uint16_t value) BL_NOEXCEPT_C; |
1428 | BL_API BLResult BL_CDECL blArrayReplaceU32(BLArrayCore* self, size_t index, uint32_t value) BL_NOEXCEPT_C; |
1429 | BL_API BLResult BL_CDECL blArrayReplaceU64(BLArrayCore* self, size_t index, uint64_t value) BL_NOEXCEPT_C; |
1430 | BL_API BLResult BL_CDECL blArrayReplaceF32(BLArrayCore* self, size_t index, float value) BL_NOEXCEPT_C; |
1431 | BL_API BLResult BL_CDECL blArrayReplaceF64(BLArrayCore* self, size_t index, double value) BL_NOEXCEPT_C; |
1432 | BL_API BLResult BL_CDECL blArrayReplaceItem(BLArrayCore* self, size_t index, const void* item) BL_NOEXCEPT_C; |
1433 | BL_API BLResult BL_CDECL blArrayReplaceView(BLArrayCore* self, size_t rStart, size_t rEnd, const void* items, size_t n) BL_NOEXCEPT_C; |
1434 | BL_API BLResult BL_CDECL blArrayRemoveIndex(BLArrayCore* self, size_t index) BL_NOEXCEPT_C; |
1435 | BL_API BLResult BL_CDECL blArrayRemoveRange(BLArrayCore* self, size_t rStart, size_t rEnd) BL_NOEXCEPT_C; |
1436 | BL_API bool BL_CDECL blArrayEquals(const BLArrayCore* a, const BLArrayCore* b) BL_NOEXCEPT_C; |
1437 | //! \} |
1438 | |
1439 | //! \name BLContext |
1440 | //! |
1441 | //! Rendering functionality is provided by \ref BLContextCore in C-API and |
1442 | //! wrapped by \ref BLContext in C++ API. |
1443 | //! |
1444 | //! \{ |
1445 | BL_API BLResult BL_CDECL blContextInit(BLContextCore* self) BL_NOEXCEPT_C; |
1446 | BL_API BLResult BL_CDECL blContextInitAs(BLContextCore* self, BLImageCore* image, const BLContextCreateInfo* options) BL_NOEXCEPT_C; |
1447 | BL_API BLResult BL_CDECL blContextReset(BLContextCore* self) BL_NOEXCEPT_C; |
1448 | BL_API BLResult BL_CDECL blContextAssignMove(BLContextCore* self, BLContextCore* other) BL_NOEXCEPT_C; |
1449 | BL_API BLResult BL_CDECL blContextAssignWeak(BLContextCore* self, const BLContextCore* other) BL_NOEXCEPT_C; |
1450 | BL_API BLResult BL_CDECL blContextGetType(const BLContextCore* self) BL_NOEXCEPT_C; |
1451 | BL_API BLResult BL_CDECL blContextBegin(BLContextCore* self, BLImageCore* image, const BLContextCreateInfo* options) BL_NOEXCEPT_C; |
1452 | BL_API BLResult BL_CDECL blContextEnd(BLContextCore* self) BL_NOEXCEPT_C; |
1453 | BL_API BLResult BL_CDECL blContextFlush(BLContextCore* self, uint32_t flags) BL_NOEXCEPT_C; |
1454 | BL_API BLResult BL_CDECL blContextSave(BLContextCore* self, BLContextCookie* cookie) BL_NOEXCEPT_C; |
1455 | BL_API BLResult BL_CDECL blContextRestore(BLContextCore* self, const BLContextCookie* cookie) BL_NOEXCEPT_C; |
1456 | BL_API BLResult BL_CDECL blContextGetMetaMatrix(const BLContextCore* self, BLMatrix2D* m) BL_NOEXCEPT_C; |
1457 | BL_API BLResult BL_CDECL blContextGetUserMatrix(const BLContextCore* self, BLMatrix2D* m) BL_NOEXCEPT_C; |
1458 | BL_API BLResult BL_CDECL blContextUserToMeta(BLContextCore* self) BL_NOEXCEPT_C; |
1459 | BL_API BLResult BL_CDECL blContextMatrixOp(BLContextCore* self, uint32_t opType, const void* opData) BL_NOEXCEPT_C; |
1460 | BL_API BLResult BL_CDECL blContextSetHint(BLContextCore* self, uint32_t hintType, uint32_t value) BL_NOEXCEPT_C; |
1461 | BL_API BLResult BL_CDECL blContextSetHints(BLContextCore* self, const BLContextHints* hints) BL_NOEXCEPT_C; |
1462 | BL_API BLResult BL_CDECL blContextSetFlattenMode(BLContextCore* self, uint32_t mode) BL_NOEXCEPT_C; |
1463 | BL_API BLResult BL_CDECL blContextSetFlattenTolerance(BLContextCore* self, double tolerance) BL_NOEXCEPT_C; |
1464 | BL_API BLResult BL_CDECL blContextSetApproximationOptions(BLContextCore* self, const BLApproximationOptions* options) BL_NOEXCEPT_C; |
1465 | BL_API BLResult BL_CDECL blContextSetCompOp(BLContextCore* self, uint32_t compOp) BL_NOEXCEPT_C; |
1466 | BL_API BLResult BL_CDECL blContextSetGlobalAlpha(BLContextCore* self, double alpha) BL_NOEXCEPT_C; |
1467 | BL_API BLResult BL_CDECL blContextSetFillAlpha(BLContextCore* self, double alpha) BL_NOEXCEPT_C; |
1468 | BL_API BLResult BL_CDECL blContextGetFillStyle(const BLContextCore* self, void* object) BL_NOEXCEPT_C; |
1469 | BL_API BLResult BL_CDECL blContextGetFillStyleRgba32(const BLContextCore* self, uint32_t* rgba32) BL_NOEXCEPT_C; |
1470 | BL_API BLResult BL_CDECL blContextGetFillStyleRgba64(const BLContextCore* self, uint64_t* rgba64) BL_NOEXCEPT_C; |
1471 | BL_API BLResult BL_CDECL blContextSetFillStyle(BLContextCore* self, const void* object) BL_NOEXCEPT_C; |
1472 | BL_API BLResult BL_CDECL blContextSetFillStyleRgba32(BLContextCore* self, uint32_t rgba32) BL_NOEXCEPT_C; |
1473 | BL_API BLResult BL_CDECL blContextSetFillStyleRgba64(BLContextCore* self, uint64_t rgba64) BL_NOEXCEPT_C; |
1474 | BL_API BLResult BL_CDECL blContextSetFillRule(BLContextCore* self, uint32_t fillRule) BL_NOEXCEPT_C; |
1475 | BL_API BLResult BL_CDECL blContextSetStrokeAlpha(BLContextCore* self, double alpha) BL_NOEXCEPT_C; |
1476 | BL_API BLResult BL_CDECL blContextGetStrokeStyle(const BLContextCore* self, void* object) BL_NOEXCEPT_C; |
1477 | BL_API BLResult BL_CDECL blContextGetStrokeStyleRgba32(const BLContextCore* self, uint32_t* rgba32) BL_NOEXCEPT_C; |
1478 | BL_API BLResult BL_CDECL blContextGetStrokeStyleRgba64(const BLContextCore* self, uint64_t* rgba64) BL_NOEXCEPT_C; |
1479 | BL_API BLResult BL_CDECL blContextSetStrokeStyle(BLContextCore* self, const void* object) BL_NOEXCEPT_C; |
1480 | BL_API BLResult BL_CDECL blContextSetStrokeStyleRgba32(BLContextCore* self, uint32_t rgba32) BL_NOEXCEPT_C; |
1481 | BL_API BLResult BL_CDECL blContextSetStrokeStyleRgba64(BLContextCore* self, uint64_t rgba64) BL_NOEXCEPT_C; |
1482 | BL_API BLResult BL_CDECL blContextSetStrokeWidth(BLContextCore* self, double width) BL_NOEXCEPT_C; |
1483 | BL_API BLResult BL_CDECL blContextSetStrokeMiterLimit(BLContextCore* self, double miterLimit) BL_NOEXCEPT_C; |
1484 | BL_API BLResult BL_CDECL blContextSetStrokeCap(BLContextCore* self, uint32_t position, uint32_t strokeCap) BL_NOEXCEPT_C; |
1485 | BL_API BLResult BL_CDECL blContextSetStrokeCaps(BLContextCore* self, uint32_t strokeCap) BL_NOEXCEPT_C; |
1486 | BL_API BLResult BL_CDECL blContextSetStrokeJoin(BLContextCore* self, uint32_t strokeJoin) BL_NOEXCEPT_C; |
1487 | BL_API BLResult BL_CDECL blContextSetStrokeDashOffset(BLContextCore* self, double dashOffset) BL_NOEXCEPT_C; |
1488 | BL_API BLResult BL_CDECL blContextSetStrokeDashArray(BLContextCore* self, const BLArrayCore* dashArray) BL_NOEXCEPT_C; |
1489 | BL_API BLResult BL_CDECL blContextSetStrokeTransformOrder(BLContextCore* self, uint32_t transformOrder) BL_NOEXCEPT_C; |
1490 | BL_API BLResult BL_CDECL blContextGetStrokeOptions(const BLContextCore* self, BLStrokeOptionsCore* options) BL_NOEXCEPT_C; |
1491 | BL_API BLResult BL_CDECL blContextSetStrokeOptions(BLContextCore* self, const BLStrokeOptionsCore* options) BL_NOEXCEPT_C; |
1492 | BL_API BLResult BL_CDECL blContextClipToRectI(BLContextCore* self, const BLRectI* rect) BL_NOEXCEPT_C; |
1493 | BL_API BLResult BL_CDECL blContextClipToRectD(BLContextCore* self, const BLRect* rect) BL_NOEXCEPT_C; |
1494 | BL_API BLResult BL_CDECL blContextRestoreClipping(BLContextCore* self) BL_NOEXCEPT_C; |
1495 | BL_API BLResult BL_CDECL blContextClearAll(BLContextCore* self) BL_NOEXCEPT_C; |
1496 | BL_API BLResult BL_CDECL blContextClearRectI(BLContextCore* self, const BLRectI* rect) BL_NOEXCEPT_C; |
1497 | BL_API BLResult BL_CDECL blContextClearRectD(BLContextCore* self, const BLRect* rect) BL_NOEXCEPT_C; |
1498 | BL_API BLResult BL_CDECL blContextFillAll(BLContextCore* self) BL_NOEXCEPT_C; |
1499 | BL_API BLResult BL_CDECL blContextFillRectI(BLContextCore* self, const BLRectI* rect) BL_NOEXCEPT_C; |
1500 | BL_API BLResult BL_CDECL blContextFillRectD(BLContextCore* self, const BLRect* rect) BL_NOEXCEPT_C; |
1501 | BL_API BLResult BL_CDECL blContextFillPathD(BLContextCore* self, const BLPathCore* path) BL_NOEXCEPT_C; |
1502 | BL_API BLResult BL_CDECL blContextFillGeometry(BLContextCore* self, uint32_t geometryType, const void* geometryData) BL_NOEXCEPT_C; |
1503 | BL_API BLResult BL_CDECL blContextFillTextI(BLContextCore* self, const BLPointI* pt, const BLFontCore* font, const void* text, size_t size, uint32_t encoding) BL_NOEXCEPT_C; |
1504 | BL_API BLResult BL_CDECL blContextFillTextD(BLContextCore* self, const BLPoint* pt, const BLFontCore* font, const void* text, size_t size, uint32_t encoding) BL_NOEXCEPT_C; |
1505 | BL_API BLResult BL_CDECL blContextFillGlyphRunI(BLContextCore* self, const BLPointI* pt, const BLFontCore* font, const BLGlyphRun* glyphRun) BL_NOEXCEPT_C; |
1506 | BL_API BLResult BL_CDECL blContextFillGlyphRunD(BLContextCore* self, const BLPoint* pt, const BLFontCore* font, const BLGlyphRun* glyphRun) BL_NOEXCEPT_C; |
1507 | BL_API BLResult BL_CDECL blContextStrokeRectI(BLContextCore* self, const BLRectI* rect) BL_NOEXCEPT_C; |
1508 | BL_API BLResult BL_CDECL blContextStrokeRectD(BLContextCore* self, const BLRect* rect) BL_NOEXCEPT_C; |
1509 | BL_API BLResult BL_CDECL blContextStrokePathD(BLContextCore* self, const BLPathCore* path) BL_NOEXCEPT_C; |
1510 | BL_API BLResult BL_CDECL blContextStrokeGeometry(BLContextCore* self, uint32_t geometryType, const void* geometryData) BL_NOEXCEPT_C; |
1511 | BL_API BLResult BL_CDECL blContextStrokeTextI(BLContextCore* self, const BLPointI* pt, const BLFontCore* font, const void* text, size_t size, uint32_t encoding) BL_NOEXCEPT_C; |
1512 | BL_API BLResult BL_CDECL blContextStrokeTextD(BLContextCore* self, const BLPoint* pt, const BLFontCore* font, const void* text, size_t size, uint32_t encoding) BL_NOEXCEPT_C; |
1513 | BL_API BLResult BL_CDECL blContextStrokeGlyphRunI(BLContextCore* self, const BLPointI* pt, const BLFontCore* font, const BLGlyphRun* glyphRun) BL_NOEXCEPT_C; |
1514 | BL_API BLResult BL_CDECL blContextStrokeGlyphRunD(BLContextCore* self, const BLPoint* pt, const BLFontCore* font, const BLGlyphRun* glyphRun) BL_NOEXCEPT_C; |
1515 | BL_API BLResult BL_CDECL blContextBlitImageI(BLContextCore* self, const BLPointI* pt, const BLImageCore* img, const BLRectI* imgArea) BL_NOEXCEPT_C; |
1516 | BL_API BLResult BL_CDECL blContextBlitImageD(BLContextCore* self, const BLPoint* pt, const BLImageCore* img, const BLRectI* imgArea) BL_NOEXCEPT_C; |
1517 | BL_API BLResult BL_CDECL blContextBlitScaledImageI(BLContextCore* self, const BLRectI* rect, const BLImageCore* img, const BLRectI* imgArea) BL_NOEXCEPT_C; |
1518 | BL_API BLResult BL_CDECL blContextBlitScaledImageD(BLContextCore* self, const BLRect* rect, const BLImageCore* img, const BLRectI* imgArea) BL_NOEXCEPT_C; |
1519 | //! \} |
1520 | |
1521 | //! \name BLFile |
1522 | //! |
1523 | //! File read/write functionality is provided by \ref BLFileCore in C-API and |
1524 | //! wrapped by \ref BLFile in C++ API. |
1525 | //! |
1526 | //! \{ |
1527 | BL_API BLResult BL_CDECL blFileInit(BLFileCore* self) BL_NOEXCEPT_C; |
1528 | BL_API BLResult BL_CDECL blFileReset(BLFileCore* self) BL_NOEXCEPT_C; |
1529 | BL_API BLResult BL_CDECL blFileOpen(BLFileCore* self, const char* fileName, uint32_t openFlags) BL_NOEXCEPT_C; |
1530 | BL_API BLResult BL_CDECL blFileClose(BLFileCore* self) BL_NOEXCEPT_C; |
1531 | BL_API BLResult BL_CDECL blFileSeek(BLFileCore* self, int64_t offset, uint32_t seekType, int64_t* positionOut) BL_NOEXCEPT_C; |
1532 | BL_API BLResult BL_CDECL blFileRead(BLFileCore* self, void* buffer, size_t n, size_t* bytesReadOut) BL_NOEXCEPT_C; |
1533 | BL_API BLResult BL_CDECL blFileWrite(BLFileCore* self, const void* buffer, size_t n, size_t* bytesWrittenOut) BL_NOEXCEPT_C; |
1534 | BL_API BLResult BL_CDECL blFileTruncate(BLFileCore* self, int64_t maxSize) BL_NOEXCEPT_C; |
1535 | BL_API BLResult BL_CDECL blFileGetSize(BLFileCore* self, uint64_t* fileSizeOut) BL_NOEXCEPT_C; |
1536 | //! \} |
1537 | |
1538 | //! \name BLFileSystem |
1539 | //! |
1540 | //! Filesystem API is provided by functions prefixed with `blFileSystem` and |
1541 | //! wrapped by \ref BLFileSystem namespace in C++ API. |
1542 | //! |
1543 | //! \{ |
1544 | BL_API BLResult BL_CDECL blFileSystemReadFile(const char* fileName, BLArrayCore* dst, size_t maxSize, uint32_t readFlags) BL_NOEXCEPT_C; |
1545 | BL_API BLResult BL_CDECL blFileSystemWriteFile(const char* fileName, const void* data, size_t size, size_t* bytesWrittenOut) BL_NOEXCEPT_C; |
1546 | //! \} |
1547 | |
1548 | //! \name BLFont |
1549 | //! |
1550 | //! Font functionality is provided by \ref BLFontCore in C-API and wrapped by |
1551 | //! \ref BLFont in C++ API. |
1552 | //! |
1553 | //! \{ |
1554 | BL_API BLResult BL_CDECL blFontInit(BLFontCore* self) BL_NOEXCEPT_C; |
1555 | BL_API BLResult BL_CDECL blFontReset(BLFontCore* self) BL_NOEXCEPT_C; |
1556 | BL_API BLResult BL_CDECL blFontAssignMove(BLFontCore* self, BLFontCore* other) BL_NOEXCEPT_C; |
1557 | BL_API BLResult BL_CDECL blFontAssignWeak(BLFontCore* self, const BLFontCore* other) BL_NOEXCEPT_C; |
1558 | BL_API bool BL_CDECL blFontEquals(const BLFontCore* a, const BLFontCore* b) BL_NOEXCEPT_C; |
1559 | BL_API BLResult BL_CDECL blFontCreateFromFace(BLFontCore* self, const BLFontFaceCore* face, float size) BL_NOEXCEPT_C; |
1560 | BL_API BLResult BL_CDECL blFontShape(const BLFontCore* self, BLGlyphBufferCore* gb) BL_NOEXCEPT_C; |
1561 | BL_API BLResult BL_CDECL blFontMapTextToGlyphs(const BLFontCore* self, BLGlyphBufferCore* gb, BLGlyphMappingState* stateOut) BL_NOEXCEPT_C; |
1562 | BL_API BLResult BL_CDECL blFontPositionGlyphs(const BLFontCore* self, BLGlyphBufferCore* gb, uint32_t positioningFlags) BL_NOEXCEPT_C; |
1563 | BL_API BLResult BL_CDECL blFontApplyKerning(const BLFontCore* self, BLGlyphBufferCore* gb) BL_NOEXCEPT_C; |
1564 | BL_API BLResult BL_CDECL blFontApplyGSub(const BLFontCore* self, BLGlyphBufferCore* gb, size_t index, BLBitWord lookups) BL_NOEXCEPT_C; |
1565 | BL_API BLResult BL_CDECL blFontApplyGPos(const BLFontCore* self, BLGlyphBufferCore* gb, size_t index, BLBitWord lookups) BL_NOEXCEPT_C; |
1566 | BL_API BLResult BL_CDECL blFontGetMatrix(const BLFontCore* self, BLFontMatrix* out) BL_NOEXCEPT_C; |
1567 | BL_API BLResult BL_CDECL blFontGetMetrics(const BLFontCore* self, BLFontMetrics* out) BL_NOEXCEPT_C; |
1568 | BL_API BLResult BL_CDECL blFontGetDesignMetrics(const BLFontCore* self, BLFontDesignMetrics* out) BL_NOEXCEPT_C; |
1569 | BL_API BLResult BL_CDECL blFontGetTextMetrics(const BLFontCore* self, BLGlyphBufferCore* gb, BLTextMetrics* out) BL_NOEXCEPT_C; |
1570 | BL_API BLResult BL_CDECL blFontGetGlyphBounds(const BLFontCore* self, const void* glyphIdData, intptr_t glyphIdAdvance, BLBoxI* out, size_t count) BL_NOEXCEPT_C; |
1571 | BL_API BLResult BL_CDECL blFontGetGlyphAdvances(const BLFontCore* self, const void* glyphIdData, intptr_t glyphIdAdvance, BLGlyphPlacement* out, size_t count) BL_NOEXCEPT_C; |
1572 | BL_API BLResult BL_CDECL blFontGetGlyphOutlines(const BLFontCore* self, uint32_t glyphId, const BLMatrix2D* userMatrix, BLPathCore* out, BLPathSinkFunc sink, void* closure) BL_NOEXCEPT_C; |
1573 | BL_API BLResult BL_CDECL blFontGetGlyphRunOutlines(const BLFontCore* self, const BLGlyphRun* glyphRun, const BLMatrix2D* userMatrix, BLPathCore* out, BLPathSinkFunc sink, void* closure) BL_NOEXCEPT_C; |
1574 | //! \} |
1575 | |
1576 | //! \name BLFontData |
1577 | //! |
1578 | //! Font-data functionality is provided by \ref BLFontDataCore in C-API and |
1579 | //! wrapped by \ref BLFontData in C++ API. |
1580 | //! |
1581 | //! \{ |
1582 | BL_API BLResult BL_CDECL blFontDataInit(BLFontDataCore* self) BL_NOEXCEPT_C; |
1583 | BL_API BLResult BL_CDECL blFontDataInitFromLoader(BLFontDataCore* self, const BLFontLoaderCore* loader, uint32_t faceIndex) BL_NOEXCEPT_C; |
1584 | BL_API BLResult BL_CDECL blFontDataReset(BLFontDataCore* self) BL_NOEXCEPT_C; |
1585 | BL_API BLResult BL_CDECL blFontDataAssignMove(BLFontDataCore* self, BLFontDataCore* other) BL_NOEXCEPT_C; |
1586 | BL_API BLResult BL_CDECL blFontDataAssignWeak(BLFontDataCore* self, const BLFontDataCore* other) BL_NOEXCEPT_C; |
1587 | BL_API BLResult BL_CDECL blFontDataCreateFromLoader(BLFontDataCore* self, const BLFontLoaderCore* loader, uint32_t faceIndex) BL_NOEXCEPT_C; |
1588 | BL_API bool BL_CDECL blFontDataEquals(const BLFontDataCore* a, const BLFontDataCore* b) BL_NOEXCEPT_C; |
1589 | BL_API BLResult BL_CDECL blFontDataListTags(const BLFontDataCore* self, BLArrayCore* dst) BL_NOEXCEPT_C; |
1590 | BL_API size_t BL_CDECL blFontDataQueryTables(const BLFontDataCore* self, BLFontTable* dst, const BLTag* tags, size_t count) BL_NOEXCEPT_C; |
1591 | //! \} |
1592 | |
1593 | //! \name BLFontFace |
1594 | //! |
1595 | //! Font-face functionality is provided by \ref BLFontFaceCore in C-API and |
1596 | //! wrapped by \ref BLFontFace in C++ API. |
1597 | //! |
1598 | //! \{ |
1599 | BL_API BLResult BL_CDECL blFontFaceInit(BLFontFaceCore* self) BL_NOEXCEPT_C; |
1600 | BL_API BLResult BL_CDECL blFontFaceReset(BLFontFaceCore* self) BL_NOEXCEPT_C; |
1601 | BL_API BLResult BL_CDECL blFontFaceAssignMove(BLFontFaceCore* self, BLFontFaceCore* other) BL_NOEXCEPT_C; |
1602 | BL_API BLResult BL_CDECL blFontFaceAssignWeak(BLFontFaceCore* self, const BLFontFaceCore* other) BL_NOEXCEPT_C; |
1603 | BL_API bool BL_CDECL blFontFaceEquals(const BLFontFaceCore* a, const BLFontFaceCore* b) BL_NOEXCEPT_C; |
1604 | BL_API BLResult BL_CDECL blFontFaceCreateFromFile(BLFontFaceCore* self, const char* fileName, uint32_t readFlags) BL_NOEXCEPT_C; |
1605 | BL_API BLResult BL_CDECL blFontFaceCreateFromLoader(BLFontFaceCore* self, const BLFontLoaderCore* loader, uint32_t faceIndex) BL_NOEXCEPT_C; |
1606 | BL_API BLResult BL_CDECL blFontFaceGetFaceInfo(const BLFontFaceCore* self, BLFontFaceInfo* out) BL_NOEXCEPT_C; |
1607 | BL_API BLResult BL_CDECL blFontFaceGetDesignMetrics(const BLFontFaceCore* self, BLFontDesignMetrics* out) BL_NOEXCEPT_C; |
1608 | BL_API BLResult BL_CDECL blFontFaceGetUnicodeCoverage(const BLFontFaceCore* self, BLFontUnicodeCoverage* out) BL_NOEXCEPT_C; |
1609 | //! \} |
1610 | |
1611 | //! \name BLFontLoader |
1612 | //! |
1613 | //! Font loading functionality is provided by \ref BLFontLoaderCore in C-API |
1614 | //! and wrapped by \ref BLFontLoader in C++ API. |
1615 | //! |
1616 | //! \{ |
1617 | BL_API BLResult BL_CDECL blFontLoaderInit(BLFontLoaderCore* self) BL_NOEXCEPT_C; |
1618 | BL_API BLResult BL_CDECL blFontLoaderReset(BLFontLoaderCore* self) BL_NOEXCEPT_C; |
1619 | BL_API BLResult BL_CDECL blFontLoaderAssignMove(BLFontLoaderCore* self, BLFontLoaderCore* other) BL_NOEXCEPT_C; |
1620 | BL_API BLResult BL_CDECL blFontLoaderAssignWeak(BLFontLoaderCore* self, const BLFontLoaderCore* other) BL_NOEXCEPT_C; |
1621 | BL_API bool BL_CDECL blFontLoaderEquals(const BLFontLoaderCore* a, const BLFontLoaderCore* b) BL_NOEXCEPT_C; |
1622 | BL_API BLResult BL_CDECL blFontLoaderCreateFromFile(BLFontLoaderCore* self, const char* fileName, uint32_t readFlags) BL_NOEXCEPT_C; |
1623 | BL_API BLResult BL_CDECL blFontLoaderCreateFromDataArray(BLFontLoaderCore* self, const BLArrayCore* dataArray) BL_NOEXCEPT_C; |
1624 | BL_API BLResult BL_CDECL blFontLoaderCreateFromData(BLFontLoaderCore* self, const void* data, size_t size, BLDestroyImplFunc destroyFunc, void* destroyData) BL_NOEXCEPT_C; |
1625 | //! \} |
1626 | |
1627 | //! \name BLFormat |
1628 | //! \{ |
1629 | BL_API BLResult BL_CDECL blFormatInfoSanitize(BLFormatInfo* self) BL_NOEXCEPT_C; |
1630 | //! \} |
1631 | |
1632 | //! \name BLGlyphBuffer |
1633 | //! |
1634 | //! Glyph-buffer functionality is provided by \ref BLGlyphBufferCore in C-API |
1635 | //! and wrapped by \ref BLGlyphBuffer in C++ API. |
1636 | //! |
1637 | //! \{ |
1638 | BL_API BLResult BL_CDECL blGlyphBufferInit(BLGlyphBufferCore* self) BL_NOEXCEPT_C; |
1639 | BL_API BLResult BL_CDECL blGlyphBufferReset(BLGlyphBufferCore* self) BL_NOEXCEPT_C; |
1640 | BL_API BLResult BL_CDECL blGlyphBufferClear(BLGlyphBufferCore* self) BL_NOEXCEPT_C; |
1641 | BL_API BLResult BL_CDECL blGlyphBufferSetText(BLGlyphBufferCore* self, const void* data, size_t size, uint32_t encoding) BL_NOEXCEPT_C; |
1642 | BL_API BLResult BL_CDECL blGlyphBufferSetGlyphIds(BLGlyphBufferCore* self, const void* data, intptr_t advance, size_t size) BL_NOEXCEPT_C; |
1643 | //! \} |
1644 | |
1645 | //! \name BLGradient |
1646 | //! |
1647 | //! Gradient container is provided by \ref BLGradientCore in C-API and wrapped |
1648 | //! by \ref BLGradient in C++ API. |
1649 | //! |
1650 | //! \{ |
1651 | BL_API BLResult BL_CDECL blGradientInit(BLGradientCore* self) BL_NOEXCEPT_C; |
1652 | BL_API BLResult BL_CDECL blGradientInitAs(BLGradientCore* self, uint32_t type, const void* values, uint32_t extendMode, const BLGradientStop* stops, size_t n, const BLMatrix2D* m) BL_NOEXCEPT_C; |
1653 | BL_API BLResult BL_CDECL blGradientReset(BLGradientCore* self) BL_NOEXCEPT_C; |
1654 | BL_API BLResult BL_CDECL blGradientAssignMove(BLGradientCore* self, BLGradientCore* other) BL_NOEXCEPT_C; |
1655 | BL_API BLResult BL_CDECL blGradientAssignWeak(BLGradientCore* self, const BLGradientCore* other) BL_NOEXCEPT_C; |
1656 | BL_API BLResult BL_CDECL blGradientCreate(BLGradientCore* self, uint32_t type, const void* values, uint32_t extendMode, const BLGradientStop* stops, size_t n, const BLMatrix2D* m) BL_NOEXCEPT_C; |
1657 | BL_API BLResult BL_CDECL blGradientShrink(BLGradientCore* self) BL_NOEXCEPT_C; |
1658 | BL_API BLResult BL_CDECL blGradientReserve(BLGradientCore* self, size_t n) BL_NOEXCEPT_C; |
1659 | BL_API uint32_t BL_CDECL blGradientGetType(const BLGradientCore* self) BL_NOEXCEPT_C; |
1660 | BL_API BLResult BL_CDECL blGradientSetType(BLGradientCore* self, uint32_t type) BL_NOEXCEPT_C; |
1661 | BL_API double BL_CDECL blGradientGetValue(const BLGradientCore* self, size_t index) BL_NOEXCEPT_C; |
1662 | BL_API BLResult BL_CDECL blGradientSetValue(BLGradientCore* self, size_t index, double value) BL_NOEXCEPT_C; |
1663 | BL_API BLResult BL_CDECL blGradientSetValues(BLGradientCore* self, size_t index, const double* values, size_t n) BL_NOEXCEPT_C; |
1664 | BL_API uint32_t BL_CDECL blGradientGetExtendMode(BLGradientCore* self) BL_NOEXCEPT_C; |
1665 | BL_API BLResult BL_CDECL blGradientSetExtendMode(BLGradientCore* self, uint32_t extendMode) BL_NOEXCEPT_C; |
1666 | BL_API const BLGradientStop* BL_CDECL blGradientGetStops(const BLGradientCore* self) BL_NOEXCEPT_C; |
1667 | BL_API size_t BL_CDECL blGradientGetSize(const BLGradientCore* self) BL_NOEXCEPT_C; |
1668 | BL_API size_t BL_CDECL blGradientGetCapacity(const BLGradientCore* self) BL_NOEXCEPT_C; |
1669 | BL_API BLResult BL_CDECL blGradientResetStops(BLGradientCore* self) BL_NOEXCEPT_C; |
1670 | BL_API BLResult BL_CDECL blGradientAssignStops(BLGradientCore* self, const BLGradientStop* stops, size_t n) BL_NOEXCEPT_C; |
1671 | BL_API BLResult BL_CDECL blGradientAddStopRgba32(BLGradientCore* self, double offset, uint32_t argb32) BL_NOEXCEPT_C; |
1672 | BL_API BLResult BL_CDECL blGradientAddStopRgba64(BLGradientCore* self, double offset, uint64_t argb64) BL_NOEXCEPT_C; |
1673 | BL_API BLResult BL_CDECL blGradientRemoveStop(BLGradientCore* self, size_t index) BL_NOEXCEPT_C; |
1674 | BL_API BLResult BL_CDECL blGradientRemoveStopByOffset(BLGradientCore* self, double offset, uint32_t all) BL_NOEXCEPT_C; |
1675 | BL_API BLResult BL_CDECL blGradientRemoveStops(BLGradientCore* self, size_t rStart, size_t rEnd) BL_NOEXCEPT_C; |
1676 | BL_API BLResult BL_CDECL blGradientRemoveStopsFromTo(BLGradientCore* self, double offsetMin, double offsetMax) BL_NOEXCEPT_C; |
1677 | BL_API BLResult BL_CDECL blGradientReplaceStopRgba32(BLGradientCore* self, size_t index, double offset, uint32_t rgba32) BL_NOEXCEPT_C; |
1678 | BL_API BLResult BL_CDECL blGradientReplaceStopRgba64(BLGradientCore* self, size_t index, double offset, uint64_t rgba64) BL_NOEXCEPT_C; |
1679 | BL_API size_t BL_CDECL blGradientIndexOfStop(const BLGradientCore* self, double offset) BL_NOEXCEPT_C; |
1680 | BL_API BLResult BL_CDECL blGradientApplyMatrixOp(BLGradientCore* self, uint32_t opType, const void* opData) BL_NOEXCEPT_C; |
1681 | BL_API bool BL_CDECL blGradientEquals(const BLGradientCore* a, const BLGradientCore* b) BL_NOEXCEPT_C; |
1682 | //! \} |
1683 | |
1684 | //! \name BLImage |
1685 | //! |
1686 | //! Image container is provided by \ref BLImageCore in C-API and wrapped by |
1687 | //! \ref BLImage in C++ API. |
1688 | //! |
1689 | //! \{ |
1690 | BL_API BLResult BL_CDECL blImageInit(BLImageCore* self) BL_NOEXCEPT_C; |
1691 | BL_API BLResult BL_CDECL blImageInitAs(BLImageCore* self, int w, int h, uint32_t format) BL_NOEXCEPT_C; |
1692 | BL_API BLResult BL_CDECL blImageInitAsFromData(BLImageCore* self, int w, int h, uint32_t format, void* pixelData, intptr_t stride, BLDestroyImplFunc destroyFunc, void* destroyData) BL_NOEXCEPT_C; |
1693 | BL_API BLResult BL_CDECL blImageReset(BLImageCore* self) BL_NOEXCEPT_C; |
1694 | BL_API BLResult BL_CDECL blImageAssignMove(BLImageCore* self, BLImageCore* other) BL_NOEXCEPT_C; |
1695 | BL_API BLResult BL_CDECL blImageAssignWeak(BLImageCore* self, const BLImageCore* other) BL_NOEXCEPT_C; |
1696 | BL_API BLResult BL_CDECL blImageAssignDeep(BLImageCore* self, const BLImageCore* other) BL_NOEXCEPT_C; |
1697 | BL_API BLResult BL_CDECL blImageCreate(BLImageCore* self, int w, int h, uint32_t format) BL_NOEXCEPT_C; |
1698 | BL_API BLResult BL_CDECL blImageCreateFromData(BLImageCore* self, int w, int h, uint32_t format, void* pixelData, intptr_t stride, BLDestroyImplFunc destroyFunc, void* destroyData) BL_NOEXCEPT_C; |
1699 | BL_API BLResult BL_CDECL blImageGetData(const BLImageCore* self, BLImageData* dataOut) BL_NOEXCEPT_C; |
1700 | BL_API BLResult BL_CDECL blImageMakeMutable(BLImageCore* self, BLImageData* dataOut) BL_NOEXCEPT_C; |
1701 | BL_API bool BL_CDECL blImageEquals(const BLImageCore* a, const BLImageCore* b) BL_NOEXCEPT_C; |
1702 | BL_API BLResult BL_CDECL blImageScale(BLImageCore* dst, const BLImageCore* src, const BLSizeI* size, uint32_t filter, const BLImageScaleOptions* options) BL_NOEXCEPT_C; |
1703 | BL_API BLResult BL_CDECL blImageReadFromFile(BLImageCore* self, const char* fileName, const BLArrayCore* codecs) BL_NOEXCEPT_C; |
1704 | BL_API BLResult BL_CDECL blImageReadFromData(BLImageCore* self, const void* data, size_t size, const BLArrayCore* codecs) BL_NOEXCEPT_C; |
1705 | BL_API BLResult BL_CDECL blImageWriteToFile(const BLImageCore* self, const char* fileName, const BLImageCodecCore* codec) BL_NOEXCEPT_C; |
1706 | BL_API BLResult BL_CDECL blImageWriteToData(const BLImageCore* self, BLArrayCore* dst, const BLImageCodecCore* codec) BL_NOEXCEPT_C; |
1707 | //! \} |
1708 | |
1709 | //! \name BLImageCodec |
1710 | //! |
1711 | //! Image codec functionality is provided by \ref BLImageCodecCore in C-API and |
1712 | //! wrapped by \ref BLImageCodec in C++ API. |
1713 | //! |
1714 | //! \{ |
1715 | BL_API BLResult BL_CDECL blImageCodecInit(BLImageCodecCore* self) BL_NOEXCEPT_C; |
1716 | BL_API BLResult BL_CDECL blImageCodecReset(BLImageCodecCore* self) BL_NOEXCEPT_C; |
1717 | BL_API BLResult BL_CDECL blImageCodecAssignWeak(BLImageCodecCore* self, const BLImageCodecCore* other) BL_NOEXCEPT_C; |
1718 | BL_API BLResult BL_CDECL blImageCodecFindByName(BLImageCodecCore* self, const char* name, size_t size, const BLArrayCore* codecs) BL_NOEXCEPT_C; |
1719 | BL_API BLResult BL_CDECL blImageCodecFindByData(BLImageCodecCore* self, const void* data, size_t size, const BLArrayCore* codecs) BL_NOEXCEPT_C; |
1720 | BL_API uint32_t BL_CDECL blImageCodecInspectData(const BLImageCodecCore* self, const void* data, size_t size) BL_NOEXCEPT_C; |
1721 | BL_API BLResult BL_CDECL blImageCodecCreateDecoder(const BLImageCodecCore* self, BLImageDecoderCore* dst) BL_NOEXCEPT_C; |
1722 | BL_API BLResult BL_CDECL blImageCodecCreateEncoder(const BLImageCodecCore* self, BLImageEncoderCore* dst) BL_NOEXCEPT_C; |
1723 | |
1724 | BL_API BLResult BL_CDECL blImageCodecArrayInitBuiltInCodecs(BLArrayCore* self) BL_NOEXCEPT_C; |
1725 | BL_API BLResult BL_CDECL blImageCodecArrayAssignBuiltInCodecs(BLArrayCore* self) BL_NOEXCEPT_C; |
1726 | BL_API BLResult BL_CDECL blImageCodecAddToBuiltIn(const BLImageCodecCore* codec) BL_NOEXCEPT_C; |
1727 | BL_API BLResult BL_CDECL blImageCodecRemoveFromBuiltIn(const BLImageCodecCore* codec) BL_NOEXCEPT_C; |
1728 | //! \} |
1729 | |
1730 | //! \name BLImageDecoder |
1731 | //! |
1732 | //! Image decoder functionality is provided by \ref BLImageDecoderCore in C-API |
1733 | //! and wrapped by \ref BLImageDecoder in C++ API. |
1734 | //! |
1735 | //! \{ |
1736 | BL_API BLResult BL_CDECL blImageDecoderInit(BLImageDecoderCore* self) BL_NOEXCEPT_C; |
1737 | BL_API BLResult BL_CDECL blImageDecoderReset(BLImageDecoderCore* self) BL_NOEXCEPT_C; |
1738 | BL_API BLResult BL_CDECL blImageDecoderAssignMove(BLImageDecoderCore* self, BLImageDecoderCore* other) BL_NOEXCEPT_C; |
1739 | BL_API BLResult BL_CDECL blImageDecoderAssignWeak(BLImageDecoderCore* self, const BLImageDecoderCore* other) BL_NOEXCEPT_C; |
1740 | BL_API BLResult BL_CDECL blImageDecoderRestart(BLImageDecoderCore* self) BL_NOEXCEPT_C; |
1741 | BL_API BLResult BL_CDECL blImageDecoderReadInfo(BLImageDecoderCore* self, BLImageInfo* infoOut, const uint8_t* data, size_t size) BL_NOEXCEPT_C; |
1742 | BL_API BLResult BL_CDECL blImageDecoderReadFrame(BLImageDecoderCore* self, BLImageCore* imageOut, const uint8_t* data, size_t size) BL_NOEXCEPT_C; |
1743 | //! \} |
1744 | |
1745 | //! \name BLImageEncoder |
1746 | //! |
1747 | //! Image encoder functionality is provided by \ref BLImageEncoderCore in C-API |
1748 | //! and wrapped by \ref BLImageEncoder in C++ API. |
1749 | //! |
1750 | //! \{ |
1751 | BL_API BLResult BL_CDECL blImageEncoderInit(BLImageEncoderCore* self) BL_NOEXCEPT_C; |
1752 | BL_API BLResult BL_CDECL blImageEncoderReset(BLImageEncoderCore* self) BL_NOEXCEPT_C; |
1753 | BL_API BLResult BL_CDECL blImageEncoderAssignMove(BLImageEncoderCore* self, BLImageEncoderCore* other) BL_NOEXCEPT_C; |
1754 | BL_API BLResult BL_CDECL blImageEncoderAssignWeak(BLImageEncoderCore* self, const BLImageEncoderCore* other) BL_NOEXCEPT_C; |
1755 | BL_API BLResult BL_CDECL blImageEncoderRestart(BLImageEncoderCore* self) BL_NOEXCEPT_C; |
1756 | BL_API BLResult BL_CDECL blImageEncoderWriteFrame(BLImageEncoderCore* self, BLArrayCore* dst, const BLImageCore* image) BL_NOEXCEPT_C; |
1757 | //! \} |
1758 | |
1759 | //! \name BLMatrix2D |
1760 | //! |
1761 | //! Matrix functionality is provided by \ref BLMatrix2D, C++ API adds methods to |
1762 | //! the struct when compiling in C++ mode. |
1763 | //! |
1764 | //! \{ |
1765 | BL_API BLResult BL_CDECL blMatrix2DSetIdentity(BLMatrix2D* self) BL_NOEXCEPT_C; |
1766 | BL_API BLResult BL_CDECL blMatrix2DSetTranslation(BLMatrix2D* self, double x, double y) BL_NOEXCEPT_C; |
1767 | BL_API BLResult BL_CDECL blMatrix2DSetScaling(BLMatrix2D* self, double x, double y) BL_NOEXCEPT_C; |
1768 | BL_API BLResult BL_CDECL blMatrix2DSetSkewing(BLMatrix2D* self, double x, double y) BL_NOEXCEPT_C; |
1769 | BL_API BLResult BL_CDECL blMatrix2DSetRotation(BLMatrix2D* self, double angle, double cx, double cy) BL_NOEXCEPT_C; |
1770 | BL_API BLResult BL_CDECL blMatrix2DApplyOp(BLMatrix2D* self, uint32_t opType, const void* opData) BL_NOEXCEPT_C; |
1771 | BL_API BLResult BL_CDECL blMatrix2DInvert(BLMatrix2D* dst, const BLMatrix2D* src) BL_NOEXCEPT_C; |
1772 | BL_API uint32_t BL_CDECL blMatrix2DGetType(const BLMatrix2D* self) BL_NOEXCEPT_C; |
1773 | BL_API BLResult BL_CDECL blMatrix2DMapPointDArray(const BLMatrix2D* self, BLPoint* dst, const BLPoint* src, size_t count) BL_NOEXCEPT_C; |
1774 | //! \} |
1775 | |
1776 | //! \name BLPath |
1777 | //! |
1778 | //! 2D path functionality is provided by \ref BLPathCore in C-API and wrapped |
1779 | //! by \ref BLPath in C++ API. |
1780 | //! |
1781 | //! \{ |
1782 | BL_API BLResult BL_CDECL blPathInit(BLPathCore* self) BL_NOEXCEPT_C; |
1783 | BL_API BLResult BL_CDECL blPathReset(BLPathCore* self) BL_NOEXCEPT_C; |
1784 | BL_API size_t BL_CDECL blPathGetSize(const BLPathCore* self) BL_NOEXCEPT_C; |
1785 | BL_API size_t BL_CDECL blPathGetCapacity(const BLPathCore* self) BL_NOEXCEPT_C; |
1786 | BL_API const uint8_t* BL_CDECL blPathGetCommandData(const BLPathCore* self) BL_NOEXCEPT_C; |
1787 | BL_API const BLPoint* BL_CDECL blPathGetVertexData(const BLPathCore* self) BL_NOEXCEPT_C; |
1788 | BL_API BLResult BL_CDECL blPathClear(BLPathCore* self) BL_NOEXCEPT_C; |
1789 | BL_API BLResult BL_CDECL blPathShrink(BLPathCore* self) BL_NOEXCEPT_C; |
1790 | BL_API BLResult BL_CDECL blPathReserve(BLPathCore* self, size_t n) BL_NOEXCEPT_C; |
1791 | BL_API BLResult BL_CDECL blPathModifyOp(BLPathCore* self, uint32_t op, size_t n, uint8_t** cmdDataOut, BLPoint** vtxDataOut) BL_NOEXCEPT_C; |
1792 | BL_API BLResult BL_CDECL blPathAssignMove(BLPathCore* self, BLPathCore* other) BL_NOEXCEPT_C; |
1793 | BL_API BLResult BL_CDECL blPathAssignWeak(BLPathCore* self, const BLPathCore* other) BL_NOEXCEPT_C; |
1794 | BL_API BLResult BL_CDECL blPathAssignDeep(BLPathCore* self, const BLPathCore* other) BL_NOEXCEPT_C; |
1795 | BL_API BLResult BL_CDECL blPathSetVertexAt(BLPathCore* self, size_t index, uint32_t cmd, double x, double y) BL_NOEXCEPT_C; |
1796 | BL_API BLResult BL_CDECL blPathMoveTo(BLPathCore* self, double x0, double y0) BL_NOEXCEPT_C; |
1797 | BL_API BLResult BL_CDECL blPathLineTo(BLPathCore* self, double x1, double y1) BL_NOEXCEPT_C; |
1798 | BL_API BLResult BL_CDECL blPathPolyTo(BLPathCore* self, const BLPoint* poly, size_t count) BL_NOEXCEPT_C; |
1799 | BL_API BLResult BL_CDECL blPathQuadTo(BLPathCore* self, double x1, double y1, double x2, double y2) BL_NOEXCEPT_C; |
1800 | BL_API BLResult BL_CDECL blPathCubicTo(BLPathCore* self, double x1, double y1, double x2, double y2, double x3, double y3) BL_NOEXCEPT_C; |
1801 | BL_API BLResult BL_CDECL blPathSmoothQuadTo(BLPathCore* self, double x2, double y2) BL_NOEXCEPT_C; |
1802 | BL_API BLResult BL_CDECL blPathSmoothCubicTo(BLPathCore* self, double x2, double y2, double x3, double y3) BL_NOEXCEPT_C; |
1803 | BL_API BLResult BL_CDECL blPathArcTo(BLPathCore* self, double x, double y, double rx, double ry, double start, double sweep, bool forceMoveTo) BL_NOEXCEPT_C; |
1804 | BL_API BLResult BL_CDECL blPathArcQuadrantTo(BLPathCore* self, double x1, double y1, double x2, double y2) BL_NOEXCEPT_C; |
1805 | BL_API BLResult BL_CDECL blPathEllipticArcTo(BLPathCore* self, double rx, double ry, double xAxisRotation, bool largeArcFlag, bool sweepFlag, double x1, double y1) BL_NOEXCEPT_C; |
1806 | BL_API BLResult BL_CDECL blPathClose(BLPathCore* self) BL_NOEXCEPT_C; |
1807 | BL_API BLResult BL_CDECL blPathAddGeometry(BLPathCore* self, uint32_t geometryType, const void* geometryData, const BLMatrix2D* m, uint32_t dir) BL_NOEXCEPT_C; |
1808 | BL_API BLResult BL_CDECL blPathAddBoxI(BLPathCore* self, const BLBoxI* box, uint32_t dir) BL_NOEXCEPT_C; |
1809 | BL_API BLResult BL_CDECL blPathAddBoxD(BLPathCore* self, const BLBox* box, uint32_t dir) BL_NOEXCEPT_C; |
1810 | BL_API BLResult BL_CDECL blPathAddRectI(BLPathCore* self, const BLRectI* rect, uint32_t dir) BL_NOEXCEPT_C; |
1811 | BL_API BLResult BL_CDECL blPathAddRectD(BLPathCore* self, const BLRect* rect, uint32_t dir) BL_NOEXCEPT_C; |
1812 | BL_API BLResult BL_CDECL blPathAddPath(BLPathCore* self, const BLPathCore* other, const BLRange* range) BL_NOEXCEPT_C; |
1813 | BL_API BLResult BL_CDECL blPathAddTranslatedPath(BLPathCore* self, const BLPathCore* other, const BLRange* range, const BLPoint* p) BL_NOEXCEPT_C; |
1814 | BL_API BLResult BL_CDECL blPathAddTransformedPath(BLPathCore* self, const BLPathCore* other, const BLRange* range, const BLMatrix2D* m) BL_NOEXCEPT_C; |
1815 | BL_API BLResult BL_CDECL blPathAddReversedPath(BLPathCore* self, const BLPathCore* other, const BLRange* range, uint32_t reverseMode) BL_NOEXCEPT_C; |
1816 | BL_API BLResult BL_CDECL blPathAddStrokedPath(BLPathCore* self, const BLPathCore* other, const BLRange* range, const BLStrokeOptionsCore* options, const BLApproximationOptions* approx) BL_NOEXCEPT_C; |
1817 | BL_API BLResult BL_CDECL blPathTranslate(BLPathCore* self, const BLRange* range, const BLPoint* p) BL_NOEXCEPT_C; |
1818 | BL_API BLResult BL_CDECL blPathTransform(BLPathCore* self, const BLRange* range, const BLMatrix2D* m) BL_NOEXCEPT_C; |
1819 | BL_API BLResult BL_CDECL blPathFitTo(BLPathCore* self, const BLRange* range, const BLRect* rect, uint32_t fitFlags) BL_NOEXCEPT_C; |
1820 | BL_API bool BL_CDECL blPathEquals(const BLPathCore* a, const BLPathCore* b) BL_NOEXCEPT_C; |
1821 | BL_API BLResult BL_CDECL blPathGetInfoFlags(const BLPathCore* self, uint32_t* flagsOut) BL_NOEXCEPT_C; |
1822 | BL_API BLResult BL_CDECL blPathGetControlBox(const BLPathCore* self, BLBox* boxOut) BL_NOEXCEPT_C; |
1823 | BL_API BLResult BL_CDECL blPathGetBoundingBox(const BLPathCore* self, BLBox* boxOut) BL_NOEXCEPT_C; |
1824 | BL_API BLResult BL_CDECL blPathGetFigureRange(const BLPathCore* self, size_t index, BLRange* rangeOut) BL_NOEXCEPT_C; |
1825 | BL_API BLResult BL_CDECL blPathGetLastVertex(const BLPathCore* self, BLPoint* vtxOut) BL_NOEXCEPT_C; |
1826 | BL_API BLResult BL_CDECL blPathGetClosestVertex(const BLPathCore* self, const BLPoint* p, double maxDistance, size_t* indexOut, double* distanceOut) BL_NOEXCEPT_C; |
1827 | BL_API uint32_t BL_CDECL blPathHitTest(const BLPathCore* self, const BLPoint* p, uint32_t fillRule) BL_NOEXCEPT_C; |
1828 | //! \} |
1829 | |
1830 | //! \name BLPattern |
1831 | //! |
1832 | //! Pattern functionality is provided by \ref BLPatternCore in C-API and |
1833 | //! wrapped by \ref BLPattern in C++ API. |
1834 | //! |
1835 | //! \{ |
1836 | BL_API BLResult BL_CDECL blPatternInit(BLPatternCore* self) BL_NOEXCEPT_C; |
1837 | BL_API BLResult BL_CDECL blPatternInitAs(BLPatternCore* self, const BLImageCore* image, const BLRectI* area, uint32_t extendMode, const BLMatrix2D* m) BL_NOEXCEPT_C; |
1838 | BL_API BLResult BL_CDECL blPatternReset(BLPatternCore* self) BL_NOEXCEPT_C; |
1839 | BL_API BLResult BL_CDECL blPatternAssignMove(BLPatternCore* self, BLPatternCore* other) BL_NOEXCEPT_C; |
1840 | BL_API BLResult BL_CDECL blPatternAssignWeak(BLPatternCore* self, const BLPatternCore* other) BL_NOEXCEPT_C; |
1841 | BL_API BLResult BL_CDECL blPatternAssignDeep(BLPatternCore* self, const BLPatternCore* other) BL_NOEXCEPT_C; |
1842 | BL_API BLResult BL_CDECL blPatternCreate(BLPatternCore* self, const BLImageCore* image, const BLRectI* area, uint32_t extendMode, const BLMatrix2D* m) BL_NOEXCEPT_C; |
1843 | BL_API BLResult BL_CDECL blPatternSetImage(BLPatternCore* self, const BLImageCore* image, const BLRectI* area) BL_NOEXCEPT_C; |
1844 | BL_API BLResult BL_CDECL blPatternSetArea(BLPatternCore* self, const BLRectI* area) BL_NOEXCEPT_C; |
1845 | BL_API BLResult BL_CDECL blPatternSetExtendMode(BLPatternCore* self, uint32_t extendMode) BL_NOEXCEPT_C; |
1846 | BL_API BLResult BL_CDECL blPatternApplyMatrixOp(BLPatternCore* self, uint32_t opType, const void* opData) BL_NOEXCEPT_C; |
1847 | BL_API bool BL_CDECL blPatternEquals(const BLPatternCore* a, const BLPatternCore* b) BL_NOEXCEPT_C; |
1848 | //! \} |
1849 | |
1850 | //! \name BLPixelConverter |
1851 | //! |
1852 | //! Pixel conversion functionality is provided by \ref BLPixelConverterCore |
1853 | //! in C-API and wrapped by \ref BLPixelConverter in C++ API. |
1854 | //! |
1855 | //! \{ |
1856 | BL_API BLResult BL_CDECL blPixelConverterInit(BLPixelConverterCore* self) BL_NOEXCEPT_C; |
1857 | BL_API BLResult BL_CDECL blPixelConverterInitWeak(BLPixelConverterCore* self, const BLPixelConverterCore* other) BL_NOEXCEPT_C; |
1858 | BL_API BLResult BL_CDECL blPixelConverterReset(BLPixelConverterCore* self) BL_NOEXCEPT_C; |
1859 | BL_API BLResult BL_CDECL blPixelConverterAssign(BLPixelConverterCore* self, const BLPixelConverterCore* other) BL_NOEXCEPT_C; |
1860 | BL_API BLResult BL_CDECL blPixelConverterCreate(BLPixelConverterCore* self, const BLFormatInfo* dstInfo, const BLFormatInfo* srcInfo) BL_NOEXCEPT_C; |
1861 | |
1862 | BL_API BLResult BL_CDECL blPixelConverterConvert(const BLPixelConverterCore* self, |
1863 | void* dstData, intptr_t dstStride, |
1864 | const void* srcData, intptr_t srcStride, |
1865 | uint32_t w, uint32_t h, const BLPixelConverterOptions* options) BL_NOEXCEPT_C; |
1866 | //! \} |
1867 | |
1868 | //! \name BLRandom |
1869 | //! \{ |
1870 | BL_API void BL_CDECL blRandomReset(BLRandom* self, uint64_t seed) BL_NOEXCEPT_C; |
1871 | BL_API uint32_t BL_CDECL blRandomNextUInt32(BLRandom* self) BL_NOEXCEPT_C; |
1872 | BL_API uint64_t BL_CDECL blRandomNextUInt64(BLRandom* self) BL_NOEXCEPT_C; |
1873 | BL_API double BL_CDECL blRandomNextDouble(BLRandom* self) BL_NOEXCEPT_C; |
1874 | //! \} |
1875 | |
1876 | //! \name BLRegion |
1877 | //! |
1878 | //! 2D region functionality is provided by \ref BLRegionCore in C-API and |
1879 | //! wrapped by \ref BLRegion in C++ API. |
1880 | //! |
1881 | //! \{ |
1882 | BL_API BLResult BL_CDECL blRegionInit(BLRegionCore* self) BL_NOEXCEPT_C; |
1883 | BL_API BLResult BL_CDECL blRegionReset(BLRegionCore* self) BL_NOEXCEPT_C; |
1884 | BL_API BLResult BL_CDECL blRegionClear(BLRegionCore* self) BL_NOEXCEPT_C; |
1885 | BL_API BLResult BL_CDECL blRegionShrink(BLRegionCore* self) BL_NOEXCEPT_C; |
1886 | BL_API BLResult BL_CDECL blRegionReserve(BLRegionCore* self, size_t n) BL_NOEXCEPT_C; |
1887 | BL_API BLResult BL_CDECL blRegionAssignMove(BLRegionCore* self, BLRegionCore* other) BL_NOEXCEPT_C; |
1888 | BL_API BLResult BL_CDECL blRegionAssignWeak(BLRegionCore* self, const BLRegionCore* other) BL_NOEXCEPT_C; |
1889 | BL_API BLResult BL_CDECL blRegionAssignDeep(BLRegionCore* self, const BLRegionCore* other) BL_NOEXCEPT_C; |
1890 | BL_API BLResult BL_CDECL blRegionAssignBoxI(BLRegionCore* self, const BLBoxI* src) BL_NOEXCEPT_C; |
1891 | BL_API BLResult BL_CDECL blRegionAssignBoxIArray(BLRegionCore* self, const BLBoxI* data, size_t n) BL_NOEXCEPT_C; |
1892 | BL_API BLResult BL_CDECL blRegionAssignRectI(BLRegionCore* self, const BLRectI* rect) BL_NOEXCEPT_C; |
1893 | BL_API BLResult BL_CDECL blRegionAssignRectIArray(BLRegionCore* self, const BLRectI* data, size_t n) BL_NOEXCEPT_C; |
1894 | BL_API BLResult BL_CDECL blRegionCombine(BLRegionCore* self, const BLRegionCore* a, const BLRegionCore* b, uint32_t op) BL_NOEXCEPT_C; |
1895 | BL_API BLResult BL_CDECL blRegionCombineRB(BLRegionCore* self, const BLRegionCore* a, const BLBoxI* b, uint32_t op) BL_NOEXCEPT_C; |
1896 | BL_API BLResult BL_CDECL blRegionCombineBR(BLRegionCore* self, const BLBoxI* a, const BLRegionCore* b, uint32_t op) BL_NOEXCEPT_C; |
1897 | BL_API BLResult BL_CDECL blRegionCombineBB(BLRegionCore* self, const BLBoxI* a, const BLBoxI* b, uint32_t op) BL_NOEXCEPT_C; |
1898 | BL_API BLResult BL_CDECL blRegionTranslate(BLRegionCore* self, const BLRegionCore* r, const BLPointI* pt) BL_NOEXCEPT_C; |
1899 | BL_API BLResult BL_CDECL blRegionTranslateAndClip(BLRegionCore* self, const BLRegionCore* r, const BLPointI* pt, const BLBoxI* clipBox) BL_NOEXCEPT_C; |
1900 | BL_API BLResult BL_CDECL blRegionIntersectAndClip(BLRegionCore* self, const BLRegionCore* a, const BLRegionCore* b, const BLBoxI* clipBox) BL_NOEXCEPT_C; |
1901 | BL_API bool BL_CDECL blRegionEquals(const BLRegionCore* a, const BLRegionCore* b) BL_NOEXCEPT_C; |
1902 | BL_API uint32_t BL_CDECL blRegionGetType(const BLRegionCore* self) BL_NOEXCEPT_C; |
1903 | BL_API uint32_t BL_CDECL blRegionHitTest(const BLRegionCore* self, const BLPointI* pt) BL_NOEXCEPT_C; |
1904 | BL_API uint32_t BL_CDECL blRegionHitTestBoxI(const BLRegionCore* self, const BLBoxI* box) BL_NOEXCEPT_C; |
1905 | //! \} |
1906 | |
1907 | //! \name BLRuntime |
1908 | //! |
1909 | //! Blend2D runtime functions are provided either as a C-API or wrapped by |
1910 | //! \ref BLRuntime namespace in C++ API. |
1911 | //! |
1912 | //! \{ |
1913 | BL_API BLResult BL_CDECL blRuntimeInit() BL_NOEXCEPT_C; |
1914 | BL_API BLResult BL_CDECL blRuntimeShutdown() BL_NOEXCEPT_C; |
1915 | BL_API BLResult BL_CDECL blRuntimeCleanup(uint32_t cleanupFlags) BL_NOEXCEPT_C; |
1916 | BL_API BLResult BL_CDECL blRuntimeQueryInfo(uint32_t infoType, void* infoOut) BL_NOEXCEPT_C; |
1917 | BL_API BLResult BL_CDECL blRuntimeMessageOut(const char* msg) BL_NOEXCEPT_C; |
1918 | BL_API BLResult BL_CDECL blRuntimeMessageFmt(const char* fmt, ...) BL_NOEXCEPT_C; |
1919 | BL_API BLResult BL_CDECL blRuntimeMessageVFmt(const char* fmt, va_list ap) BL_NOEXCEPT_C; |
1920 | BL_API uint32_t BL_CDECL blRuntimeGetTickCount(void) BL_NOEXCEPT_C; |
1921 | |
1922 | BL_API BL_NORETURN void BL_CDECL blRuntimeAssertionFailure(const char* file, int line, const char* msg) BL_NOEXCEPT_C; |
1923 | |
1924 | #ifdef _WIN32 |
1925 | BL_API BLResult BL_CDECL blResultFromWinError(uint32_t e) BL_NOEXCEPT_C; |
1926 | #else |
1927 | BL_API BLResult BL_CDECL blResultFromPosixError(int e) BL_NOEXCEPT_C; |
1928 | #endif |
1929 | //! \} |
1930 | |
1931 | //! \name BLString |
1932 | //! |
1933 | //! String contanter is provided by \ref BLStringCore in C-API and wrapped by |
1934 | //! \ref BLString in C++ API. |
1935 | //! |
1936 | //! \{ |
1937 | BL_API BLResult BL_CDECL blStringInit(BLStringCore* self) BL_NOEXCEPT_C; |
1938 | BL_API BLResult BL_CDECL blStringReset(BLStringCore* self) BL_NOEXCEPT_C; |
1939 | BL_API size_t BL_CDECL blStringGetSize(const BLStringCore* self) BL_NOEXCEPT_C; |
1940 | BL_API size_t BL_CDECL blStringGetCapacity(const BLStringCore* self) BL_NOEXCEPT_C; |
1941 | BL_API const char* BL_CDECL blStringGetData(const BLStringCore* self) BL_NOEXCEPT_C; |
1942 | BL_API BLResult BL_CDECL blStringClear(BLStringCore* self) BL_NOEXCEPT_C; |
1943 | BL_API BLResult BL_CDECL blStringShrink(BLStringCore* self) BL_NOEXCEPT_C; |
1944 | BL_API BLResult BL_CDECL blStringReserve(BLStringCore* self, size_t n) BL_NOEXCEPT_C; |
1945 | BL_API BLResult BL_CDECL blStringResize(BLStringCore* self, size_t n, char fill) BL_NOEXCEPT_C; |
1946 | BL_API BLResult BL_CDECL blStringMakeMutable(BLStringCore* self, char** dataOut) BL_NOEXCEPT_C; |
1947 | BL_API BLResult BL_CDECL blStringModifyOp(BLStringCore* self, uint32_t op, size_t n, char** dataOut) BL_NOEXCEPT_C; |
1948 | BL_API BLResult BL_CDECL blStringInsertOp(BLStringCore* self, size_t index, size_t n, char** dataOut) BL_NOEXCEPT_C; |
1949 | BL_API BLResult BL_CDECL blStringAssignMove(BLStringCore* self, BLStringCore* other) BL_NOEXCEPT_C; |
1950 | BL_API BLResult BL_CDECL blStringAssignWeak(BLStringCore* self, const BLStringCore* other) BL_NOEXCEPT_C; |
1951 | BL_API BLResult BL_CDECL blStringAssignDeep(BLStringCore* self, const BLStringCore* other) BL_NOEXCEPT_C; |
1952 | BL_API BLResult BL_CDECL blStringAssignData(BLStringCore* self, const char* str, size_t n) BL_NOEXCEPT_C; |
1953 | BL_API BLResult BL_CDECL blStringApplyOpChar(BLStringCore* self, uint32_t op, char c, size_t n) BL_NOEXCEPT_C; |
1954 | BL_API BLResult BL_CDECL blStringApplyOpData(BLStringCore* self, uint32_t op, const char* str, size_t n) BL_NOEXCEPT_C; |
1955 | BL_API BLResult BL_CDECL blStringApplyOpString(BLStringCore* self, uint32_t op, const BLStringCore* other) BL_NOEXCEPT_C; |
1956 | BL_API BLResult BL_CDECL blStringApplyOpFormat(BLStringCore* self, uint32_t op, const char* fmt, ...) BL_NOEXCEPT_C; |
1957 | BL_API BLResult BL_CDECL blStringApplyOpFormatV(BLStringCore* self, uint32_t op, const char* fmt, va_list ap) BL_NOEXCEPT_C; |
1958 | BL_API BLResult BL_CDECL blStringInsertChar(BLStringCore* self, size_t index, char c, size_t n) BL_NOEXCEPT_C; |
1959 | BL_API BLResult BL_CDECL blStringInsertData(BLStringCore* self, size_t index, const char* str, size_t n) BL_NOEXCEPT_C; |
1960 | BL_API BLResult BL_CDECL blStringInsertString(BLStringCore* self, size_t index, const BLStringCore* other) BL_NOEXCEPT_C; |
1961 | BL_API BLResult BL_CDECL blStringRemoveRange(BLStringCore* self, size_t rStart, size_t rEnd) BL_NOEXCEPT_C; |
1962 | BL_API bool BL_CDECL blStringEquals(const BLStringCore* self, const BLStringCore* other) BL_NOEXCEPT_C; |
1963 | BL_API bool BL_CDECL blStringEqualsData(const BLStringCore* self, const char* str, size_t n) BL_NOEXCEPT_C; |
1964 | BL_API int BL_CDECL blStringCompare(const BLStringCore* self, const BLStringCore* other) BL_NOEXCEPT_C; |
1965 | BL_API int BL_CDECL blStringCompareData(const BLStringCore* self, const char* str, size_t n) BL_NOEXCEPT_C; |
1966 | //! \} |
1967 | |
1968 | //! \name BLStrokeOptions |
1969 | //! |
1970 | //! Stroke options are provided by \ref BLStrokeOptionsCore in C-API and |
1971 | //! wrapped by \ref BLStrokeOptions in C++ API. |
1972 | //! |
1973 | //! \{ |
1974 | BL_API BLResult BL_CDECL blStrokeOptionsInit(BLStrokeOptionsCore* self) BL_NOEXCEPT_C; |
1975 | BL_API BLResult BL_CDECL blStrokeOptionsInitMove(BLStrokeOptionsCore* self, BLStrokeOptionsCore* other) BL_NOEXCEPT_C; |
1976 | BL_API BLResult BL_CDECL blStrokeOptionsInitWeak(BLStrokeOptionsCore* self, const BLStrokeOptionsCore* other) BL_NOEXCEPT_C; |
1977 | BL_API BLResult BL_CDECL blStrokeOptionsReset(BLStrokeOptionsCore* self) BL_NOEXCEPT_C; |
1978 | BL_API BLResult BL_CDECL blStrokeOptionsAssignMove(BLStrokeOptionsCore* self, BLStrokeOptionsCore* other) BL_NOEXCEPT_C; |
1979 | BL_API BLResult BL_CDECL blStrokeOptionsAssignWeak(BLStrokeOptionsCore* self, const BLStrokeOptionsCore* other) BL_NOEXCEPT_C; |
1980 | //! \} |
1981 | |
1982 | //! \name BLVariant |
1983 | //! |
1984 | //! Variant C-API can be used on any object compatible with Blend2D Impl, at |
1985 | //! the moment only \ref BLStrokeOptionsCore and \ref BLGlyphBufferCore are |
1986 | //! not compatible, all others are. |
1987 | //! |
1988 | //! \{ |
1989 | BL_API BLResult BL_CDECL blVariantInit(void* self) BL_NOEXCEPT_C; |
1990 | BL_API BLResult BL_CDECL blVariantInitMove(void* self, void* other) BL_NOEXCEPT_C; |
1991 | BL_API BLResult BL_CDECL blVariantInitWeak(void* self, const void* other) BL_NOEXCEPT_C; |
1992 | BL_API BLResult BL_CDECL blVariantReset(void* self) BL_NOEXCEPT_C; |
1993 | BL_API uint32_t BL_CDECL blVariantGetImplType(const void* self) BL_NOEXCEPT_C; |
1994 | BL_API BLResult BL_CDECL blVariantAssignMove(void* self, void* other) BL_NOEXCEPT_C; |
1995 | BL_API BLResult BL_CDECL blVariantAssignWeak(void* self, const void* other) BL_NOEXCEPT_C; |
1996 | BL_API bool BL_CDECL blVariantEquals(const void* a, const void* b) BL_NOEXCEPT_C; |
1997 | //! \} |
1998 | |
1999 | #ifdef __cplusplus |
2000 | } // {Extern:C} |
2001 | #endif |
2002 | |
2003 | //! \} |
2004 | |
2005 | #endif // BLEND2D_BLAPI_H |
2006 | |