C

Rgba32 Struct

struct Qul::PlatformInterface::Rgba32

The Rgba32 class provides storage space for RGBA colors. More...

Header: #include <Platforminterface/rgba32.h>
Since: Qt 1.5

This struct was introduced in Qt 1.5.

Public Functions

Rgba32(float r, float g, float b, float a = 1.f)
Rgba32(uint32_t r, uint32_t g, uint32_t b, uint32_t a = 255u)
Rgba32(uint32_t value = 0)
uint32_t alpha() const
uint32_t blue() const
uint32_t green() const
bool invisible() const
Qul::PlatformInterface::Rgba32 premultiplied() const
uint32_t red() const
void setAlpha(uint32_t value)
void setBlue(uint32_t value)
void setGreen(uint32_t value)
void setRed(uint32_t value)
bool operator!=(const Qul::PlatformInterface::Rgba32 &a, const Qul::PlatformInterface::Rgba32 &b)
bool operator==(const Qul::PlatformInterface::Rgba32 &a, const Qul::PlatformInterface::Rgba32 &b)

Detailed Description

A color is normally specified in terms of RGBA (red, green, blue and alpha) components. The Rgba32 constructors create the color based on RGBA values. The storage format of RGBA value is 0xAARRGGBB. The color components can be retrieved and set individually with red()/setRed(), blue()/setBlue(), green()/setGreen() and alpha()/setAlpha().

Member Function Documentation

Rgba32::Rgba32(float r, float g, float b, float a = 1.f)

Constructs an Rgba32 object from individual color components r g b and a. Default value for alpha channel is 1.0, which is fully opaque.

The given individual color component values should be in range 0.0-1.0. If the values are out of range, the converted integer values are clamped to range 0-255. Negative values are converted to positive values.

See also setRed(), setGreen(), setBlue(), and setAlpha().

Rgba32::Rgba32(uint32_t r, uint32_t g, uint32_t b, uint32_t a = 255u)

Constructs an Rgba32 object from individual color components r g b a. Default value for alpha channel is 255, which is fully opaque.

Only lower 8 bits of the given component values are used.

See also setRed(), setGreen(), setBlue(), and setAlpha().

Rgba32::Rgba32(uint32_t value = 0)

Constructs an Rgba32 object from value. The class assumes value to be in 0xAARRGGBB format. Default value of value is 0.

See also setRed(), setGreen(), setBlue(), and setAlpha().

uint32_t Rgba32::alpha() const

Returns alpha component of current color value.

See also setAlpha(), green(), blue(), and red().

uint32_t Rgba32::blue() const

Returns blue component of current color value.

See also setBlue(), green(), red(), and alpha().

uint32_t Rgba32::green() const

Returns green component of current color value.

See also setGreen(), red(), blue(), and alpha().

bool Rgba32::invisible() const

Returns true if the color is invisible, i.e. value of alpha component is 0.

Qul::PlatformInterface::Rgba32 Rgba32::premultiplied() const

Converts current Rgba32 into a premultiplied Rgba32.

uint32_t Rgba32::red() const

Returns red component of current color value.

See also setRed(), green(), blue(), and alpha().

void Rgba32::setAlpha(uint32_t value)

Sets alpha component of current color value. Only lower 8 bits from value are used.

See also alpha(), setGreen(), setBlue(), and setRed().

void Rgba32::setBlue(uint32_t value)

Sets blue component of current color value. Only lower 8 bits from value are used.

See also blue(), setGreen(), setRed(), and setAlpha().

void Rgba32::setGreen(uint32_t value)

Sets green component of current color value. Only lower 8 bits from value are used.

See also green(), setRed(), setBlue(), and setAlpha().

void Rgba32::setRed(uint32_t value)

Sets red component of current color value. Only lower 8 bits from value are used.

See also red(), setGreen(), setBlue(), and setAlpha().

Related Non-Members

bool operator!=(const Qul::PlatformInterface::Rgba32 &a, const Qul::PlatformInterface::Rgba32 &b)

Returns true if the a and b arguments are not equal.

bool operator==(const Qul::PlatformInterface::Rgba32 &a, const Qul::PlatformInterface::Rgba32 &b)

Returns true if the a and b arguments are equal.

Available under certain Qt licenses.
Find out more.