Struct Bgr
Source #[repr(C)]
pub struct Bgr<T> {
pub b: T,
pub g: T,
pub r: T,
}
Expand description
A Blue + Green + Red pixel.
§Examples
use rgb::Bgr;
let pixel: Bgr<u8> = Bgr { b: 0, g: 0, r: 0 };
Creates a new Bgr pixel type from its components.
Alternatively, you can use struct literal syntax to
create the new pixel type:
use rgb::Bgr;
let pixel = Bgr {b : blue, g : green, r : red};
👎Deprecated: This function has a misleading order of arguments. Use BGR{} literal instead
Convenience function for creating a new pixel
Warning: The order of arguments is R,G,B
Iterate over color components (R, G, and B)
Convenience function for converting to RGBA
👎Deprecated: use .with_alpha(a) instead
Convenience function for converting to RGBA with alpha channel of a different type than type of the pixels
Use [
::bytemuck::cast_slice()] instead.
Read more
Use [
::bytemuck::cast_slice_mut()] instead.
Read more
Performs copy-assignment from
source.
Read more
Convenience function for applying the same formula to every rgb/gray component, but skipping the alpha component.
Read more
👎Deprecated: renamed to map_colors
Alias of map_colors
Convenience function (equivalent of
self.iter().map().collect()) for applying the same formula to every component.
Read more
The components interpreted as an array, e.g. one
RGB expands to 3 elements.
Read more
The components interpreted as a mutable array, e.g. one
RGB expands to 3 elements.
Read more
Formats the value using the given formatter.
Read more
Returns the “default value” for a type.
Read more
Formats the value using the given formatter.
Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Formats the value using the given formatter.
Read more
Compares and returns the maximum of two values.
Read more
Compares and returns the minimum of two values.
Read more
Restrict a value to a certain interval.
Read more
Tests for self and other values to be equal, and is used by ==.
Tests for !=. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
This method returns an ordering between
self and
other values if one exists.
Read more
Tests less than (for
self and
other) and is used by the
< operator.
Read more
Tests less than or equal to (for
self and
other) and is used by the
<= operator.
Read more
Tests greater than (for
self and
other) and is used by the
>
operator.
Read more
Tests greater than or equal to (for
self and
other) and is used by
the
>= operator.
Read more
Formats the value using the given formatter.
Read more
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from
self to
dest.
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.
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.