ImageBlender

Inherits: Reference < Object

Provides advanced image blending methods (derived from OpenGL specification).

Description

Sets up custom blending options which builds upon Image blending methods. This class uses two equations: one for the RGB values, and another one for the alpha value. The default behavior of this class is the same as Image.blend_rect.

Methods

void blend_rect ( Image src, Rect2 src_rect, Image dst, Vector2 dst_pos ) const
void stamp_rect ( Image src, Rect2 src_rect, Image dst, Vector2 dst_init_pos, Vector2 dst_end_pos, float spacing ) const

Enumerations

enum BlendEquation:

  • FUNC_ADD = 0 — Adds the src and dst values.
  • FUNC_SUBTRACT = 1 — Substracts the dst value from the src value.
  • FUNC_REVERSE_SUBTRACT = 2 — Substracts the src value from the dst value.
  • FUNC_MIN = 3 — Selects the minimum from the src and dst values.
  • FUNC_MAX = 4 — Selects the maximum from the src and dst values.

enum BlendFactor:

  • FACTOR_ZERO = 0 — Factor is equal to 0.
  • FACTOR_ONE = 1 — Factor is equal to 1.
  • FACTOR_SRC_COLOR = 2 — Factor is equal to the src color.
  • FACTOR_ONE_MINUS_SRC_COLOR = 3 — Factor is equal to 1 minus the src color.
  • FACTOR_DST_COLOR = 4 — Factor is equal to the dst color.
  • FACTOR_ONE_MINUS_DST_COLOR = 5 — Factor is equal to 1 minus the dst color.
  • FACTOR_SRC_ALPHA = 6 — Factor is equal to the alpha value of the src color.
  • FACTOR_ONE_MINUS_SRC_ALPHA = 7 — Factor is equal to 1 minus the alpha value of the src color.
  • FACTOR_DST_ALPHA = 8 — Factor is equal to the alpha value of the dst color.
  • FACTOR_ONE_MINUS_DST_ALPHA = 9 — Factor is equal to 1 minus the alpha value of the dst color.
  • FACTOR_DST_ALPHA_TIMES_ONE_MINUS_SRC_ALPHA = 10 — Factor is equal to FACTOR_DST_ALPHA times FACTOR_ONE_MINUS_SRC_ALPHA.

Property Descriptions

Default 7
Setter set_alpha_dst_factor(value)
Getter get_alpha_dst_factor()

Determines the value that multiply the dst alpha value on those equations that require it.


Default 0
Setter set_alpha_equation(value)
Getter get_alpha_equation()

Determines the equation that blends the alpha values.


Default 1
Setter set_alpha_src_factor(value)
Getter get_alpha_src_factor()

Determines the value that multiply the src alpha value on those equations that require it.


Default 10
Setter set_rgb_dst_factor(value)
Getter get_rgb_dst_factor()

Determines the values that multiply the dst RGB values on those equations that require it.


Default 0
Setter set_rgb_equation(value)
Getter get_rgb_equation()

Determines the equation that blends the RGB values.


Default 6
Setter set_rgb_src_factor(value)
Getter get_rgb_src_factor()

Determines the values that multiply the src RGB values on those equations that require it.

Method Descriptions

Blends src_rect from src image to dst image at coordinates dst_pos.


Stamps src_rect from src image to dst image in a straight line from dst_init_pos to dst_end_pos, with a certain spacing between stamps. You may use it to draw strokes.