odin-blend2d

Odin bindings to Blend2D
Log | Files | Refs | README | LICENSE

context.odin (46482B)


      1 // This file is part of Blend2D project <https://blend2d.com>
      2 //
      3 // See blend2d.h or LICENSE.md for license and copyright information
      4 // SPDX-License-Identifier: Zlib
      5 package blend2d
      6 
      7 import "core:c"
      8 
      9 when ODIN_OS == .Windows {
     10 	foreign import lib "blend2d.lib"
     11 } else when ODIN_OS == .Darwin {
     12 	foreign import lib "libblend2d.a"
     13 } else when ODIN_OS == .Linux {
     14 	foreign import lib "libblend2d.a"
     15 }
     16 
     17 
     18 //! Rendering context type.
     19 ContextType :: enum u32 {
     20 	//! No rendering context.
     21 	NONE       = 0,
     22 
     23 	//! Dummy rendering context.
     24 	DUMMY      = 1,
     25 
     26 	/*
     27 	//! Proxy rendering context.
     28 	BL_CONTEXT_TYPE_PROXY = 2,
     29 	*/
     30 	
     31 	//! Software-accelerated rendering context.
     32 	RASTER     = 3,
     33 
     34 	//! Maximum value of `BLContextType`.
     35 	MAX_VALUE  = 3,
     36 	FORCE_UINT = 4294967295,
     37 }
     38 
     39 //! Rendering context hint.
     40 ContextHint :: enum u32 {
     41 	//! Rendering quality.
     42 	RENDERING_QUALITY = 0,
     43 
     44 	//! Gradient quality.
     45 	GRADIENT_QUALITY  = 1,
     46 
     47 	//! Pattern quality.
     48 	PATTERN_QUALITY   = 2,
     49 
     50 	//! Maximum value of `BLContextHint`.
     51 	MAX_VALUE         = 7,
     52 	FORCE_UINT        = 4294967295,
     53 }
     54 
     55 //! Describes a rendering context style slot - fill or stroke.
     56 ContextStyleSlot :: enum u32 {
     57 	//! Fill operation style slot.
     58 	FILL       = 0,
     59 
     60 	//! Stroke operation style slot.
     61 	STROKE     = 1,
     62 
     63 	//! Maximum value of `BLContextStyleSlot`
     64 	MAX_VALUE  = 1,
     65 	FORCE_UINT = 4294967295,
     66 }
     67 
     68 //! The type of a text rendering operation.
     69 //!
     70 //! This value specifies the type of the parameter passed to the text rendering API.
     71 //!
     72 //! \note In most cases this should not be required to use by Blend2D users. The C API provides functions that
     73 //! wrap all of the text operations and C++ API provides functions that use `BLContextRenderTextOp` internally.
     74 ContextRenderTextOp :: enum u32 {
     75 	//! UTF-8 text rendering operation - UTF-8 string passed as \ref BLStringView or \ref BLArrayView<uint8_t>.
     76 	UTF8            = 0,
     77 
     78 	//! UTF-16 text rendering operation - UTF-16 string passed as \ref BLArrayView<uint16_t>.
     79 	UTF16           = 1,
     80 
     81 	//! UTF-32 text rendering operation - UTF-32 string passed as \ref BLArrayView<uint32_t>.
     82 	UTF32           = 2,
     83 
     84 	//! LATIN1 text rendering operation - LATIN1 string is passed as \ref BLStringView or \ref BLArrayView<uint8_t>.
     85 	LATIN1          = 3,
     86 
     87 	//! `wchar_t` text rendering operation - wchar_t string is passed as \ref BLArrayView<wchar_t>.
     88 	WCHAR           = 2,
     89 
     90 	//! Glyph run text rendering operation - the \ref BLGlyphRun parameter is passed.
     91 	GLYPH_RUN       = 4,
     92 
     93 	//! Maximum value of `BLContextRenderTextInputType`
     94 	MAX_VALUE       = 4,
     95 	TYPE_FORCE_UINT = 4294967295,
     96 }
     97 
     98 //! Rendering context flush flags, used by \ref BLContext::flush().
     99 ContextFlushFlags :: enum u32 {
    100 	NO_FLAGS   = 0,
    101 
    102 	//! Flushes the command queue and waits for its completion (will block until done).
    103 	SYNC       = 2147483648,
    104 	FORCE_UINT = 4294967295,
    105 }
    106 
    107 //! Rendering context creation flags.
    108 ContextCreateFlags :: enum u32 {
    109 	//! No flags.
    110 	NO_FLAGS                   = 0,
    111 
    112 	//! Disables JIT pipeline generator.
    113 	FLAG_DISABLE_JIT           = 1,
    114 
    115 	//! Fallbacks to a synchronous rendering in case that the rendering engine wasn't able to acquire threads. This
    116 	//! flag only makes sense when the asynchronous mode was specified by having `thread_count` greater than 0. If the
    117 	//! rendering context fails to acquire at least one thread it would fallback to synchronous mode with no worker
    118 	//! threads.
    119 	//!
    120 	//! \note If this flag is specified with `thread_count == 1` it means to immediately fallback to synchronous
    121 	//! rendering. It's only practical to use this flag with 2 or more requested threads.
    122 	FLAG_FALLBACK_TO_SYNC      = 1048576,
    123 
    124 	//! If this flag is specified and asynchronous rendering is enabled then the context would create its own isolated
    125 	//! thread-pool, which is useful for debugging purposes.
    126 	//!
    127 	//! Do not use this flag in production as rendering contexts with isolated thread-pool have to create and destroy all
    128 	//! threads they use. This flag is only useful for testing, debugging, and isolated benchmarking.
    129 	FLAG_ISOLATED_THREAD_POOL  = 16777216,
    130 
    131 	//! If this flag is specified and JIT pipeline generation enabled then the rendering context would create its own
    132 	//! isolated JIT runtime. which is useful for debugging purposes. This flag will be ignored if JIT pipeline
    133 	//! compilation is either not supported or was disabled by other flags.
    134 	//!
    135 	//! Do not use this flag in production as rendering contexts with isolated JIT runtime do not use global pipeline
    136 	//! cache, that's it, after the rendering context is destroyed the JIT runtime is destroyed with it with all
    137 	//! compiled pipelines. This flag is only useful for testing, debugging, and isolated benchmarking.
    138 	FLAG_ISOLATED_JIT_RUNTIME  = 33554432,
    139 
    140 	//! Enables logging to stderr of isolated runtime.
    141 	//!
    142 	//! \note Must be used with \ref BL_CONTEXT_CREATE_FLAG_ISOLATED_JIT_RUNTIME otherwise it would have no effect.
    143 	FLAG_ISOLATED_JIT_LOGGING  = 67108864,
    144 
    145 	//! Override CPU features when creating isolated context.
    146 	FLAG_OVERRIDE_CPU_FEATURES = 134217728,
    147 	FLAG_FORCE_UINT            = 4294967295,
    148 }
    149 
    150 //! Error flags that are accumulated during the rendering context lifetime and that can be queried through
    151 //! \ref BLContext::accumulated_error_flags(). The reason why these flags exist is that errors can happen during
    152 //! asynchronous rendering, and there is no way the user can catch these errors.
    153 ContextErrorFlags :: enum u32 {
    154 	//! No flags.
    155 	NO_FLAGS                   = 0,
    156 
    157 	//! The rendering context returned or encountered \ref BL_ERROR_INVALID_VALUE, which is mostly related to
    158 	//! the function argument handling. It's very likely some argument was wrong when calling \ref BLContext API.
    159 	FLAG_INVALID_VALUE         = 1,
    160 
    161 	//! Invalid state describes something wrong, for example a pipeline compilation error.
    162 	FLAG_INVALID_STATE         = 2,
    163 
    164 	//! The rendering context has encountered invalid geometry.
    165 	FLAG_INVALID_GEOMETRY      = 4,
    166 
    167 	//! The rendering context has encountered invalid glyph.
    168 	FLAG_INVALID_GLYPH         = 8,
    169 
    170 	//! The rendering context has encountered invalid or uninitialized font.
    171 	FLAG_INVALID_FONT          = 16,
    172 
    173 	//! Thread pool was exhausted and couldn't acquire the requested number of threads.
    174 	FLAG_THREAD_POOL_EXHAUSTED = 536870912,
    175 
    176 	//! Out of memory condition.
    177 	FLAG_OUT_OF_MEMORY         = 1073741824,
    178 
    179 	//! Unknown error, which we don't have flag for.
    180 	FLAG_UNKNOWN_ERROR         = 2147483648,
    181 	FLAG_FORCE_UINT            = 4294967295,
    182 }
    183 
    184 //! Specifies the behavior of \ref BLContext::swap_styles() operation.
    185 ContextStyleSwapMode :: enum u32 {
    186 	//! Swap only fill and stroke styles without affecting fill and stroke alpha.
    187 	STYLES            = 0,
    188 
    189 	//! Swap both fill and stroke styles and their alpha values.
    190 	STYLES_WITH_ALPHA = 1,
    191 
    192 	//! Maximum value of `BLContextStyleSwapMode`.
    193 	MAX_VALUE         = 1,
    194 	FORCE_UINT        = 4294967295,
    195 }
    196 
    197 //! Specifies how style transformation matrix is combined with the rendering context transformation matrix, used by
    198 //! \ref BLContext::set_style() function.
    199 ContextStyleTransformMode :: enum u32 {
    200 	//! Style transformation matrix should be transformed with the rendering context user and meta matrix (default).
    201 	//!
    202 	//! \note This transformation mode is identical to how user geometry is transformed and it's the default
    203 	//! transformation and most likely the behavior expected in most cases.
    204 	USER       = 0,
    205 
    206 	//! Style transformation matrix should be transformed with the rendering context meta matrix.
    207 	META       = 1,
    208 
    209 	//! Style transformation matrix is considered absolute, and is not combined with a rendering context transform.
    210 	NONE       = 2,
    211 
    212 	//! Maximum value of `BLContextStyleTransformMode`.
    213 	MAX_VALUE  = 2,
    214 	FORCE_UINT = 4294967295,
    215 }
    216 
    217 //! Clip mode.
    218 ClipMode :: enum u32 {
    219 	//! Clipping to a rectangle that is aligned to the pixel grid.
    220 	ALIGNED_RECT   = 0,
    221 
    222 	//! Clipping to a rectangle that is not aligned to pixel grid.
    223 	UNALIGNED_RECT = 1,
    224 
    225 	//! Clipping to a non-rectangular area that is defined by using mask.
    226 	MASK           = 2,
    227 
    228 	//! Count of clip modes.
    229 	COUNT          = 3,
    230 	FORCE_UINT     = 4294967295,
    231 }
    232 
    233 //! Composition & blending operator.
    234 CompOp :: enum u32 {
    235 	//! Source-over [default].
    236 	SRC_OVER     = 0,
    237 
    238 	//! Source-copy.
    239 	SRC_COPY     = 1,
    240 
    241 	//! Source-in.
    242 	SRC_IN       = 2,
    243 
    244 	//! Source-out.
    245 	SRC_OUT      = 3,
    246 
    247 	//! Source-atop.
    248 	SRC_ATOP     = 4,
    249 
    250 	//! Destination-over.
    251 	DST_OVER     = 5,
    252 
    253 	//! Destination-copy [nop].
    254 	DST_COPY     = 6,
    255 
    256 	//! Destination-in.
    257 	DST_IN       = 7,
    258 
    259 	//! Destination-out.
    260 	DST_OUT      = 8,
    261 
    262 	//! Destination-atop.
    263 	DST_ATOP     = 9,
    264 
    265 	//! Xor.
    266 	XOR          = 10,
    267 
    268 	//! Clear.
    269 	CLEAR        = 11,
    270 
    271 	//! Plus.
    272 	PLUS         = 12,
    273 
    274 	//! Minus.
    275 	MINUS        = 13,
    276 
    277 	//! Modulate.
    278 	MODULATE     = 14,
    279 
    280 	//! Multiply.
    281 	MULTIPLY     = 15,
    282 
    283 	//! Screen.
    284 	SCREEN       = 16,
    285 
    286 	//! Overlay.
    287 	OVERLAY      = 17,
    288 
    289 	//! Darken.
    290 	DARKEN       = 18,
    291 
    292 	//! Lighten.
    293 	LIGHTEN      = 19,
    294 
    295 	//! Color dodge.
    296 	COLOR_DODGE  = 20,
    297 
    298 	//! Color burn.
    299 	COLOR_BURN   = 21,
    300 
    301 	//! Linear burn.
    302 	LINEAR_BURN  = 22,
    303 
    304 	//! Linear light.
    305 	LINEAR_LIGHT = 23,
    306 
    307 	//! Pin light.
    308 	PIN_LIGHT    = 24,
    309 
    310 	//! Hard-light.
    311 	HARD_LIGHT   = 25,
    312 
    313 	//! Soft-light.
    314 	SOFT_LIGHT   = 26,
    315 
    316 	//! Difference.
    317 	DIFFERENCE   = 27,
    318 
    319 	//! Exclusion.
    320 	EXCLUSION    = 28,
    321 
    322 	//! Count of composition & blending operators.
    323 	MAX_VALUE    = 28,
    324 	FORCE_UINT   = 4294967295,
    325 }
    326 
    327 //! Rendering quality.
    328 RenderingQuality :: enum u32 {
    329 	//! Render using anti-aliasing.
    330 	ANTIALIAS  = 0,
    331 
    332 	//! Maximum value of `BLRenderingQuality`.
    333 	MAX_VALUE  = 0,
    334 	FORCE_UINT = 4294967295,
    335 }
    336 
    337 //! Information that can be used to customize the rendering context.
    338 ContextCreateInfo :: struct {
    339 	//! Create flags, see \ref BLContextCreateFlags.
    340 	flags: u32,
    341 
    342 	//! Number of worker threads to use for asynchronous rendering, if non-zero.
    343 	//!
    344 	//! If `thread_count` is zero it means to initialize the context for synchronous rendering. This means that every
    345 	//! operation will take effect immediately. If `thread_count` is `1` it means that the rendering will be asynchronous,
    346 	//! but no thread would be acquired from a thread-pool, because the user thread will be used as a worker. And
    347 	//! finally, if `thread_count` is greater than `1` then total of `thread_count - 1` threads will be acquired from
    348 	//! thread-pool and used as additional workers.
    349 	thread_count: u32,
    350 
    351 	//! CPU features to use in isolated JIT runtime (if supported), only used when `flags` contains
    352 	//! \ref BL_CONTEXT_CREATE_FLAG_OVERRIDE_CPU_FEATURES.
    353 	cpu_features: u32,
    354 
    355 	//! Maximum number of commands to be queued.
    356 	//!
    357 	//! If this parameter is zero the queue size will be determined automatically.
    358 	//!
    359 	//! TODO: To be documented, has no effect at the moment.
    360 	command_queue_limit: u32,
    361 
    362 	//! Maximum number of saved states.
    363 	//!
    364 	//! \note Zero value tells the rendering engine to use the default saved state limit, which currently defaults
    365 	//! to 4096 states. This option allows to even increase or decrease the limit, depending on the use case.
    366 	saved_state_limit: u32,
    367 
    368 	//! Pixel origin.
    369 	//!
    370 	//! Pixel origin is an offset in pixel units that can be used as an origin for fetchers and effects that use a pixel
    371 	//! X/Y coordinate in the calculation. One example of using pixel origin is dithering, where it's used to shift the
    372 	//! dithering matrix.
    373 	pixel_origin: PointI,
    374 
    375 	//! Reserved for future use, must be zero.
    376 	reserved: [1]u32,
    377 }
    378 
    379 //! Holds an arbitrary 128-bit value (cookie) that can be used to match other cookies. Blend2D uses cookies in places
    380 //! where it allows to "lock" some state that can only be unlocked by a matching cookie. Please don't confuse cookies
    381 //! with a security of any kind, it's just an arbitrary data that must match to proceed with a certain operation.
    382 //!
    383 //! Cookies can be used with \ref BLContext::save() and \ref BLContext::restore() operations.
    384 ContextCookie :: struct {
    385 	data: [2]u64,
    386 }
    387 
    388 //! Rendering context hints.
    389 ContextHints :: struct {
    390 	using _: struct #raw_union {
    391 		using _: struct {
    392 			rendering_quality: u8,
    393 			gradient_quality:  u8,
    394 			pattern_quality:   u8,
    395 		},
    396 
    397 		hints: [8]u8,
    398 	},
    399 }
    400 
    401 //! Rendering context [C API].
    402 ContextCore :: struct {
    403 	_d: ObjectDetail,
    404 }
    405 
    406 //! \cond INTERNAL
    407 //! Rendering context [Virtual Function Table].
    408 ContextVirt :: struct {
    409 	base: ObjectVirtBase,
    410 
    411 	// Interface - Most Used Functions
    412 	// -------------------------------
    413 	
    414 	// NOTE 1: These functions are called directly by the BLContext C++ API (the dispatch is inlined). So in general
    415 	// on x86 targets the compiler will generate something like `call [base + offset]` instruction to perform the call.
    416 	// We want to have the most used functions first as these would use 8-bit offset instead of 32-bit offset. We have
    417 	// space for 12 functions as 8-bit offset is signed (from -128 to 127) and the BLObjectVirt already uses 3 functions.
    418 	//
    419 	// NOTE 2: On non-X86 platforms such as AArch64 we don't have to worry about offsets as the instruction would be
    420 	// encoded in 32-bits regardless of the offset.
    421 	apply_transform_op:  proc "c" (impl: ^ContextImpl, op_type: TransformOp, op_data: rawptr) -> Result,
    422 	fill_rect_i:         proc "c" (impl: ^ContextImpl, rect: ^RectI) -> Result,
    423 	fill_rect_i_rgba32:  proc "c" (impl: ^ContextImpl, rect: ^RectI, rgba32: u32) -> Result,
    424 	fill_rect_i_ext:     proc "c" (impl: ^ContextImpl, rect: ^RectI, style: ^ObjectCore) -> Result,
    425 	fill_rect_d:         proc "c" (impl: ^ContextImpl, rect: ^Rect) -> Result,
    426 	fill_rect_d_rgba32:  proc "c" (impl: ^ContextImpl, rect: ^Rect, rgba32: u32) -> Result,
    427 	fill_rect_d_ext:     proc "c" (impl: ^ContextImpl, rect: ^Rect, style: ^ObjectCore) -> Result,
    428 	fill_path_d:         proc "c" (impl: ^ContextImpl, origin: ^Point, path: ^PathCore) -> Result,
    429 	fill_path_d_rgba32:  proc "c" (impl: ^ContextImpl, origin: ^Point, path: ^PathCore, rgba32: u32) -> Result,
    430 	fill_path_d_ext:     proc "c" (impl: ^ContextImpl, origin: ^Point, path: ^PathCore, style: ^ObjectCore) -> Result,
    431 	blit_image_i:        proc "c" (impl: ^ContextImpl, origin: ^PointI, img: ^ImageCore, img_area: ^RectI) -> Result,
    432 	blit_scaled_image_i: proc "c" (impl: ^ContextImpl, rect: ^RectI, img: ^ImageCore, img_area: ^RectI) -> Result,
    433 
    434 	// Interface
    435 	// ---------
    436 	flush:                      proc "c" (impl: ^ContextImpl, flags: ContextFlushFlags) -> Result,
    437 	save:                       proc "c" (impl: ^ContextImpl, cookie: ^ContextCookie) -> Result,
    438 	restore:                    proc "c" (impl: ^ContextImpl, cookie: ^ContextCookie) -> Result,
    439 	user_to_meta:               proc "c" (impl: ^ContextImpl) -> Result,
    440 	set_hint:                   proc "c" (impl: ^ContextImpl, hint_type: ContextHint, value: u32) -> Result,
    441 	set_hints:                  proc "c" (impl: ^ContextImpl, hints: ^ContextHints) -> Result,
    442 	set_flatten_mode:           proc "c" (impl: ^ContextImpl, mode: FlattenMode) -> Result,
    443 	set_flatten_tolerance:      proc "c" (impl: ^ContextImpl, tolerance: f64) -> Result,
    444 	set_approximation_options:  proc "c" (impl: ^ContextImpl, options: ^ApproximationOptions) -> Result,
    445 	get_style:                  proc "c" (impl: ^ContextImpl, slot: ContextStyleSlot, transformed: i32, style_out: ^VarCore) -> Result,
    446 	set_style:                  proc "c" (impl: ^ContextImpl, slot: ContextStyleSlot, style: ^ObjectCore, transform_mode: ContextStyleTransformMode) -> Result,
    447 	set_style_rgba:             proc "c" (impl: ^ContextImpl, slot: ContextStyleSlot, rgba: ^Rgba) -> Result,
    448 	set_style_rgba32:           proc "c" (impl: ^ContextImpl, slot: ContextStyleSlot, rgba32: u32) -> Result,
    449 	set_style_rgba64:           proc "c" (impl: ^ContextImpl, slot: ContextStyleSlot, rgba64: u64) -> Result,
    450 	disable_style:              proc "c" (impl: ^ContextImpl, slot: ContextStyleSlot) -> Result,
    451 	set_style_alpha:            proc "c" (impl: ^ContextImpl, slot: ContextStyleSlot, alpha: f64) -> Result,
    452 	swap_styles:                proc "c" (impl: ^ContextImpl, mode: ContextStyleSwapMode) -> Result,
    453 	set_global_alpha:           proc "c" (impl: ^ContextImpl, alpha: f64) -> Result,
    454 	set_comp_op:                proc "c" (impl: ^ContextImpl, comp_op: CompOp) -> Result,
    455 	set_fill_rule:              proc "c" (impl: ^ContextImpl, fill_rule: FillRule) -> Result,
    456 	set_stroke_width:           proc "c" (impl: ^ContextImpl, width: f64) -> Result,
    457 	set_stroke_miter_limit:     proc "c" (impl: ^ContextImpl, miter_limit: f64) -> Result,
    458 	set_stroke_cap:             proc "c" (impl: ^ContextImpl, position: StrokeCapPosition, stroke_cap: StrokeCap) -> Result,
    459 	set_stroke_caps:            proc "c" (impl: ^ContextImpl, stroke_cap: StrokeCap) -> Result,
    460 	set_stroke_join:            proc "c" (impl: ^ContextImpl, stroke_join: StrokeJoin) -> Result,
    461 	set_stroke_dash_offset:     proc "c" (impl: ^ContextImpl, dash_offset: f64) -> Result,
    462 	set_stroke_dash_array:      proc "c" (impl: ^ContextImpl, dash_array: ^ArrayCore) -> Result,
    463 	set_stroke_transform_order: proc "c" (impl: ^ContextImpl, transform_order: StrokeTransformOrder) -> Result,
    464 	set_stroke_options:         proc "c" (impl: ^ContextImpl, options: ^StrokeOptionsCore) -> Result,
    465 	clip_to_rect_i:             proc "c" (impl: ^ContextImpl, rect: ^RectI) -> Result,
    466 	clip_to_rect_d:             proc "c" (impl: ^ContextImpl, rect: ^Rect) -> Result,
    467 	restore_clipping:           proc "c" (impl: ^ContextImpl) -> Result,
    468 	clear_all:                  proc "c" (impl: ^ContextImpl) -> Result,
    469 	clear_recti:                proc "c" (impl: ^ContextImpl, rect: ^RectI) -> Result,
    470 	clear_rectd:                proc "c" (impl: ^ContextImpl, rect: ^Rect) -> Result,
    471 	fill_all:                   proc "c" (impl: ^ContextImpl) -> Result,
    472 	fill_all_rgba32:            proc "c" (impl: ^ContextImpl, rgba32: u32) -> Result,
    473 	fill_all_ext:               proc "c" (impl: ^ContextImpl, style: ^ObjectCore) -> Result,
    474 	fill_geometry:              proc "c" (impl: ^ContextImpl, type: GeometryType, data: rawptr) -> Result,
    475 	fill_geometry_rgba32:       proc "c" (impl: ^ContextImpl, type: GeometryType, data: rawptr, rgba32: u32) -> Result,
    476 	fill_geometry_ext:          proc "c" (impl: ^ContextImpl, type: GeometryType, data: rawptr, style: ^ObjectCore) -> Result,
    477 	fill_text_op_i:             proc "c" (self: ^ContextImpl, origin: ^PointI, font: ^FontCore, op: ContextRenderTextOp, data: rawptr) -> Result,
    478 	fill_text_op_i_rgba32:      proc "c" (self: ^ContextImpl, origin: ^PointI, font: ^FontCore, op: ContextRenderTextOp, data: rawptr, rgba32: u32) -> Result,
    479 	fill_text_op_i_ext:         proc "c" (self: ^ContextImpl, origin: ^PointI, font: ^FontCore, op: ContextRenderTextOp, data: rawptr, style: ^ObjectCore) -> Result,
    480 	fill_text_op_d:             proc "c" (self: ^ContextImpl, origin: ^Point, font: ^FontCore, op: ContextRenderTextOp, data: rawptr) -> Result,
    481 	fill_text_op_d_rgba32:      proc "c" (self: ^ContextImpl, origin: ^Point, font: ^FontCore, op: ContextRenderTextOp, data: rawptr, rgba32: u32) -> Result,
    482 	fill_text_op_d_ext:         proc "c" (self: ^ContextImpl, origin: ^Point, font: ^FontCore, op: ContextRenderTextOp, data: rawptr, style: ^ObjectCore) -> Result,
    483 	fill_mask_i:                proc "c" (impl: ^ContextImpl, origin: ^PointI, mask: ^ImageCore, mask_area: ^RectI) -> Result,
    484 	fill_mask_i_rgba32:         proc "c" (impl: ^ContextImpl, origin: ^PointI, mask: ^ImageCore, mask_area: ^RectI, rgba32: u32) -> Result,
    485 	fill_mask_i_ext:            proc "c" (impl: ^ContextImpl, origin: ^PointI, mask: ^ImageCore, mask_area: ^RectI, style: ^ObjectCore) -> Result,
    486 	fill_mask_d:                proc "c" (impl: ^ContextImpl, origin: ^Point, mask: ^ImageCore, mask_area: ^RectI) -> Result,
    487 	fill_mask_d_Rgba32:         proc "c" (impl: ^ContextImpl, origin: ^Point, mask: ^ImageCore, mask_area: ^RectI, rgba32: u32) -> Result,
    488 	fill_mask_d_ext:            proc "c" (impl: ^ContextImpl, origin: ^Point, mask: ^ImageCore, mask_area: ^RectI, style: ^ObjectCore) -> Result,
    489 	stroke_path_d:              proc "c" (impl: ^ContextImpl, origin: ^Point, path: ^PathCore) -> Result,
    490 	stroke_path_d_rgba32:       proc "c" (impl: ^ContextImpl, origin: ^Point, path: ^PathCore, rgba32: u32) -> Result,
    491 	stroke_path_d_ext:          proc "c" (impl: ^ContextImpl, origin: ^Point, path: ^PathCore, style: ^ObjectCore) -> Result,
    492 	stroke_geometry:            proc "c" (impl: ^ContextImpl, type: GeometryType, data: rawptr) -> Result,
    493 	stroke_geometry_rgba32:     proc "c" (impl: ^ContextImpl, type: GeometryType, data: rawptr, rgba32: u32) -> Result,
    494 	stroke_geometry_ext:        proc "c" (impl: ^ContextImpl, type: GeometryType, data: rawptr, style: ^ObjectCore) -> Result,
    495 	stroke_text_op_i:           proc "c" (self: ^ContextImpl, origin: ^PointI, font: ^FontCore, op: ContextRenderTextOp, data: rawptr) -> Result,
    496 	stroke_text_op_i_rgba32:    proc "c" (self: ^ContextImpl, origin: ^PointI, font: ^FontCore, op: ContextRenderTextOp, data: rawptr, rgba32: u32) -> Result,
    497 	stroke_text_op_i_ext:       proc "c" (self: ^ContextImpl, origin: ^PointI, font: ^FontCore, op: ContextRenderTextOp, data: rawptr, style: ^ObjectCore) -> Result,
    498 	stroke_text_op_d:           proc "c" (self: ^ContextImpl, origin: ^Point, font: ^FontCore, op: ContextRenderTextOp, data: rawptr) -> Result,
    499 	stroke_text_op_d_rgba32:    proc "c" (self: ^ContextImpl, origin: ^Point, font: ^FontCore, op: ContextRenderTextOp, data: rawptr, rgba32: u32) -> Result,
    500 	stroke_text_op_d_ext:       proc "c" (self: ^ContextImpl, origin: ^Point, font: ^FontCore, op: ContextRenderTextOp, data: rawptr, style: ^ObjectCore) -> Result,
    501 	blit_image_d:               proc "c" (impl: ^ContextImpl, origin: ^Point, img: ^ImageCore, img_area: ^RectI) -> Result,
    502 	blit_scaled_image_d:        proc "c" (impl: ^ContextImpl, rect: ^Rect, img: ^ImageCore, img_area: ^RectI) -> Result,
    503 }
    504 
    505 //! Rendering context state.
    506 //!
    507 //! This state is not meant to be created by users, it's only provided for users that want to introspect
    508 //! the rendering context state and for C++ API that accesses it directly for performance reasons.
    509 ContextState :: struct {
    510 	//! Target image or image object with nullptr impl in case that the rendering context doesn't render to an image.
    511 	target_image: ^ImageCore,
    512 
    513 	//! Current size of the target in abstract units, pixels if rendering to \ref BLImage.
    514 	target_size: Size,
    515 
    516 	//! Current rendering context hints.
    517 	hints: ContextHints,
    518 
    519 	//! Current composition operator.
    520 	comp_op: u8,
    521 
    522 	//! Current fill rule.
    523 	fill_rule: u8,
    524 
    525 	//! Current type of a style object of fill and stroke operations indexed by \ref BLContextStyleSlot.
    526 	style_type: [2]u8,
    527 
    528 	//! Count of saved states in the context.
    529 	saved_state_count: u32,
    530 
    531 	//! Current global alpha value [0, 1].
    532 	global_alpha: f64,
    533 
    534 	//! Current fill or stroke alpha indexed by style slot, see \ref BLContextStyleSlot.
    535 	style_alpha: [2]f64,
    536 
    537 	//! Current stroke options.
    538 	stroke_options: StrokeOptionsCore,
    539 
    540 	//! Current approximation options.
    541 	approximation_options: ApproximationOptions,
    542 
    543 	//! Current meta transformation matrix.
    544 	meta_transform: Matrix2D,
    545 
    546 	//! Current user transformation matrix.
    547 	user_transform: Matrix2D,
    548 
    549 	//! Current final transformation matrix, which combines all transformation matrices.
    550 	final_transform: Matrix2D,
    551 }
    552 
    553 //! Rendering context [C API Impl].
    554 ContextImpl :: struct {
    555 	//! Virtual function table.
    556 	virt: ^ContextVirt,
    557 
    558 	//! Current state of the context.
    559 	state: ^ContextState,
    560 
    561 	//! Type of the rendering context, see \ref BLContextType.
    562 	context_type: u32,
    563 }
    564 
    565 @(default_calling_convention="c", link_prefix="bl_")
    566 foreign lib {
    567 	//! \endcond
    568 	context_init                         :: proc(self: ^ContextCore) -> Result ---
    569 	context_init_move                    :: proc(self: ^ContextCore, other: ^ContextCore) -> Result ---
    570 	context_init_weak                    :: proc(self: ^ContextCore, other: ^ContextCore) -> Result ---
    571 	context_init_as                      :: proc(self: ^ContextCore, image: ^ImageCore, cci: ^ContextCreateInfo) -> Result ---
    572 	context_destroy                      :: proc(self: ^ContextCore) -> Result ---
    573 	context_reset                        :: proc(self: ^ContextCore) -> Result ---
    574 	context_assign_move                  :: proc(self: ^ContextCore, other: ^ContextCore) -> Result ---
    575 	context_assign_weak                  :: proc(self: ^ContextCore, other: ^ContextCore) -> Result ---
    576 	context_get_type                     :: proc(self: ^ContextCore) -> ContextType ---
    577 	context_get_target_size              :: proc(self: ^ContextCore, target_size_out: ^Size) -> Result ---
    578 	context_get_target_image             :: proc(self: ^ContextCore) -> ^ImageCore ---
    579 	context_begin                        :: proc(self: ^ContextCore, image: ^ImageCore, cci: ^ContextCreateInfo) -> Result ---
    580 	context_end                          :: proc(self: ^ContextCore) -> Result ---
    581 	context_flush                        :: proc(self: ^ContextCore, flags: ContextFlushFlags) -> Result ---
    582 	context_save                         :: proc(self: ^ContextCore, cookie: ^ContextCookie) -> Result ---
    583 	context_restore                      :: proc(self: ^ContextCore, cookie: ^ContextCookie) -> Result ---
    584 	context_get_meta_transform           :: proc(self: ^ContextCore, transform_out: ^Matrix2D) -> Result ---
    585 	context_get_user_transform           :: proc(self: ^ContextCore, transform_out: ^Matrix2D) -> Result ---
    586 	context_get_final_transform          :: proc(self: ^ContextCore, transform_out: ^Matrix2D) -> Result ---
    587 	context_user_to_meta                 :: proc(self: ^ContextCore) -> Result ---
    588 	context_apply_transform_op           :: proc(self: ^ContextCore, op_type: TransformOp, op_data: rawptr) -> Result ---
    589 	context_get_hint                     :: proc(self: ^ContextCore, hint_type: ContextHint) -> u32 ---
    590 	context_set_hint                     :: proc(self: ^ContextCore, hint_type: ContextHint, value: u32) -> Result ---
    591 	context_get_hints                    :: proc(self: ^ContextCore, hints_out: ^ContextHints) -> Result ---
    592 	context_set_hints                    :: proc(self: ^ContextCore, hints: ^ContextHints) -> Result ---
    593 	context_set_flatten_mode             :: proc(self: ^ContextCore, mode: FlattenMode) -> Result ---
    594 	context_set_flatten_tolerance        :: proc(self: ^ContextCore, tolerance: f64) -> Result ---
    595 	context_set_approximation_options    :: proc(self: ^ContextCore, options: ^ApproximationOptions) -> Result ---
    596 	context_get_fill_style               :: proc(self: ^ContextCore, style_out: ^VarCore) -> Result ---
    597 	context_get_transformed_fill_style   :: proc(self: ^ContextCore, style_out: ^VarCore) -> Result ---
    598 	context_set_fill_style               :: proc(self: ^ContextCore, style: ^Unknown) -> Result ---
    599 	context_set_fill_style_with_mode     :: proc(self: ^ContextCore, style: ^Unknown, transform_mode: ContextStyleTransformMode) -> Result ---
    600 	context_set_fill_style_rgba          :: proc(self: ^ContextCore, rgba: ^Rgba) -> Result ---
    601 	context_set_fill_style_rgba32        :: proc(self: ^ContextCore, rgba32: u32) -> Result ---
    602 	context_set_fill_style_rgba64        :: proc(self: ^ContextCore, rgba64: u64) -> Result ---
    603 	context_disable_fill_style           :: proc(self: ^ContextCore) -> Result ---
    604 	context_get_fill_alpha               :: proc(self: ^ContextCore) -> f64 ---
    605 	context_set_fill_alpha               :: proc(self: ^ContextCore, alpha: f64) -> Result ---
    606 	context_get_stroke_style             :: proc(self: ^ContextCore, style_out: ^VarCore) -> Result ---
    607 	context_get_transformed_stroke_style :: proc(self: ^ContextCore, style_out: ^VarCore) -> Result ---
    608 	context_set_stroke_style             :: proc(self: ^ContextCore, style: ^Unknown) -> Result ---
    609 	context_set_stroke_style_with_mode   :: proc(self: ^ContextCore, style: ^Unknown, transform_mode: ContextStyleTransformMode) -> Result ---
    610 	context_set_stroke_style_rgba        :: proc(self: ^ContextCore, rgba: ^Rgba) -> Result ---
    611 	context_set_stroke_style_rgba32      :: proc(self: ^ContextCore, rgba32: u32) -> Result ---
    612 	context_set_stroke_style_rgba64      :: proc(self: ^ContextCore, rgba64: u64) -> Result ---
    613 	context_disable_stroke_style         :: proc(self: ^ContextCore) -> Result ---
    614 	context_get_stroke_alpha             :: proc(self: ^ContextCore) -> f64 ---
    615 	context_set_stroke_alpha             :: proc(self: ^ContextCore, alpha: f64) -> Result ---
    616 	context_swap_styles                  :: proc(self: ^ContextCore, mode: ContextStyleSwapMode) -> Result ---
    617 	context_get_global_alpha             :: proc(self: ^ContextCore) -> f64 ---
    618 	context_set_global_alpha             :: proc(self: ^ContextCore, alpha: f64) -> Result ---
    619 	context_get_comp_op                  :: proc(self: ^ContextCore) -> CompOp ---
    620 	context_set_comp_op                  :: proc(self: ^ContextCore, comp_op: CompOp) -> Result ---
    621 	context_get_fill_rule                :: proc(self: ^ContextCore) -> FillRule ---
    622 	context_set_fill_rule                :: proc(self: ^ContextCore, fill_rule: FillRule) -> Result ---
    623 	context_get_stroke_width             :: proc(self: ^ContextCore) -> f64 ---
    624 	context_set_stroke_width             :: proc(self: ^ContextCore, width: f64) -> Result ---
    625 	context_get_stroke_miter_limit       :: proc(self: ^ContextCore) -> f64 ---
    626 	context_set_stroke_miter_limit       :: proc(self: ^ContextCore, miter_limit: f64) -> Result ---
    627 	context_get_stroke_cap               :: proc(self: ^ContextCore, position: StrokeCapPosition) -> StrokeCap ---
    628 	context_set_stroke_cap               :: proc(self: ^ContextCore, position: StrokeCapPosition, stroke_cap: StrokeCap) -> Result ---
    629 	context_set_stroke_caps              :: proc(self: ^ContextCore, stroke_cap: StrokeCap) -> Result ---
    630 	context_get_stroke_join              :: proc(self: ^ContextCore) -> StrokeJoin ---
    631 	context_set_stroke_join              :: proc(self: ^ContextCore, stroke_join: StrokeJoin) -> Result ---
    632 	context_get_stroke_transform_order   :: proc(self: ^ContextCore) -> StrokeTransformOrder ---
    633 	context_set_stroke_transform_order   :: proc(self: ^ContextCore, transform_order: StrokeTransformOrder) -> Result ---
    634 	context_get_stroke_dash_offset       :: proc(self: ^ContextCore) -> f64 ---
    635 	context_set_stroke_dash_offset       :: proc(self: ^ContextCore, dash_offset: f64) -> Result ---
    636 	context_get_stroke_dash_array        :: proc(self: ^ContextCore, dash_array_out: ^ArrayCore) -> Result ---
    637 	context_set_stroke_dash_array        :: proc(self: ^ContextCore, dash_array: ^ArrayCore) -> Result ---
    638 	context_get_stroke_options           :: proc(self: ^ContextCore, options: ^StrokeOptionsCore) -> Result ---
    639 	context_set_stroke_options           :: proc(self: ^ContextCore, options: ^StrokeOptionsCore) -> Result ---
    640 	context_clip_to_rect_i               :: proc(self: ^ContextCore, rect: ^RectI) -> Result ---
    641 	context_clip_to_rect_d               :: proc(self: ^ContextCore, rect: ^Rect) -> Result ---
    642 	context_restore_clipping             :: proc(self: ^ContextCore) -> Result ---
    643 	context_clear_all                    :: proc(self: ^ContextCore) -> Result ---
    644 	context_clear_rect_i                 :: proc(self: ^ContextCore, rect: ^RectI) -> Result ---
    645 	context_clear_rect_d                 :: proc(self: ^ContextCore, rect: ^Rect) -> Result ---
    646 	context_fill_all                     :: proc(self: ^ContextCore) -> Result ---
    647 	context_fill_all_rgba32              :: proc(self: ^ContextCore, rgba32: u32) -> Result ---
    648 	context_fill_all_rgba64              :: proc(self: ^ContextCore, rgba64: u64) -> Result ---
    649 	context_fill_all_ext                 :: proc(self: ^ContextCore, style: ^Unknown) -> Result ---
    650 	context_fill_rect_i                  :: proc(self: ^ContextCore, rect: ^RectI) -> Result ---
    651 	context_fill_rect_i_rgba32           :: proc(self: ^ContextCore, rect: ^RectI, rgba32: u32) -> Result ---
    652 	context_fill_rect_i_rgba64           :: proc(self: ^ContextCore, rect: ^RectI, rgba64: u64) -> Result ---
    653 	context_fill_rect_i_ext              :: proc(self: ^ContextCore, rect: ^RectI, style: ^Unknown) -> Result ---
    654 	context_fill_rect_d                  :: proc(self: ^ContextCore, rect: ^Rect) -> Result ---
    655 	context_fill_rect_d_rgba32           :: proc(self: ^ContextCore, rect: ^Rect, rgba32: u32) -> Result ---
    656 	context_fill_rect_d_rgba64           :: proc(self: ^ContextCore, rect: ^Rect, rgba64: u64) -> Result ---
    657 	context_fill_rect_d_ext              :: proc(self: ^ContextCore, rect: ^Rect, style: ^Unknown) -> Result ---
    658 	context_fill_path_d                  :: proc(self: ^ContextCore, origin: ^Point, path: ^PathCore) -> Result ---
    659 	context_fill_path_d_rgba32           :: proc(self: ^ContextCore, origin: ^Point, path: ^PathCore, rgba32: u32) -> Result ---
    660 	context_fill_path_d_rgba64           :: proc(self: ^ContextCore, origin: ^Point, path: ^PathCore, rgba64: u64) -> Result ---
    661 	context_fill_path_d_ext              :: proc(self: ^ContextCore, origin: ^Point, path: ^PathCore, style: ^Unknown) -> Result ---
    662 	context_fill_geometry                :: proc(self: ^ContextCore, type: GeometryType, data: rawptr) -> Result ---
    663 	context_fill_geometry_rgba32         :: proc(self: ^ContextCore, type: GeometryType, data: rawptr, rgba32: u32) -> Result ---
    664 	context_fill_geometry_rgba64         :: proc(self: ^ContextCore, type: GeometryType, data: rawptr, rgba64: u64) -> Result ---
    665 	context_fill_geometry_ext            :: proc(self: ^ContextCore, type: GeometryType, data: rawptr, style: ^Unknown) -> Result ---
    666 	context_fill_utf8_text_i             :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, text: cstring, size: c.size_t) -> Result ---
    667 	context_fill_utf8_text_i_rgba32      :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, text: cstring, size: c.size_t, rgba32: u32) -> Result ---
    668 	context_fill_utf8_text_i_rgba64      :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, text: cstring, size: c.size_t, rgba64: u64) -> Result ---
    669 	context_fill_utf8_text_i_ext         :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, text: cstring, size: c.size_t, style: ^Unknown) -> Result ---
    670 	context_fill_utf8_text_d             :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, text: cstring, size: c.size_t) -> Result ---
    671 	context_fill_utf8_text_d_rgba32      :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, text: cstring, size: c.size_t, rgba32: u32) -> Result ---
    672 	context_fill_utf8_text_d_rgba64      :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, text: cstring, size: c.size_t, rgba64: u64) -> Result ---
    673 	context_fill_utf8_text_d_ext         :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, text: cstring, size: c.size_t, style: ^Unknown) -> Result ---
    674 	context_fill_utf16_text_i            :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, text: ^u16, size: c.size_t) -> Result ---
    675 	context_fill_utf16_text_i_rgba32     :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, text: ^u16, size: c.size_t, rgba32: u32) -> Result ---
    676 	context_fill_utf16_text_i_rgba64     :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, text: ^u16, size: c.size_t, rgba64: u64) -> Result ---
    677 	context_fill_utf16_text_i_ext        :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, text: ^u16, size: c.size_t, style: ^Unknown) -> Result ---
    678 	context_fill_utf16_text_d            :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, text: ^u16, size: c.size_t) -> Result ---
    679 	context_fill_utf16_text_d_rgba32     :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, text: ^u16, size: c.size_t, rgba32: u32) -> Result ---
    680 	context_fill_utf16_text_d_rgba64     :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, text: ^u16, size: c.size_t, rgba64: u64) -> Result ---
    681 	context_fill_utf16_text_d_ext        :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, text: ^u16, size: c.size_t, style: ^Unknown) -> Result ---
    682 	context_fill_utf32_text_i            :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, text: ^u32, size: c.size_t) -> Result ---
    683 	context_fill_utf32_text_i_rgba32     :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, text: ^u32, size: c.size_t, rgba32: u32) -> Result ---
    684 	context_fill_utf32_text_i_rgba64     :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, text: ^u32, size: c.size_t, rgba64: u64) -> Result ---
    685 	context_fill_utf32_text_i_ext        :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, text: ^u32, size: c.size_t, style: ^Unknown) -> Result ---
    686 	context_fill_utf32_text_d            :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, text: ^u32, size: c.size_t) -> Result ---
    687 	context_fill_utf32_text_d_rgba32     :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, text: ^u32, size: c.size_t, rgba32: u32) -> Result ---
    688 	context_fill_utf32_text_d_rgba64     :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, text: ^u32, size: c.size_t, rgba64: u64) -> Result ---
    689 	context_fill_utf32_text_d_ext        :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, text: ^u32, size: c.size_t, style: ^Unknown) -> Result ---
    690 	context_fill_glyph_run_i             :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, glyph_run: ^GlyphRun) -> Result ---
    691 	context_fill_glyph_run_i_rgba32      :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, glyph_run: ^GlyphRun, rgba32: u32) -> Result ---
    692 	context_fill_glyph_run_i_rgba64      :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, glyph_run: ^GlyphRun, rgba64: u64) -> Result ---
    693 	context_fill_glyph_run_i_ext         :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, glyph_run: ^GlyphRun, style: ^Unknown) -> Result ---
    694 	context_fill_glyph_run_d             :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, glyph_run: ^GlyphRun) -> Result ---
    695 	context_fill_glyph_run_d_rgba32      :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, glyph_run: ^GlyphRun, rgba32: u32) -> Result ---
    696 	context_fill_glyph_run_d_rgba64      :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, glyph_run: ^GlyphRun, rgba64: u64) -> Result ---
    697 	context_fill_glyph_run_d_ext         :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, glyph_run: ^GlyphRun, style: ^Unknown) -> Result ---
    698 	context_fill_mask_i                  :: proc(self: ^ContextCore, origin: ^PointI, mask: ^ImageCore, mask_area: ^RectI) -> Result ---
    699 	context_fill_mask_i_rgba32           :: proc(self: ^ContextCore, origin: ^PointI, mask: ^ImageCore, mask_area: ^RectI, rgba32: u32) -> Result ---
    700 	context_fill_mask_i_rgba64           :: proc(self: ^ContextCore, origin: ^PointI, mask: ^ImageCore, mask_area: ^RectI, rgba64: u64) -> Result ---
    701 	context_fill_mask_i_ext              :: proc(self: ^ContextCore, origin: ^PointI, mask: ^ImageCore, mask_area: ^RectI, style: ^Unknown) -> Result ---
    702 	context_fill_mask_d                  :: proc(self: ^ContextCore, origin: ^Point, mask: ^ImageCore, mask_area: ^RectI) -> Result ---
    703 	context_fill_mask_d_rgba32           :: proc(self: ^ContextCore, origin: ^Point, mask: ^ImageCore, mask_area: ^RectI, rgba32: u32) -> Result ---
    704 	context_fill_mask_d_rgba64           :: proc(self: ^ContextCore, origin: ^Point, mask: ^ImageCore, mask_area: ^RectI, rgba64: u64) -> Result ---
    705 	context_fill_mask_d_ext              :: proc(self: ^ContextCore, origin: ^Point, mask: ^ImageCore, mask_area: ^RectI, style: ^Unknown) -> Result ---
    706 	context_stroke_rect_i                :: proc(self: ^ContextCore, rect: ^RectI) -> Result ---
    707 	context_stroke_rect_i_rgba32         :: proc(self: ^ContextCore, rect: ^RectI, rgba32: u32) -> Result ---
    708 	context_stroke_rect_i_rgba64         :: proc(self: ^ContextCore, rect: ^RectI, rgba64: u64) -> Result ---
    709 	context_stroke_rect_i_ext            :: proc(self: ^ContextCore, rect: ^RectI, style: ^Unknown) -> Result ---
    710 	context_stroke_rect_d                :: proc(self: ^ContextCore, rect: ^Rect) -> Result ---
    711 	context_stroke_rect_d_rgba32         :: proc(self: ^ContextCore, rect: ^Rect, rgba32: u32) -> Result ---
    712 	context_stroke_rect_d_rgba64         :: proc(self: ^ContextCore, rect: ^Rect, rgba64: u64) -> Result ---
    713 	context_stroke_rect_d_ext            :: proc(self: ^ContextCore, rect: ^Rect, style: ^Unknown) -> Result ---
    714 	context_stroke_path_d                :: proc(self: ^ContextCore, origin: ^Point, path: ^PathCore) -> Result ---
    715 	context_stroke_path_d_rgba32         :: proc(self: ^ContextCore, origin: ^Point, path: ^PathCore, rgba32: u32) -> Result ---
    716 	context_stroke_path_d_rgba64         :: proc(self: ^ContextCore, origin: ^Point, path: ^PathCore, rgba64: u64) -> Result ---
    717 	context_stroke_path_d_ext            :: proc(self: ^ContextCore, origin: ^Point, path: ^PathCore, style: ^Unknown) -> Result ---
    718 	context_stroke_geometry              :: proc(self: ^ContextCore, type: GeometryType, data: rawptr) -> Result ---
    719 	context_stroke_geometry_rgba32       :: proc(self: ^ContextCore, type: GeometryType, data: rawptr, rgba32: u32) -> Result ---
    720 	context_stroke_geometry_rgba64       :: proc(self: ^ContextCore, type: GeometryType, data: rawptr, rgba64: u64) -> Result ---
    721 	context_stroke_geometry_ext          :: proc(self: ^ContextCore, type: GeometryType, data: rawptr, style: ^Unknown) -> Result ---
    722 	context_stroke_utf8_text_i           :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, text: cstring, size: c.size_t) -> Result ---
    723 	context_stroke_utf8_text_i_rgba32    :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, text: cstring, size: c.size_t, rgba32: u32) -> Result ---
    724 	context_stroke_utf8_text_i_rgba64    :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, text: cstring, size: c.size_t, rgba64: u64) -> Result ---
    725 	context_stroke_utf8_text_i_ext       :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, text: cstring, size: c.size_t, style: ^Unknown) -> Result ---
    726 	context_stroke_utf8_text_d           :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, text: cstring, size: c.size_t) -> Result ---
    727 	context_stroke_utf8_text_d_rgba32    :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, text: cstring, size: c.size_t, rgba32: u32) -> Result ---
    728 	context_stroke_utf8_text_d_rgba64    :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, text: cstring, size: c.size_t, rgba64: u64) -> Result ---
    729 	context_stroke_utf8_text_d_ext       :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, text: cstring, size: c.size_t, style: ^Unknown) -> Result ---
    730 	context_stroke_utf16_text_i          :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, text: ^u16, size: c.size_t) -> Result ---
    731 	context_stroke_utf16_text_i_rgba32   :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, text: ^u16, size: c.size_t, rgba32: u32) -> Result ---
    732 	context_stroke_utf16_text_i_rgba64   :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, text: ^u16, size: c.size_t, rgba64: u64) -> Result ---
    733 	context_stroke_utf16_text_i_ext      :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, text: ^u16, size: c.size_t, style: ^Unknown) -> Result ---
    734 	context_stroke_utf16_text_d          :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, text: ^u16, size: c.size_t) -> Result ---
    735 	context_stroke_utf16_text_d_rgba32   :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, text: ^u16, size: c.size_t, rgba32: u32) -> Result ---
    736 	context_stroke_utf16_text_d_rgba64   :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, text: ^u16, size: c.size_t, rgba64: u64) -> Result ---
    737 	context_stroke_utf16_text_d_ext      :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, text: ^u16, size: c.size_t, style: ^Unknown) -> Result ---
    738 	context_stroke_utf32_text_i          :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, text: ^u32, size: c.size_t) -> Result ---
    739 	context_stroke_utf32_text_i_rgba32   :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, text: ^u32, size: c.size_t, rgba32: u32) -> Result ---
    740 	context_stroke_utf32_text_i_rgba64   :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, text: ^u32, size: c.size_t, rgba64: u64) -> Result ---
    741 	context_stroke_utf32_text_i_ext      :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, text: ^u32, size: c.size_t, style: ^Unknown) -> Result ---
    742 	context_stroke_utf32_text_d          :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, text: ^u32, size: c.size_t) -> Result ---
    743 	context_stroke_utf32_text_d_rgba32   :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, text: ^u32, size: c.size_t, rgba32: u32) -> Result ---
    744 	context_stroke_utf32_text_d_rgba64   :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, text: ^u32, size: c.size_t, rgba64: u64) -> Result ---
    745 	context_stroke_utf32_text_d_ext      :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, text: ^u32, size: c.size_t, style: ^Unknown) -> Result ---
    746 	context_stroke_glyph_run_i           :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, glyph_run: ^GlyphRun) -> Result ---
    747 	context_stroke_glyph_run_i_rgba32    :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, glyph_run: ^GlyphRun, rgba32: u32) -> Result ---
    748 	context_stroke_glyph_run_i_rgba64    :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, glyph_run: ^GlyphRun, rgba64: u64) -> Result ---
    749 	context_stroke_glyph_run_i_ext       :: proc(self: ^ContextCore, origin: ^PointI, font: ^FontCore, glyph_run: ^GlyphRun, style: ^Unknown) -> Result ---
    750 	context_stroke_glyph_run_d           :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, glyph_run: ^GlyphRun) -> Result ---
    751 	context_stroke_glyph_run_d_rgba32    :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, glyph_run: ^GlyphRun, rgba32: u32) -> Result ---
    752 	context_stroke_glyph_run_d_rgba64    :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, glyph_run: ^GlyphRun, rgba64: u64) -> Result ---
    753 	context_stroke_glyph_run_d_ext       :: proc(self: ^ContextCore, origin: ^Point, font: ^FontCore, glyph_run: ^GlyphRun, style: ^Unknown) -> Result ---
    754 	context_blit_image_i                 :: proc(self: ^ContextCore, origin: ^PointI, img: ^ImageCore, img_area: ^RectI) -> Result ---
    755 	context_blit_image_d                 :: proc(self: ^ContextCore, origin: ^Point, img: ^ImageCore, img_area: ^RectI) -> Result ---
    756 	context_blit_scaled_image_i          :: proc(self: ^ContextCore, rect: ^RectI, img: ^ImageCore, img_area: ^RectI) -> Result ---
    757 	context_blit_scaled_image_d          :: proc(self: ^ContextCore, rect: ^Rect, img: ^ImageCore, img_area: ^RectI) -> Result ---
    758 }
    759