Functions Provided For Using The M2L Color Table
Some effects provide more than one color. In this case the so-called »Color Table, »Color Gradient, »Color Gradient Dialog or M2L Color Table (described here) is offered by the effect to take control of the colors.
The following table provides an overview of all functions the effect can use to modify the colors in a M2L Color Table:
Function
|
Description
|
void M2LColorTableSetColor(int idx, color c)
|
Sets the color with the specified index to the given color value. If the index is out of range, nothing happens.
|
color M2LColorTableGetColor(int idx)
|
Returns the color with the specified index. If the index is out of range, black is returned.
|
void M2LColorTableSetPreset(int preset)
|
Sets the M2L Color Table preset. Please use a constant as described below for preset.
|
void M2LColorTableSetColorFade(int enable)
|
Sets the Fade option. Use 1 (TRUE) to activate the fade. Use 0 (FALSE) to deactivate it.
|
int M2LColorTableGetColorFade()
|
Returns 1 (TRUE) if Fade is activated, otherwise 0 (FALSE).
|
void M2LColorTableToggleColorFade()
|
Toggles the Fade option.
|
void M2LColorTableSetByGlobalId(int ID)
|
Selects a Global Color List as specified by its ID to be used in this Color Table.
|
int M2LColorTableGetGlobalId()
|
Returns the ID of the Global Color List that is currently selected in this Color Table.
|
▪For a detailed description of the non-primitive data type color, see »Using Data Types
Remarks
Not every function might be available for each MADRIX effect. Therefore, the functions M2LColorTableSetColorFade, M2LColorTableGetColorFade, and M2LColorTableToggleColorFade are only available if the effect offers Fade Mode.
M2L Color Table Preset Constants
Constant
|
Description
|
int M2L_COLORTABLE_PRESET_C1
|
Sets preset C1.
|
int M2L_COLORTABLE_PRESET_C2
|
Sets preset C2.
|
int M2L_COLORTABLE_PRESET_R
|
Sets preset R.
|
int M2L_COLORTABLE_PRESET_G
|
Sets preset G.
|
int M2L_COLORTABLE_PRESET_B
|
Sets preset B.
|
Example
This example sets the M2L Color Table preset C1 and sets the last 12 colors to color black.
@scriptname="";
@author="";
@version="";
@description="";
void InitEffect()
{
//Set Preset C1
M2LColorTableSetPreset(M2L_COLORTABLE_PRESET_C1);
//Sets the last 12 colors to black
for(int i=12;i<24;i++)
M2LColorTableSetColor(i,BLACK);
}
void PreRenderEffect()
{
}
void PostRenderEffect()
{
}
void MatrixSizeChanged()
{
InitEffect();
}
|