< index
< 2. Console emulator
< 2.2 Drawing on the root console

=====================================
Background effect flags
=====================================

For the python version, remove TCOD_ : libtcod.BKGND_NONE

typedef enum {
	TCOD_BKGND_NONE,
	TCOD_BKGND_SET,
	TCOD_BKGND_MULTIPLY,
	TCOD_BKGND_LIGHTEN,
	TCOD_BKGND_DARKEN,
	TCOD_BKGND_SCREEN,
	TCOD_BKGND_COLOR_DODGE,
	TCOD_BKGND_COLOR_BURN,
	TCOD_BKGND_ADD,
	TCOD_BKGND_ADDA,
	TCOD_BKGND_BURN,
	TCOD_BKGND_OVERLAY,
	TCOD_BKGND_ALPH	
} TCOD_bkgnd_flag_t;

This flag is used by most functions that modify a cell background color. It defines how the console's current background color is used to modify the cell's existing background color :
TCOD_BKGND_NONE : the cell's background color is not modified.
TCOD_BKGND_SET : the cell's background color is replaced by the console's default background color : newbk = curbk.
TCOD_BKGND_MULTIPLY : the cell's background color is multiplied by the console's default background color : newbk = oldbk * curbk
TCOD_BKGND_LIGHTEN : newbk = MAX(oldbk,curbk)
TCOD_BKGND_DARKEN : newbk = MIN(oldbk,curbk)
TCOD_BKGND_SCREEN : newbk = white - (white - oldbk) * (white - curbk) // inverse of multiply : (1-newbk) = (1-oldbk)*(1-curbk)
TCOD_BKGND_COLOR_DODGE : newbk = curbk / (white - oldbk)
TCOD_BKGND_COLOR_BURN : newbk = white - (white - oldbk) / curbk
TCOD_BKGND_ADD : newbk = oldbk + curbk
TCOD_BKGND_ADDALPHA(alpha) : newbk = oldbk + alpha*curbk
TCOD_BKGND_BURN : newbk = oldbk + curbk - white
TCOD_BKGND_OVERLAY : newbk = curbk.x <= 0.5 ? 2*curbk*oldbk : white - 2*(white-curbk)*(white-oldbk)
TCOD_BKGND_ALPHA(alpha) : newbk = (1.0f-alpha)*oldbk + alpha*(curbk-oldbk)

Note that TCOD_BKGND_ALPHA and TCOD_BKGND_ADDALPHA are MACROS that needs a float parameter between (0.0 and 1.0). TCOD_BKGND_ALPH and TCOD_BKGND_ADDA should not be used directly (else they will have the same effect as TCOD_BKGND_NONE).
Example :

insert a comment