chickadee » sdl2 » color-add!

color-add color1 color2procedure
colour-add color1 color2procedure
color-add! color1 color2 #!optional destprocedure
colour-add! color1 color2 #!optional destprocedure

Efficiently add-blend color1 with color2. This is equivalent to the "addition" blend mode of image editors, where color1 is the bottom layer and color2 is the top layer.

  • color-add and colour-add return a new managed sdl2:color.
  • color-add! and colour-add! modify and return dest. If dest is omitted, color1 is modified and returned.

Requires sdl2 egg 0.2.0 or higher.

The results are clamped to the range [0, 255]. sdl2:color can only hold integer values, so the results will be truncated to integers.

This operation only affects the R, G, and B values. The result's A value will always be the same as color1's A value.

color2's A value controls the strength of the effect. E.g. 255 means full strength, 127 means half strength, 0 means no effect (the result will have the same values as color1).