Pike v8.1 release 6

Method SDL.PixelFormat()->map_rgba()


Method map_rgba

int map_rgba(int r, int g, int b, int a)
int map_rgba(Image.Color.Color color, int a)

Description

Maps the RGBA color value to the specified pixel format and returns the pixel value as an integer.

If the format has a palette (8-bit) the index of the closest matching color in the palette will be returned.

If the pixel format has an alpha component it will be returned as all 1 bits (fully opaque).

Parameter r
Parameter g
Parameter b
Parameter a

The red, green and blue components specified as an integer between 0 and 255.

Parameter color

The color as represented by an Image.Color.Color object.

Returns

A pixel value best approximating the given RGB color value for a given pixel format.

See also

map_rgb(), get_rgb(), get_rgba()