RDPipelineColorBlendStateAttachment
Inherits: RefCounted < Object
Description
Section titled “Description”Pipeline color blend state attachment (used by RenderingDevice).
Controls how blending between source and destination fragments is performed when using RenderingDevice.
For reference, this is how common user-facing blend modes are implemented in Orblit’s 2D renderer:
Mix:
Add:
Subtract:
Multiply:
Pre-multiplied alpha:
Properties
Section titled “Properties”Methods
Section titled “Methods”| Returns | Method |
|---|---|
| void | set_as_mix() |
Property descriptions
Section titled “Property descriptions”alpha_blend_op
RenderingDevice.BlendOperation alpha_blend_op = 0
The blend mode to use for the alpha channel.
color_blend_op
RenderingDevice.BlendOperation color_blend_op = 0
The blend mode to use for the red/green/blue color channels.
dst_alpha_blend_factor
RenderingDevice.BlendFactor dst_alpha_blend_factor = 0
Controls how the blend factor for the alpha channel is determined based on the destination’s fragments.
dst_color_blend_factor
RenderingDevice.BlendFactor dst_color_blend_factor = 0
Controls how the blend factor for the color channels is determined based on the destination’s fragments.
enable_blend
bool enable_blend = false
If true, performs blending between the source and destination according to the factors defined in src_color_blend_factor, dst_color_blend_factor, src_alpha_blend_factor and dst_alpha_blend_factor. The blend modes color_blend_op and alpha_blend_op are also taken into account, with write_r, write_g, write_b and write_a controlling the output.
src_alpha_blend_factor
RenderingDevice.BlendFactor src_alpha_blend_factor = 0
Controls how the blend factor for the alpha channel is determined based on the source’s fragments.
src_color_blend_factor
RenderingDevice.BlendFactor src_color_blend_factor = 0
Controls how the blend factor for the color channels is determined based on the source’s fragments.
write_a
bool write_a = true
If true, writes the new alpha channel to the final result.
write_b
bool write_b = true
If true, writes the new blue color channel to the final result.
write_g
bool write_g = true
If true, writes the new green color channel to the final result.
write_r
bool write_r = true
If true, writes the new red color channel to the final result.
Method descriptions
Section titled “Method descriptions”set_as_mix
void set_as_mix()
Convenience method to perform standard mix blending with straight (non-premultiplied) alpha. This sets enable_blend to true, src_color_blend_factor to RenderingDevice.BLEND_FACTOR_SRC_ALPHA, dst_color_blend_factor to RenderingDevice.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA, src_alpha_blend_factor to RenderingDevice.BLEND_FACTOR_SRC_ALPHA and dst_alpha_blend_factor to RenderingDevice.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA.
