chickadee » sdl2 » color-mult

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

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

  • color-mult and colour-mult return a new managed sdl2:color.
  • color-mult! and colour-mult! 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).