Vector2LineAngle and more Color functions.

This commit is contained in:
jussi
2023-04-06 22:17:33 +03:00
parent fe15e836bd
commit 9e7f538a38
9 changed files with 196 additions and 4 deletions

View File

@@ -2448,6 +2448,75 @@ int ltexturesColorFromHSV( lua_State *L ) {
return 1;
}
/*
> color = RL.ColorTint( Color color, Color tint )
Get color multiplied with another color
- Failure return false
- Success return Color
*/
int ltexturesColorTint( lua_State *L ) {
if ( !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.ColorTint( Color color, Color tint )" );
lua_pushboolean( L, false );
return 1;
}
Color tint = uluaGetColor( L );
lua_pop( L, 1 );
Color color = uluaGetColor( L );
uluaPushColor( L, ColorTint( color, tint ) );
return 1;
}
/*
> color = RL.ColorBrightness( Color color, float factor )
Get color with brightness correction, brightness factor goes from -1.0f to 1.0f
- Failure return false
- Success return Color
*/
int ltexturesColorBrightness( lua_State *L ) {
if ( !lua_istable( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.ColorBrightness( Color color, float factor )" );
lua_pushboolean( L, false );
return 1;
}
float factor = lua_tonumber( L, -1 );
lua_pop( L, 1 );
Color color = uluaGetColor( L );
uluaPushColor( L, ColorBrightness( color, factor ) );
return 1;
}
/*
> color = RL.ColorContrast( Color color, float contrast )
Get color with contrast correction, contrast values between -1.0f and 1.0f
- Failure return false
- Success return Color
*/
int ltexturesColorContrast( lua_State *L ) {
if ( !lua_istable( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.ColorContrast( Color color, float contrast )" );
lua_pushboolean( L, false );
return 1;
}
float contrast = lua_tonumber( L, -1 );
lua_pop( L, 1 );
Color color = uluaGetColor( L );
uluaPushColor( L, ColorContrast( color, contrast ) );
return 1;
}
/*
> color = RL.ColorAlpha( Color color, float alpha )