enum

Tryst::SDL::BlendMode

Inherits Enum < Comparable < Value < Object

How a colour being drawn combines with what is already there.

Constants

None = 0_u32

Overwrite. The default, and the fastest.

Blend = 1_u32

Ordinary alpha blending - what "transparency" usually means.

Add = 2_u32

Adds light, so overlapping draws get brighter. Fire, sparks.

Mod = 4_u32

Multiplies, so overlapping draws get darker. Shadows, tinting.

Multiply = 8_u32
BlendPremultiplied = 16_u32

The premultiplied variants expect colour channels already scaled by alpha, which is what most image pipelines produce.

AddPremultiplied = 32_u32

Constructors

compose(src_color : BlendFactor, dst_color : BlendFactor, color_op : BlendOperation, src_alpha : BlendFactor, dst_alpha : BlendFactor, alpha_op : BlendOperation) : BlendMode

Builds a BlendMode outside the fixed set above, from SDL's own lower-level srcdstop algebra - e.g. an inverse blend that makes white text invert whatever colour is behind it, so it stays readable over any background:

BlendMode.compose(:one_minus_dst_color, :one_minus_src_alpha, :add,
  :zero, :one, :add)

Not every renderer backend supports every combination - SDL falls back to ordinary alpha blending where it does not.

Source

Instance methods

add?

Returns true if this enum value equals Add

Source
add_premultiplied?

Returns true if this enum value equals AddPremultiplied

Source
blend?

Returns true if this enum value equals Blend

Source
blend_premultiplied?

Returns true if this enum value equals BlendPremultiplied

Source
mod?

Returns true if this enum value equals Mod

Source
multiply?

Returns true if this enum value equals Multiply

Source
none?

Returns true if this enum value equals None

Source