Predefined Functions – rgba

Function name: rgba – Create color from real arguments
Synopsis: rgba(red,green,blue,alpha)


Input data type Output data type
real, real, real, real color

Description:

The function rgba(<red>,<green>,<blue>,<alpha>) returns a color which is initialized according to the four parameters passed to the function. The parameters <red>, <green>, <blue> and <alpha> should be in the range from 0 to 1. The alpha value of the color sets the transparency of the color: 0 means: color is transparent, 1 means, color is opaque.

rgba(0,0,0,1) returns an opaque black color, rgb(1,1,1,1) returns an opaque white. On initializing the color no bounds checking is done, so rgb(5,0,0,1) creates a color whose red-part is beyond the valid range. On output the value will be truncated to a correct interval (i.e. rgb(1,0,0,1). But some other functions like the merging functions do not truncate a color in any way: They then will use that value.

So it’s legal to create colors whose parts are not in the valid range from 0 to 1, but you should know what you do…

rgba