simvx.graphics.blend¶
Canonical colour-blend factors for the engine’s blend modes.
Every backend derives its blend state from this one table instead of keeping its
own copy: the Vulkan pipeline builder translates the factor names to
VkBlendFactor values, and the browser runtime spells the same factors as
WebGPU strings. A CPU test in the web package reads the WebGPU renderer’s source
and compares its literals against this table channel by channel, so the two
backends cannot quietly drift apart.
The modes are the ones the 2D drawing API exposes (draw_rect(blend=...) and
friends), listed in the order their identifiers are encoded on the draw wire.
Factor names are backend-neutral; :data:WEBGPU_FACTORS gives the WebGPU
spelling and simvx.graphics.gpu.pipeline holds the Vulkan one, next to the
rest of the Vulkan symbols.
Module Contents¶
Classes¶
Source and destination factors of one blend mode, colour channels then alpha. |
Data¶
API¶
- simvx.graphics.blend.__all__¶
[‘BLEND_FACTORS’, ‘BLEND_MODE_ORDER’, ‘WEBGPU_FACTORS’, ‘BlendFactors’]
- class simvx.graphics.blend.BlendFactors¶
Source and destination factors of one blend mode, colour channels then alpha.
Both channels always combine with an add operation, so the resulting colour is
src.rgb * src_colour + dst.rgb * dst_colourand the resulting alpha issrc.a * src_alpha + dst.a * dst_alpha.- src_colour: str¶
None
- dst_colour: str¶
None
- src_alpha: str¶
None
- dst_alpha: str¶
None
- simvx.graphics.blend.BLEND_FACTORS: Final[dict[str, simvx.graphics.blend.BlendFactors]]¶
None
- simvx.graphics.blend.BLEND_MODE_ORDER: Final[tuple[str, ...]]¶
‘tuple(…)’
- simvx.graphics.blend.WEBGPU_FACTORS: Final[dict[str, str]]¶
None