[−][src]Trait rgb::ComponentMap
Applying operation to every component
ⓘThis example is not tested
let inverted = pixel.map(|c| 255 - c); For simple math there are Add/Sub/Mul implementations: let halved = pixel.map(|c| c / 2); let halved = pixel / 2;
Required methods
fn map<Callback>(&self, f: Callback) -> DestPixel where
Callback: FnMut(SrcComponent) -> DestComponent,
Callback: FnMut(SrcComponent) -> DestComponent,
Convenience function (equivalent of self.iter().map().collect()
) for applying the same formula to every component.
Note that it returns the pixel directly, not an Interator.
Implementors
impl<T: Copy, B> ComponentMap<BGR<B>, T, B> for BGR<T>
[src]
impl<T: Copy, B> ComponentMap<BGR<B>, T, B> for BGR<T>
impl<T: Copy, B> ComponentMap<BGRA<B, B>, T, B> for BGRA<T>
[src]
impl<T: Copy, B> ComponentMap<BGRA<B, B>, T, B> for BGRA<T>
impl<T: Copy, B> ComponentMap<GrayAlpha<B, B>, T, B> for GrayAlpha<T>
[src]
impl<T: Copy, B> ComponentMap<GrayAlpha<B, B>, T, B> for GrayAlpha<T>
impl<T: Copy, B> ComponentMap<RGB<B>, T, B> for RGB<T>
[src]
impl<T: Copy, B> ComponentMap<RGB<B>, T, B> for RGB<T>
impl<T: Copy, B> ComponentMap<RGBA<B, B>, T, B> for RGBA<T>
[src]
impl<T: Copy, B> ComponentMap<RGBA<B, B>, T, B> for RGBA<T>