![]() |
naev 0.11.5
|
Handles colours. More...
#include "nlua_colour.h"#include "log.h"#include "nluadef.h"Go to the source code of this file.
Functions | |
| static int | colL_eq (lua_State *L) |
| Compares two colours to see if they are the same. | |
| static int | colL_tostring (lua_State *L) |
| Converts a colour to a string. | |
| static int | colL_new (lua_State *L) |
| Gets a colour. | |
| static int | colL_alpha (lua_State *L) |
| Gets the alpha of a colour. | |
| static int | colL_rgb (lua_State *L) |
| Gets the RGB values of a colour. | |
| static int | colL_hsv (lua_State *L) |
| Gets the HSV values of a colour. | |
| static int | colL_setrgb (lua_State *L) |
| Sets the colours values from the RGB colourspace. | |
| static int | colL_sethsv (lua_State *L) |
| Sets the colours values from the HSV colourspace. | |
| static int | colL_setalpha (lua_State *L) |
| Sets the alpha of a colour. | |
| static int | colL_linearToGamma (lua_State *L) |
| Converts a colour from linear to gamma corrected. | |
| static int | colL_gammaToLinear (lua_State *L) |
| Converts a colour from gamma corrected to linear. | |
| int | nlua_loadCol (nlua_env env) |
| Loads the colour library. | |
| glColour * | lua_tocolour (lua_State *L, int ind) |
| Lua bindings to interact with colours. | |
| glColour * | luaL_checkcolour (lua_State *L, int ind) |
| Gets colour at index or raises error if there is no colour at index. | |
| glColour * | lua_pushcolour (lua_State *L, glColour colour) |
| Pushes a colour on the stack. | |
| int | lua_iscolour (lua_State *L, int ind) |
| Checks to see if ind is a colour. | |
Variables | |
| static const luaL_Reg | colL_methods [] |
Handles colours.
Definition in file nlua_colour.c.
|
static |
Gets the alpha of a colour.
Value is from from 0. (transparent) to 1. (opaque).
Lua usage parameter: colour_alpha = col:alpha()
Lua function parameter: Colour col Colour to get alpha of. Lua return parameter: number The alpha of the colour.
| L | Lua State |
Lua function: alpha
Definition at line 228 of file nlua_colour.c.
|
static |
Compares two colours to see if they are the same.
Lua function parameter: Colour c1 Colour 1 to compare. Lua function parameter: Colour c2 Colour 2 to compare. Lua return parameter: boolean true if both colours are the same.
| L | Lua State |
Lua function: __eq
Definition at line 144 of file nlua_colour.c.
|
static |
Converts a colour from gamma corrected to linear.
Lua function parameter: Colour col Colour to change from gamma corrected to linear. Lua return parameter: Colour Modified colour.
Definition at line 388 of file nlua_colour.c.
|
static |
Gets the HSV values of a colour.
Values are from 0. to 1.
Lua usage parameter: h,s,v = col:rgb()
Lua function parameter: Colour col Colour to get HSV values of. Lua function parameter:[opt=false] boolean gamma Whether or not to get the gamma-corrected value or not. Lua return parameter: number The hue of the colour. Lua return parameter: number The saturation of the colour. Lua return parameter: number The value of the colour.
| L | Lua State |
Lua function: hsv
Definition at line 279 of file nlua_colour.c.
|
static |
Converts a colour from linear to gamma corrected.
Lua function parameter: Colour col Colour to change from linear to gamma. Lua return parameter: Colour Modified colour.
Definition at line 370 of file nlua_colour.c.
|
static |
Gets a colour.
Lua usage parameter: colour.new( "Red" ) – Gets colour by name Lua usage parameter: colour.new( "Red", 0.5 ) – Gets colour by name with alpha 0.5 Lua usage parameter: colour.new() – Creates a white (blank) colour Lua usage parameter: colour.new( 1., 0., 0. ) – Creates a bright red colour Lua usage parameter: colour.new( 1., 0., 0., 0.5 ) – Creates a bright red colour with alpha 0.5
Lua function parameter: number r Red value of the colour. Lua function parameter: number g Green value of the colour. Lua function parameter: number b Blue value of the colour. Lua function parameter:[opt=1.] number a Alpha value of the colour. Lua return parameter: Colour A newly created colour.
| L | Lua State |
Lua function: new
Definition at line 185 of file nlua_colour.c.
|
static |
Gets the RGB values of a colour.
Values are from 0. to 1.
Lua usage parameter: r,g,b = col:rgb()
Lua function parameter: Colour col Colour to get RGB values of. Lua function parameter:[opt=false] boolean gamma Whether or not to get the gamma-corrected value or not. Lua return parameter: number The red value of the colour. Lua return parameter: number The green value of the colour. Lua return parameter: number The blue value of the colour.
| L | Lua State |
Lua function: rgb
Definition at line 249 of file nlua_colour.c.
|
static |
Sets the alpha of a colour.
Value is from 0. (transparent) to 1. (opaque).
Lua usage parameter: col:setAlpha( 0.5 ) – Make colour half transparent
Lua function parameter: Colour col Colour to set alpha of. Lua function parameter: number alpha Alpha value to set.
| L | Lua State |
Lua function: setAlpha
Definition at line 357 of file nlua_colour.c.
|
static |
Sets the colours values from the HSV colourspace.
Values are from 0. to 1.
Lua usage parameter: col:setHSV( h, s, v )
Lua function parameter: Colour col Colour to set HSV values. Lua function parameter: number h Hue value to set. Lua function parameter: number s Saturation value to set. Lua function parameter: number v Value to set.
| L | Lua State |
Lua function: setHSV
Definition at line 335 of file nlua_colour.c.
|
static |
Sets the colours values from the RGB colourspace.
Values are from 0. to 1.
Lua usage parameter: col:setRGB( r, g, b )
Lua function parameter: Colour col Colour to set RGB values. Lua function parameter: number r Red value to set. Lua function parameter: number g Green value to set. Lua function parameter: number b Blue value to set.
| L | Lua State |
Lua function: setRGB
Definition at line 313 of file nlua_colour.c.
|
static |
Converts a colour to a string.
Lua function parameter: Colour col Colour to get string from. Lua return parameter: string A string representing the colour.
| L | Lua State |
Lua function: __tostring
Definition at line 160 of file nlua_colour.c.
| int lua_iscolour | ( | lua_State * | L, |
| int | ind ) |
Checks to see if ind is a colour.
| L | Lua state to check. |
| ind | Index position to check. |
Definition at line 120 of file nlua_colour.c.
| glColour * lua_pushcolour | ( | lua_State * | L, |
| glColour | colour ) |
Pushes a colour on the stack.
| L | Lua state to push colour into. |
| colour | Colour to push. |
Definition at line 105 of file nlua_colour.c.
| glColour * lua_tocolour | ( | lua_State * | L, |
| int | ind ) |
Lua bindings to interact with colours.
An example would be:
Lua module: colour
Gets colour at index.
| L | Lua state to get colour from. |
| ind | Index position to find the colour. |
Definition at line 80 of file nlua_colour.c.
| glColour * luaL_checkcolour | ( | lua_State * | L, |
| int | ind ) |
Gets colour at index or raises error if there is no colour at index.
| L | Lua state to get colour from. |
| ind | Index position to find colour. |
Definition at line 91 of file nlua_colour.c.
| int nlua_loadCol | ( | nlua_env | env | ) |
Loads the colour library.
| env | Environment to load colour library into. |
Definition at line 54 of file nlua_colour.c.
|
static |
Colour metatable methods.
Definition at line 33 of file nlua_colour.c.