vtkNamedColors

Struct vtkNamedColors 

Source
pub struct vtkNamedColors(/* private fields */);
Expand description

A class holding colors and their names.

For a web page showcasing VTK Named Colors and their RGB values, see: VTKNamedColorPatches; NamedColorPatches was used to generate this table.

Color names are case insensitive and are stored as lower-case names along with a 4-element array whose elements are red, green, blue and alpha, in that order, corresponding to the RGBA value of the color.

It is assumed that if the RGBA values are unsigned char then each element lies in the range 0…255 and if the RGBA values are double then each element lies in the range 0…1.

The colors and names are those in Web colors that are derived from the CSS3 specification: CSS Color Module Level 3 In this table common synonyms such as cyan/aqua and magenta/fuchsia are also included.

Also included in this class are names and colors taken from Wrapping/Python/vtkmodules/util/colors.py that were originally taken from Wrapping/Tcl/vtktesting/colors.tcl (no longer in the VTK source files - deleted 06-Dec-2017).

Web colors and names in Web colors take precedence over those in colors.py. One consequence of this is that while colors.py specifies green as equivalent to (0,255,0), the web color standard defines it as (0,128,0).

The \a SetColor methods will overwrite existing colors if the name of the color being set matches an existing color. Note that ColorExists() can be used to test for existence of the color being set.

In the case of the \a GetColor methods returning doubles, alternative versions, identified by the letters RGB in the names, are provided. These get functions return just the red, green and blue components of a color.

The class also provides methods for defining a color through an HTML color string. The following formats are supported:

  • #RGB (3-digit hexadecimal number, where #4F2 is a shortcut for #44FF22)
  • #RRGGBB (6-digit hexadecimal number)
  • rgb(r, g, b) (where r, g, b are in 0..255 or percentage values)
  • rgba(r, g, b, a) (where r, g, b, are in 0..255 or percentage values, a is in 0.0..1.0)
  • a CSS3 color name (e.g. “steelblue”)

Implementations§

Source§

impl vtkNamedColors

Source

pub fn new() -> Self

Creates a new vtkNamedColors wrapped inside vtkNew

Trait Implementations§

Source§

impl Default for vtkNamedColors

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Drop for vtkNamedColors

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.