Struct gdk::RGBA

source · []
#[repr(transparent)]
pub struct RGBA { /* private fields */ }
Expand description

A RGBA is used to represent a (possibly translucent) color, in a way that is compatible with cairo’s notion of color.

Implementations

Returns a textual specification of self in the form rgb(r,g,b) or rgba(r g,b,a), where “r”, “g”, “b” and “a” represent the red, green, blue and alpha values respectively. “r”, “g”, and “b” are represented as integers in the range 0 to 255, and “a” is represented as a floating point value in the range 0 to 1.

These string forms are string forms that are supported by the CSS3 colors module, and can be parsed by parse().

Note that this string representation may lose some precision, since “r”, “g” and “b” are represented as 8-bit integers. If this is a concern, you should use a different representation.

Returns

A newly allocated text string

Parses a textual representation of a color, filling in the red, green, blue and alpha fields of the self RGBA.

The string can be either one of:

  • A standard name (Taken from the X11 rgb.txt file).
  • A hexadecimal value in the form “`rgb”, “\rrggbb”, “\rrrgggbbb” or ”\rrrrggggbbbb`”
  • A RGB color in the form “rgb(r,g,b)” (In this case the color will have full opacity)
  • A RGBA color in the form “rgba(r,g,b,a)”

Where “r”, “g”, “b” and “a” are respectively the red, green, blue and alpha color values. In the last two cases, “r”, “g”, and “b” are either integers in the range 0 to 255 or percentage values in the range 0% to 100%, and a is a floating point value in the range 0 to 1.

spec

the string specifying the color

Returns

true if the parsing succeeded

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Returns the type identifier of Self.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Ensures that the type has been registered with the type system.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Returns a SendValue clone of self.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.