Method SDL.PixelFormat()->map_rgb()


Method map_rgb

int map_rgb(int r, int g, int b)
int map_rgb(Image.Color.Color color)

Description

Maps the RGB 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

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_rgba(), get_rgb(), get_rgba()